ROS知识要点

数据类型

int8, int16, int32, int64 (plus uint*)
float32, float64
string
time, duration
other msg files
variable-length array[] and fixed-length array[]

变量

  • $ROS_PACKAGE_PATH

命令

  • rospack
    • 包的依赖 rospack depends1 xx 或 rospack depends rospy
  • rosls
  • roscd
  • roslog

  • catkin_make –source myworkspace 指定make的目录

  • roscore

  • rosnode list

  • rosnode info /rosout
  • rosnode ping rosout

  • rosrun turtlesim turtlesim_node (可选 __name:=my_turtle)

  • rostopic list -v 列出所有主题的发布和接收

  • rostopic echo可以显示在某个话题上发布的数据胡

  • rosrun rqt_graph rqt_graph 绘制各个node发布和接收的topic

  • rosparam list

  • rosparam get /

创建一个workspace

$ mkdir -p ~/catkin_ws/src
$ cd ~/c$ cd ~/catkin_ws/
$ catkin_make_init_workspace

$ cd ~/catkin_ws/
$ catkin_make

$ source devel/setup.bash

创建包

cd ~/catkin_ws/src
catkin_create_pkg common std_msgs rospy roscpp

编译包

  • 编译所有包
cd ~/catkin_ws/ && catkin_make
  • 编译指定的包
cd ~/catkin_ws/ && catkin_make --pkg xxx

显示数据类型

 rostopic type /turtle1/cmd_vel | rosmsg show

消息的类型

发布、等待和接收

    # Publisher of type nav_msgs/Odometry
    self.ekf_pub = rospy.Publisher('output', Odometry, queue_size=5)

    # Wait for the /odom_combined topic to become available
    rospy.wait_for_message('input', PoseWithCovarianceStamped)

    # Subscribe to the /odom_combined topic
    rospy.Subscriber('input', PoseWithCovarianceStamped, self.pub_ekf_odom)

发布消息

rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

字符串消息类型: std_msgs/String

自定义消息类型: http://wiki.ros.org/cn/ROS/Tutorials/CreatingMsgAndSrv

消息映射

方法一:

rosrun topic_tools mux /camera/image_raw /camera/rgb/image_raw

  < node pkg="topic_tools" type="mux" name="mux_cmdvel" args="/camera/image_raw /camera/rgb/image_raw" / >

方法二:

  < node pkg="cmvision" type="cmvision" name="color" >
     < remap from="image" to="camera/rgb/image_raw"/ >
     < /node >

查看service的参数

 rosservice type spawn| rossrv show

运行service

rosservice call spawn 2 2 0.2 ""

教程

http://learn.turtlebot.com/
https://support.clearpathrobotics.com/hc/en-us/categories/200165795-TurtleBot

https://groups.google.com/forum/#!forum/ros-sig-turtlebot

A Gentle Introduction to ROS
https://cse.sc.edu//~jokane/agitr/

launch教程
http://wenku.baidu.com/link?url=J6CRpIO364J3eV2lbR1-Q6cV9Qp8loM519KiYCXT_hi-ZM-GHcjjeMxPyg0kK46GsPZOVAL1zYMPbV7OxvicVLjmTID4_DuHKLDgwPkjIFC

arduino

http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup

源码

https://github.com/markwsilliman/turtlebot

实例

  1. turtleBot Simulation 模拟环境的搭建
    http://learn.turtlebot.com/2015/02/01/28/
    遇到的问题见 “常见问题1”

  2. Getting Started with a Real TurtleBot
    http://cn.mathworks.com/help/robotics/examples/getting-started-with-a-real-turtlebot.html

  3. http://cn.mathworks.com/help/robotics/robot-operating-system-ros.html

  4. 拿ROS navigation 玩自主导航攻略
    http://blog.exbot.net/archives/1129

常见错误


    • 问题描述

运行 roslaunch turtlebot_gazebo gmapping_demo.launch 报如下错

[ERROR] [1433813576.466253926, 24.270000000]: Scan message must contain angles from -x to x, i.e. angle_min = -angle_max

http://answers.ros.org/question/210849/scan-message-must-contain-angles-from-x-to-x/

$ wget http://packages.ros.org/ros/ubuntu/pool/main/r/ros-indigo-gmapping/ros-indigo-gmapping_1.3.7.orig.tar.gz
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ tar xvf ../../ros-indigo-gmapping_1.3.7.orig.tar.gz
$ mv ros-indigo-gmapping-1.3.7/ gmapping
$ gedit gmapping/src/slam_gmapping.cpp

Change line 409 from:
  if (fabs(fabs(scan.angle_min) - fabs(scan.angle_max)) > FLT_EPSILON)
to:
  if (fabs(fabs(scan.angle_min) - fabs(scan.angle_max)) > 0.003) // this is the value for Kinect

$ cd ..
$ catkin_make
$ sudo cp devel/lib/gmapping/slam_gmapping* /opt/ros/indigo/lib/gmapping/

rosrun beginner_tutorials listener.py

rostopic pub -r 100 /chatter beginner_tutorials/Mcmd – {“f”,100,0.5}

你可能感兴趣的:(ROS)