首页 > Web开发 > 详细

ROS入门级学习(基于Ubuntu16.04+kinetic)

时间:2018-02-22 20:40:26      阅读:270      评论:0      收藏:0      [点我收藏+]

Setup

roscore # making sure that we have roscore running
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key # Now you can use the arrow keys of the keyboard to drive the turtle around.

ROS Topics

sudo apt-get install ros-kinetic-rqt
sudo apt-get install ros-kinetic-rqt-common-plugins
rosrun rqt_graph rqt_graph
rostopic -h
rostopic echo /turtle1/cmd_vel # you will now see topic datas when you press the arrow key in turtle_teleop_key terminal 

技术分享图片

rostopic list -h # figure out what argument the list sub-command needs
rostopic list -v # displays a verbose list of topics to publish to and subscribe to and their type
rostopic type /turtle1/cmd_vel  # You should get the message type of the topic: geometry_msgs/Twist
rosmsg show geometry_msgs/Twist  #  look at the details of the message using rosmsg

Using rostopic pub

# publishes data on to a topic, rostopic pub [topic] [msg_type] [args]
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- [2.0, 0.0, 0.0] [0.0, 0.0, 1.8]
#  publishes the velocity commands at a rate of 1 Hz on the velocity topic
rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- [2.0, 0.0, 0.0] [0.0, 0.0, -1.8]
# Now We can also look at what is happening in rqt_graph. 
# and see the data published by our turtlesim
rostopic echo /turtle1/pose

# see how fast the turtlesim_node is publishing /turtle1/pose, $ rostopic hz [topic]
rostopic hz /turtle1/pose

# get in depth information about a topic
rostopic type /turtle1/cmd_vel | rosmsg show

Using rqt_plot

rosrun rqt_plot rqt_plot
# a text box in the upper left corner gives you the ability to add any topic to the plot. 
# Typing /turtle1/pose/x and add it.
# Typing /turtle1/pose/y and add it.

技术分享图片

 

ROS入门级学习(基于Ubuntu16.04+kinetic)

原文:https://www.cnblogs.com/xbit/p/8459686.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!