日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2024/4/24 编程问答 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 操作ROS松灵机器人步骤及遇到的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

小車型號:scout-v2.0

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

或者

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

注意:使用https://github.com下載的很慢,可以采用國內鏡像替換https://www.jianshu.com/p/29824058380f

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

  • Enable gs_usb kernel module

    $ sudo modprobe gs_usb
  • Bringup can device

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

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

    $ sudo apt install can-utils
  • Testing command

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

  • $ sudo apt install -y libasio-dev $ sudo apt install -y ros-$ROS_DISTRO-teleop-twist-keyboard
  • 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

  • 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 版本不同造成編譯錯誤,參考https://blog.csdn.net/xrinosvip/article/details/81177873

    修改成統一版本即可編譯成功!!!

    命令如下:(查看版本)

    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
    解決方案參考https://blog.csdn.net/weixin_45688316/article/details/103697198

    python版本的問題!! 

    解決方案
    因為ubuntu18.04使用的ros版本是melodic,而melodic默認使用的是python2,但是我們跑代碼實際用的是python3。
    所以現在bashrc文件里加

    alias python=python3

    保存后

    source ~/.bashrc

    下載rospkg

    pip3 install rospkg

    問題解決
    ?

    總結

    以上是生活随笔為你收集整理的操作ROS松灵机器人步骤及遇到的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。