同步代码到树莓派之后,我登陆树莓派,然后使用python3 rover_demo.py --flag_dasa True想要启动小车运动,然后我们在显示屏已经确定rospy在python3里面,但是运行上述指令还是会报错说no model named rospy,没办法启动小车,请问是我的步骤有问题吗

就是会报这种错误

Please refer to the link below:

If not successful, please use python 2.7 instead of python 3 as the raspberry pi is with ros kinetic and python 2.7.

In your case, the command is:

python px4_mavros_run.py --sim False --flag_dasa True --vehicle rover


似乎还是有问题,python px4_mavros_run.py --sim False --flag_dasa True --vehicle rover

针对你的现象,有以下几个问题:

  1. bash script操作中显示 chmod: cannot access ‘/dev/ttyPixhawk’ ,这部分是表示飞控到机载电脑的连接线没有连接,请检查树莓派电脑TTL-USB到飞控串口的连接情况。

  2. 请检查DASA_space/catkinws_dasa是否在树莓派中正常编译?通过screen -ls命令检查各进程的运行情况。如果不行,请进入该目录进行重新编译,树莓派中编译大概会需要半个小时时间,请使用catkin clean && catkin build -j 1操作。(如果你之前同步代码从优盘过去,有可能把其中的部分覆盖了)

  3. 如果是2的情况,则你的python px4_mavros_run.py是不能source到正确的ros kinetic环境的。因为rospy是ros kinetic环境的包,和ros kinetic是一起的。

sudo apt-get install ros-kinetic-rospy

请学会使用英文搜索引擎或者kimi GPT搜索你的问题,因为这是做机器人技术的必要技能。