ros-simulation / gazebo_ros_demos

Example robots and code for interfacing Gazebo with ROS
352 stars 226 forks source link

Insert an optical frame so that rviz/Camera can correctly overlay #15

Closed lucasw closed 7 years ago

lucasw commented 8 years ago

Insert an optical frame so that rviz/Camera can correctly on top of the camera image. Also zero out hackBaseline so that there isn't an offset between the gazebo image and the rviz overlay. This follows from https://github.com/ros-simulation/gazebo_ros_pkgs/issues/424

In separate terminals:

roslaunch rrbot_gazebo rrbot_world.launch
roslaunch rrbot_control rrbot_control.launch
rostopic pub /rrbot/joint2_position_controller/command std_msgs/Float64 "data: -0.9"

I made rrbot_control.launch launch rviz, I think if it is launching rviz then it is less likely this will get fouled up in the future. A test could be devised but I think it would have to involve whole image pixel comparisons with stored images.

The joint command should make the arm visible in the camera view, and when that is done it is possible to look for discrepancies between the rviz generate robotmodel and the gazebo generated image of the arm. If hackBaseline is non-zero then there will be a ghost arm slightly offset from the other arm, or if the optical frame were wrong the rviz/Camera image could be pointed anywhere else at all.

This shows the correctly overlaying robotmodel on the gazebo image: http://answers.ros.org/upfiles/1461298601930351.png

It might be nice if the gazebo camera plugin could generate the right frame and it wasn't up to the user to create it in xacro, but at least having a good example of doing it manually in this repository will reduce confusion- I made https://github.com/ros-simulation/gazebo_ros_pkgs/issues/424 with changing the plugin in mind.

lucasw commented 7 years ago

I got rid of the rviz launch and changed this to kinetic-devel