ros(Melodic)记录 |
您所在的位置:网站首页 › melodic安装步骤 › ros(Melodic)记录 |
目录
写在前面安装ros melodic例程turtlesimTF
点云命令编译
消息资料参考完
写在前面
1、本文内容 ros入门基础 2、平台 windows10, vmware workstation, ubuntu1804 3、转载请注明出处: https://blog.csdn.net/qq_41102371/article/details/125223367 安装ros melodic安装虚拟机ubuntu1804 安装ros Melodic,参考官方教程 http://wiki.ros.org/melodic/Installation/Ubuntu sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt install curl # if you haven't already installed curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - sudo apt update sudo apt install ros-melodic-desktop-full echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential sudo rosdep init #rosdep update会失败,网上可找到解决方法https://blog.csdn.net/zbw1185/article/details/123807654 rosdep update 例程 turtlesim启动roscore roscore打开新的命令行终端 rosrun turtlesim turtlesim_node键盘控制小乌龟,打开新的终端输入 rosrun turtlesim turtle_teleop_key使用上下左右键控制乌龟运动,注意要在输入命令的终端上使用上下左右才行 计算图,打开新的终端 rqt_graph(去掉debug勾选后) 查看系统节点 rosnode list查看节点信息 rosnode info /turtlesim查看当前话题 rostopic list发布话题控制海龟运动 只发布一次 rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear: x: 2.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 1.0" # 每秒发布10次,海龟一直运动 rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear: x: 2.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 1.0"查看消息结构 rosmsg show geometry_msgs/Twist查看服务 rosservice list产生新的海龟,坐标(5,5,),名称turtle2 rosservice call /spawn "x: 5.0 y: 5.0 theta: 0.0 name: 'turtle2'"控制第二个海龟运动 rostopic pub -r 10 /turtle2/cmd_vel geometry_msgs/Twist "linear: x: 2.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 1.0"话题记录,记录当前的话题数据到文件,以后可以复现该话题 上下左右控制海龟动几下,然后在rosbag record的窗口ctrl+c结束记录 复现之前的记录 关掉之前的turtlesim,重新打开一个turtlesim,然后复现运动 rosbag play cmd_record.bag TFROS学习–轻松使用tf https://blog.csdn.net/start_from_scratch/article/details/50762293 静态发布tf关系: 点云rviz点云显示,alpha参数: http://wiki.ros.org/rviz/DisplayTypes/PointCloud 命令 # 查看当前话题列表 rostopic list # 查看话题信息 rostopic info /tutlesim rosmsg show sensor_msgs/PointCloud # 话题记录,会记录在cmd_record.bag文件里面 rosbag record -a -O cmd_record # 话题复现 rosbag play cmed_record.bag 编译catkin buid https://blog.csdn.net/dzhongjie/article/details/83868684 catkin clean #清理某个包 catkin clean pkgnamehttps://zhuanlan.zhihu.com/p/399753815 catkin文档 https://catkin-tools.readthedocs.io/en/latest/verbs/catkin_clean.html 消息wait_for_massage https://vimsky.com/examples/detail/python-method-rospy.wait_for_message.html 抛出异常处理: c++: http://wiki.ros.org/roscpp/Overview/Exceptions https://www.ncnynl.com/archives/201702/1302.html roscpp所有的异常都继承基类ros::Exception try{ ; } catch(ros::Exception &ex){ ; }python: http://wiki.ros.org/rospy/Overview/Exceptions try: ... except Exception as e: rospy.logerr(e.args)python取消消息订阅 https://stackoverflow.com/questions/38487816/unsubscribing-from-ros-topic-python sub = rospy.subscriber("/cameras/left_hand_camera/image",Image,self.callback_viewer) sub.unregister() 资料ros cpp 教程 http://wiki.ros.org/roscpp_tutorials/Tutorials ros API https://wiki.ros.org/APIs 参考古月居ros教程: https://www.bilibili.com/video/BV1zt411G7Vn 完如有错漏,敬请指正 --------------------------------------------------------------------------------------------诺有缸的高飞鸟202206 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |