操作ROS松灵机器人步骤及遇到的问题

小车型号:scout-v2.0

https://github.com/agilexrobotics/scout_ros(所用包的下载地址)

或者

https://hub.fastgit.org/agilexrobotics/scout_ros

注意:使用https://github.com下载的很慢,可以采用国内镜像替换Github国内镜像网站,解决Github访问的神器 - 简书

https://hub.fastgit.org/agilexrobotics/scout_ros

Communication interface setup

不用管前面得序号,直接一步一步敲命令

Setup UART

Generally your RS232-to-USB cable should be automatically recognized as "/dev/ttyUSB0" or something similar and ready for use. If you get the error "... permission denied ..." when trying to open the port, you need to grant access of the port to your user account:

$ sudo usermod -a -G dialout $USER

You need to re-login to get the change to take effect.

Setup CAN-To-USB adapter

  1. Enable gs_usb kernel module

    $ sudo modprobe gs_usb
    
  2. Bringup can device

    $ sudo ip link set can0 up type can bitrate 500000
    
  3. If no error occured during the previous steps, you should be able to see the can device now by using command

    $ ifconfig -a
    
  4. Install and use can-utils to test the hardware

    $ sudo apt install can-utils
    
  5. Testing command

    # receiving data from can0
    $ candump can0
    # send data to can0
    $ cansend can0 001#1122334455667788
  1. Install dependent libraries

  2. $ sudo apt install -y libasio-dev
    $ sudo apt install -y ros-$ROS_DISTRO-teleop-twist-keyboard
    
  3. Clone the packages into your catkin workspace and compile

    (the following instructions assume your catkin workspace is at: ~/catkin_ws/src)

    $ cd ~/catkin_ws/src
    $ git clone --recursive https://github.com/agilexrobotics/ugv_sdk.git  
    $ git clone https://github.com/agilexrobotics/scout_ros.git
    $ cd ..
    $ catkin_make
    

    if your car is 1.0 version,Please run this command to switch ugv_sdk to 1.0 version

    $ cd ugv_sdk && git checkout master
    

    then recompile

  4. Launch ROS nodes

  • Start the base node for scout

    $ roslaunch scout_bringup scout_minimal.launch
    

    The scout_bringup/scout_minimal.launch has 5 parameters:

    • port_name: specifies the port used to communicate with the robot, default = "can0"
    • simulated_robot: indicates if launching with a simulation, default = "false"
    • model_xacro: specifies the target ".xacro" file for the publishing of tf frames, default = scout_v2.xacro
    • odom_topic_name: sets the name of the topic which calculated odometry is published to, defaults = "odom"
    • is_scout_mini:Suitable for chassis of type scout_mini,defaults = "false"
  • Start the base node for scout-mini

    $ roslaunch scout_bringup scout_mini_minimal.launch
    
  • Start the keyboard tele-op node

    $ roslaunch scout_bringup scout_teleop_keyboard.launch

一.catkin_make编译时,总失败,报错如下:

param_demo.cpp:(.text+0x50):对‘ros::init(int&, char**, std::string const&, unsigned int)’未定义的引用

param_demo.cpp:(.text+0x80):对‘ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)’未定义的引用

param_demo.cpp:(.text+0xb8):对‘ros::param::get(std::string const&, int&)’未定义的引用

param_demo.cpp:(.text+0x100):对‘ros::NodeHandle::getParam(std::string const&, int&) const’未定义的引用

param_demo.cpp:(.text+0x1e8):对‘ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)’未定义的引用

解决办法:g++ 和gcc 版本不同造成编译错误,参考Ubuntu18.04多个版本GCC编译器的切换_ubuntu glibc存在多种版本-CSDN博客

修改成统一版本即可编译成功!!!

命令如下:(查看版本)

gcc -v 

g++ -v

(修改g++ 和gcc的版本,选择数字后回车即可,gcc 和g++ 必须统一才行!)

sudo update-alternatives --config g++

 sudo update-alternatives --config gcc

二.运行roslaunch scout_bringup scout_minimal.launch 报错如下:

RLException: [scout_minimal.launch] is neither a launch file in package [scout_bringup] nor is [scout_bringup] a launch file name
The traceback for the exception was written to the log file

解决方案:在catkin_ws目录下:source ./devel/setup.bash 即可解决

三. nanjingtech@nanjingtech-desktop:~/catkin_ws2$ source ./devel/setup.bash
   nanjingtech@nanjingtech-desktop:~/catkin_ws2$ roslaunch scout_bringup scout_teleop_keyboard.launch 

报错如下:

ModuleNotFoundError: No module named 'rospkg'
[teleop_keybord-1] process has died [pid 7638, exit code 1, cmd /opt/ros/melodic/lib/teleop_twist_keyboard/teleop_twist_keyboard.py __name:=teleop_keybord __log:=/home/nanjingtech/.ros/log/c9cfb1de-edf0-11eb-818c-845cf327b690/teleop_keybord-1.log].
log file: /home/nanjingtech/.ros/log/c9cfb1de-edf0-11eb-818c-845cf327b690/teleop_keybord-1*.log

all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
解决方案参考ModuleNotFoundError: No module named ‘rospkg‘_modulenotfounderror: no module named 'rospkg-CSDN博客

python版本的问题!! 

解决方案
因为ubuntu18.04使用的ros版本是melodic,而melodic默认使用的是python2,但是我们跑代码实际用的是python3。
所以现在bashrc文件里加

alias python=python3

保存后

source ~/.bashrc

下载rospkg

pip3 install rospkg

问题解决
 

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值