赞
踩
最近在remap机器人发布的joint_states的时候遇到了一些问题,在此以几个例子记录一下launch文件的配置。
先敲黑板!!!:
<remap from="/source_topic" to="/target_topic" />
<remap from="/target_topic" to="/source_topic" />
节点中通过ros::Publisher发布了base/joint_states,head/joint_states,torso/joint_states,想要把发布出来的话题重映射到joint_states上,可以这么写:
<?xml version="1.0"?>
<launch>
<group ns="dhrobot">
<remap from="base/joint_states" to="joint_states" />
<remap from="head/joint_states" to="joint_states" />
<remap from="torso/joint_states" to="joint_states" />
<node name="robot_driver" pkg="dhrobot_driver" type="robot_driver" />
</group>
</launch>
rostopic list一下可以看到话题:
/dhrobot//joint_states
节点中通过Ros::Subscriber想要接收/image话题,但是实际摄像头发布的话题是/kinect2/hd/image_color,所以需要这样处理:
<?xml version="1.0"?>
<launch>
<node name="robot_visual" pkg="dhrobot_demo" type="robot_visual" >
<remap from="/image" to="/kinect2/hd/image_color" />
</node>
</launch>
rosrun joint_state_pub base/joint_states:=joint_states
rosrun robot_state_publisher /joint_states:=/base/joint_states
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。