0

I use pycharm to remotely connect to the ros environment of the container on the server locally. When the subprocess.Popen() function in the code runs the roscore command, an error occurs that the rosout node cannot be located.

The port mapping of the container is -p 8025:22 -p 11311:11311

this is my code: roscore_cmd = "roscore"

roscore_process = subprocess.Popen(roscore_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, text=True) output, errors = roscore_process.communicate() print(output) print(errors)

the error is: ERROR: cannot launch node of type [rosout/rosout]: Cannot locate node of type [rosout] in package [rosout]. Make sure file exists in package path and permission is set to executable (chmod +x) RLException: failed to start core service [/rosout] The traceback for the exception was written to the log file

I can run the roscore command normally in the terminal, and an error will be reported in pycharm. I can confirm that roscore has been successfully executed, and there is an output log, but if the rosout node cannot be found, it will report an error and exit

I added the ros environment variable ROS_MASTER_URI=http://localhost:11311 in the Run->Edit Configurations->Environment variables setting in pycharm ROS_PACKAGE_PATH=/opt/ros/noetic/share ROS_ROOT=/opt/ros/noetic/share/ros, and configure the ros package path on the remote container, so that the remote python interpreter on pycharm can correctly find the corresponding python package of ros

0 Answers0