From d68e157511c377c6ea0ef8e2233bd0c11f526c1e Mon Sep 17 00:00:00 2001 From: gavanderhoorn Date: Sun, 28 Jan 2024 17:09:53 +0100 Subject: [PATCH 1/2] No need for the named-pipe redirection any more Appears we can directly open the named pipe from FS Lua, so no need to check for the redirected named-pipe any more. Corresponding changes to FS19_modROS have also been made. --- nodes/all_in_one_publisher.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/nodes/all_in_one_publisher.py b/nodes/all_in_one_publisher.py index 7cacf15..f599dc0 100644 --- a/nodes/all_in_one_publisher.py +++ b/nodes/all_in_one_publisher.py @@ -82,21 +82,10 @@ def create_pipe(pipe_name): if __name__ == '__main__': try: - named_pipe_path = os.path.join(os.environ['USERPROFILE'], "Documents/My Games/FarmingSimulator2019/mods/modROS/ROS_messages") - # check if a symbolic link to a named pipe has been created - if not (os.path.islink(named_pipe_path)): - print("Cannot find required symbolic link, has it been created? Please refer to the readme for information.") - sys.exit(1) - else: - print("symbolic link has already been created") - - # wait a bit to ensure that symbolic links have been created - time.sleep(1) - object_class = ROSMessagePublisher() rospy.init_node('ros_publisher', anonymous=True) - pipe = create_pipe("ROS_messages") + pipe = create_pipe("FS19_modROS_pipe") print("waiting for client from FarmSim19") win32pipe.ConnectNamedPipe(pipe, None) print("got client from game!!") From fef7987589fa6f7634b91e025ed192a3ae0ccfa1 Mon Sep 17 00:00:00 2001 From: gavanderhoorn Date: Sun, 28 Jan 2024 17:10:20 +0100 Subject: [PATCH 2/2] readme: symbolic link is no longer needed --- README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/README.md b/README.md index 3e7c5cc..663a0f2 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,6 @@ Clone the repository or download the `.zip` at any location git clone https://github.com/tud-cor/fs_mod_ros_windows.git ``` -#### Creating the symbolic link - -In order to exchange data with the Python side of the mod, the script uses a symbolic link to a *named pipe*. -The symbolic link needs to be created *only once*. Do not create it every time the FarmSim is rebooted. - -Open a `cmd` window and run the following command: - -```cmd -mklink "%USERPROFILE%\Documents\My Games\FarmingSimulator2019\mods\modROS\ROS_messages" \\.\pipe\ROS_messages -``` - -If you get the message *You do not have sufficient privilege to perform this operation*, right-click the Command Prompt shortcut, and select __Run as administrator__ to start an elevated shell. Then try creating the symbolic link again. - #### Setting up Python 3 `virtualenv` ```cmd