简体   繁体   中英

How does "ROS" Remote Control Python script over SSH

I have a python file that driving a vehicle on gazebo simulator. From PC run testing python file sending commands to vehicle and move on without problem. When I tried to send same command (python drive.py ) over SSH ros packages rises below error. That is my problem .

kc@kc-GE60-2PC:~$ ssh remoteMachine@192.0.0.1 python moveVehicle.py
remoteMachine@'s password: 
Traceback (most recent call last):
  File "drive.py", line 15, in <module>
    import rospy
  File "/usr/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/usr/lib/python2.7/dist-packages/rospy/client.py", line 52, in <module>
    import roslib
  File "/usr/lib/python2.7/dist-packages/roslib/__init__.py", line 54, in <module>
    import roslib.stacks
  File "/usr/lib/python2.7/dist-packages/roslib/stacks.py", line 46, in <module>
    import roslib.packages
  File "/usr/lib/python2.7/dist-packages/roslib/packages.py", line 49, in <module>

  from catkin.find_in_workspaces import find_in_workspaces as catkin_find

  ImportError: No module named catkin.find_in_workspaces

I have also tried run with .sh script. But nothing has changed in error.

kc@kc-GE60-2PC:~$ ssh remoteMachine@192.0.0.1 ./testDrive.sh

*****SAME ERROR WİTH ABOVE CASE*****

I also tried : (Normally execute without SSH and Code is working fine)

remoteMachine@remoteMachine:~$ ./testDrive.sh 
Success Result Vehicle Moving:)
..


remoteMachine@remoteMachine:~$ python moveVehicle.py 
Success Result Vehicle Moving:)
..

Error Approximation

Error looks like ROS and $PythonPATH environment conflict problem. So if I had this error the code would never work.I am getting error with only SSH normally code and packages works fine. So what is the problem you are thinking about issue?

That is my question:

How can I execute my scripts over SSH without stuck any ROS environment problem.

Seems as module missing. Try check that module catkin is installed.

http://docs.ros.org/melodic/api/catkin/html/user_guide/installation.html

It should be installed as is, but may be it is missing.

sudo apt-get install cmake python-catkin-pkg python-empy python-nose libgtest-dev
sudo pip install -U catkin_pkg

If it is installed, try run it from terminal. Run python and execute:

import catkin.find_in_workspaces

If module exists, add path to it in sys.path in start of your script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM