Gazebo | Ignition | Community
Ask Your Question
0

How to provide a Fixed Frame to Rviz Ignition?

asked 2022-05-06 08:14:56 -0500

raefsel gravatar image

updated 2022-05-06 10:01:46 -0500

I am trying to get started with RViz and Gazebo Ignition and have a simple two-wheeled robot with a lidar in Gazebo. I now would like to at least see the lidar in RViz but would prefer to see the lidar and have its center move around as my robot is moving in Gazebo. At this point I have tried everything that I can think of and have Google searched for everything that seems likely. I haven't found any demos that I could get to run that could help.

In RViz, I am seeing "Fixed Frame [Warn] No tf data. Frame [world] does not exist."

What can I do to provide a frame of reference so that Rviz will not have this error and will presumably let me see the lidar? I'm assuming that it would be something that I would put in my .sdf file.

Update: I just tried replacing RViz ignition with the older/alternate Rviz and am having the same issue there as well about not finding the fixed frame.

edit retag flag offensive close merge delete

Comments

If I were doing this with the older Gazebo, I would add the following within the libgazebo_ros_diff_drive plugin section of my .world file: <odometry_frame>world_frame</odometry_frame> In Rviz, I would select "world_frame" as my fixed frame in Global Options. That would make the lidar's location in RViz track around with the location of my robot.

raefsel gravatar imageraefsel ( 2022-05-06 09:29:33 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-05-09 12:33:11 -0500

raefsel gravatar image

For the future reference of anyone else searching for the same thing: Based on Azeey's response, I now have a fixed frame that Ignition RViz likes but I still can't see my lidar. The code that Azeey posted is giving the following two topics that are seen when I enter ign topic -l

/model/jack_robot/pose
/model/jack_robot/pose_static

I named my model 'jack_robot' in the .sdf file.

I stuck the code that Azeey posted within this tag:

<model name='jack_robot' canonical_link='chassis'>

That didn't solve the issue of Ignition RViz not finding a fixed frame. It was the bit at the end of his message that did the trick. I created a static transform publisher based off of the Python turtlebot tf2 example code. I have the following in that code:

static_transformStamped.header.frame_id = 'world'
static_transformStamped.child_frame_id = 'jackFrameId'

Both of those are showing up in Ignition Rviz and it is happy with respect to the fixed frame issue that I was seeing before.

To get those fixed frames over to Ignition I need to have the following in my launch file:

    Node(
        package='ros_ign_bridge',
        executable='parameter_bridge',
        arguments=['/tf@tf2_msgs/msg/TFMessage@ignition::msgs::Pose_V']
    ),

If I am understanding what Azeey is saying with his links, I would take the poses generated by Ignition Gazebo and would use a bridge to get that over to ROS2 where my node would republish it as a /tf and use another bridge to get it back to Ignition whre Rviz will now be happy AND will track the position of the robot. I plan on trying that in a bit but first I want to see my lidar in Rviz. Provided that I get that to happen and succeed in what I just described, then I'll update this post with full details of how I got it to work.

edit flag offensive delete link more
0

answered 2022-05-06 15:37:49 -0500

azeey gravatar image

I think you can do this by using the PosePublisher system. Here's an example from SubT:

   <plugin filename="libignition-gazebo-pose-publisher-system.so"
        name="ignition::gazebo::systems::PosePublisher">
        <publish_link_pose>true</publish_link_pose>
        <publish_sensor_pose>true</publish_sensor_pose>
        <publish_collision_pose>false</publish_collision_pose>
        <publish_visual_pose>false</publish_visual_pose>
        <publish_nested_model_pose>true</publish_nested_model_pose> <!-- this bit is important -->
        <use_pose_vector_msg>true</use_pose_vector_msg>
        <static_publisher>true</static_publisher>
        <static_update_frequency>1</static_update_frequency>
      </plugin>

You'll also need a ros_ign bridge and a TF broadcaster

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-05-06 08:14:56 -0500

Seen: 1,291 times

Last updated: May 09 '22