0
$\begingroup$

Rosanswers logo

I'm using a urdf for the model and I spawned it in both gazebo and rviz and I'm also using a plugin for the movement of wheels publishing it by rostopic pub -1 <topic of the wheel> std_msgs/Float32 "data: 0.0"wheel is moving in gazebo but not in rviz and I'm trying joint_state_publisher gui to move in rviz but by this only the wheel is rotating robot moel is not moving

thanks :)


Originally posted by me_saw on ROS Answers with karma: 31 on 2020-03-31

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Hi @me_saw,

When you spawn the robot in Gazebo is very important to use the Robot State Publisher. The joint_state_publisher is like a debug node to check the joint states with a topic while the robot_state_publisher is the node you need since it is the tool that uses the robot_description to build the tf tree that rviz needs to display your robot properly.

You can launch the robot_state_publisher to generate a tf_tree with:

<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

and check you tf_tree with rosrun rqt_tf_tree rqt_tf_tree.

With this set up you will be able to launch rviz and select in the Global Options --> Fixed Frame menu the Reference Link of your description.


Originally posted by Weasfas with karma: 1695 on 2020-04-01

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by me_saw on 2020-04-01:
I added the node of robot_state_publisher and i checked the tf_tree evreything is working fine but still no nothings happening in rviz

Comment by me_saw on 2020-04-01:
But just now checked rqt_graph joint_state_publisher and robot_state_publisher are connected via/joint_states but they are not connected to /gazebo

Comment by Weasfas on 2020-04-01:
Mmm that is weird, Usually, if there is something wrong rviz reports it. Have you tried to add the TF and RobotModel Display Types?

Maybe the problem is that you are using both nodes at the same time, I mean, if you launch the RST there is no need to launch the JSP because Gazebo is already publishing the Joint states. Try launching only the RST, you will see in the rqt_grap that the /joint_state topic goes to the RST node.

Comment by me_saw on 2020-04-01:
I added TF and RobotModel display If I add only robot state and remove joint state then rviz is not loading the joints of the model And i checked Gazebo's topic it doesn't have topic joint state

Comment by Weasfas on 2020-04-01:
Ok, To clarify things. When you launch Gazebo you are dealing with an abstraction of a real robot, hence you will need to provide a method to read from the joint states and publish that information. So either you have a plugin that reads from the Gazebo joints and publish the joint state information the RST publisher needs to build the TF tree, or you use already made tools like the joint_state_controller/JointStateController inerface provided in ROS control. You can find a tutorial here. The important part is the addition of transmissions and the load of the JointStateController controller interface.

Comment by me_saw on 2020-04-01:
I followed that tutorial and created transmission for my model and I also created controller .yaml file and launched that file too it gives me this error Failed to start controller in realtime loop. This should never happen

Comment by Weasfas on 2020-04-01:
Hi @me_saw,

That error is very rare, it comes from this function on ros_control impementation, and it is related with how the controllers are loaded and stopped in execution, so you could take a look at how you load those controllers and if the names and joints are all corrects. I have tried to reproduce that error but with no avail, thus, allow me to say that is nearly impossible for me or anyone in this forum to help you in this problems if you not provide any description or launch file that you are using. I mean you can make another post with this particular problem but it is likely other people is going to ask for any fil, output etc, so it is important what was the process you followed to get that error, how is your model description and how you launch those things. These are relevant things to be able to understand what is going on.

Comment by CroCo on 2022-05-21:
This should be the correct answer. Thank you.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I was using a custom plugin for my model in which I didn't published joint_state becuse of that robot_state_publisher didn't receive the joint values from the model. Now I'm publishing joint_statesso everything's working perfectly

Thank you @Weasfas :)


Originally posted by me_saw with karma: 31 on 2020-04-02

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.