Ask Your Question
0

Frame does not exist when run Gazebo

asked 2021-05-31 22:35:58 -0500

jenanaputra gravatar image

updated 2021-06-01 19:44:44 -0500

I am using ubuntu 18.04, ros melodic to simulate my URDF robot in gazebo. Then I create a dynamic node to move the robot. When I publish gazebo_msgs/ModelState with reference_frame set as "world_ned" in the dynamic node I created before, I was getting an error : "Updating ModelState: for model[MyrobotName], specified reference frame entity [world_ned] does not exist " , even though I already used a static_transform_publisher in my launch file. But when I simulate it in my rviz, there is no error like I said before. This is my tf tree : image description and this is my launch file :

<launch>
<!-- Configurable arguments -->
<arg name="enable_rviz" default="true"/>
<arg name="robot_name" default="MyrobotName"/>    
<node name="world2ned" pkg="tf" type="static_transform_publisher" args="0 0 0 0 0 3.1415 world world_ned 100"/>

<!-- Robot description -->
<arg name="model" default="$(find gb_description)/urdf/myrobotname.urdf"/>
<param name="robot_description" command="$(find xacro)/xacro $(arg model)" />

<arg name="x_pos" default="0.0"/>
<arg name="y_pos" default="0.0"/>
<arg name="z_pos" default="0.5"/>

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>

<!-- Load configs in their node namespace -->
<rosparam command="load" file="$(find gb_sim)/config/dynamics.yaml"/>


<!-- Start nodes -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen"/>
<node name="dynamics_node" pkg="gb_sim" type="dynamics_node.py" output="screen"/>


<!-- RViz -->
<node if="$(arg enable_rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find gb_description)/scene/test1.rviz"/>

<node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf"  args="-urdf -model MyrobotName -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
</launch>

Does anyone know how to solve it ?

edit retag flag offensive close merge delete

Comments

Could you provide more details? Maybe an image of your tf tree?

Akhil Kurup gravatar image Akhil Kurup  ( 2021-05-31 22:42:28 -0500 )edit

Sure, I have already provided the image of my tf tree

jenanaputra gravatar image jenanaputra  ( 2021-05-31 23:00:46 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-06-01 09:13:30 -0500

updated 2021-06-01 19:58:11 -0500

with reference_frame set as "my_new_frame" in the node I created before

So as you can see from your tf tree above, there is no frame called my_new_frame.

I already used a static_transform_publisher in my launch file

If you are using a static_transform_publisher to generate this frame, there is something wrong going on there because you must be able to see the frame. Can you show us how you are calling your static transform publisher?

But when I simulate it in my rviz, there is no error

Unfortunately RViz is not a simulator. It is only a visualizer that lets you view your robot model (in this case). You can add the /tf topic in rviz to view the tree as well. It is likely that your my_new_frame wont show up there too.

EDIT (after launch file):
Your launch file does not have a static_transform_publisher that generates "my_new_frame". What is your "my_new_frame" supposed to link to? You will have to add a second static_transform_publisher from that link to "my_new_frame" for this to work.

edit flag offensive delete link more

Comments

Can you share your launch file too?

Akhil Kurup gravatar image Akhil Kurup  ( 2021-06-01 09:14:19 -0500 )edit

Sure , I've already update my question above, so you can give me an advice about that. I just realized that when I removed a line <include file="$(find gazebo_ros) ...... and removed a line <node pkg="gazebo_ros" type="spawn_model" ...... on my launch file, there is no error like I said before.

jenanaputra gravatar image jenanaputra  ( 2021-06-01 19:52:34 -0500 )edit

I set my_new_frame to world_ned

jenanaputra gravatar image jenanaputra  ( 2021-06-01 20:28:26 -0500 )edit

Then you will need to add something like this:
<node name="newframe2world" pkg="tf" type="static_transform_publisher" args="0 0 0 0 0 0 my_new_frame world_ned 100"/>

Akhil Kurup gravatar image Akhil Kurup  ( 2021-06-02 11:59:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-05-31 22:35:58 -0500

Seen: 257 times

Last updated: Jun 01 '21