Rosanswers logo


I'm new to ROS and trying to learn it, but seem to be missing something to complete my goal.

First of all, i work as software engineer for many years now and spend a lot of my free time in game development. But i also have a great interest in robots, but never found a way to start it due to my lack of electronics knowledge. Recently i discovered arduino and started playing with it, so this solved my issue with electronics knowledge and allowed me to build some electronics for creating a robot. My project will be based on the open source 3D printable robot InMoov (http://inmoov.fr), but by default this robot is using MyRobotLab running on windows. As i prefer linux over windows, c++ over Java and want some development (challenge) to do instead of having a full funcional robot by following the manuals and just running the software, i searched for an alternative. So i ended up with ROS :)

I started with running some tests to have a node running that drives the servo's connected to the arduino boards, so this part is working. Next, i created a description node with the urdf/xacro so i can visualize the robot in rviz, this is also working.

But now i want to publish from the command line to a topic to see the joint angle being changed in rviz, but can't figure out how to do this. I do know how to publish to a topic from the command line as i went trough all tutorials, including the turtlebot, but what is the topic for a single joint of the urdf?

This is also the part confusing me, once i can move a joint and translate this into controlling the servo, how to communicate this info between ros components like navigation, moveit, ...

Kind regards, Randy

Edit: Thanks for your answer.

I already have the URDF/xacro files and can view the robot in rviz. After a lot of experimenting i was able to set the joints by creating a cpp node publishing the entire joint state structure, causing rviz to switch between the joint_state_publisher state and my custom state, so i removed the joint_state_publisher from the launch file.

Will create a tf node tomorrow to do some experimenting with it :)

Originally posted by RandyD on ROS Answers with karma: 161 on 2017-01-25

Post score: 0


1 Answer 1


Rosanswers logo

The best way is to create a model of your robot in URDF (or, in a .xacro file that is converted to URDF by xacro). That's an XML model of each of the links and joints in your robot. Each link will have a reference frame, and each joint will have a joint angle. You use the robot_state_publisher and joint_state_publisher nodes to automatically publish appropriate frame transformations for your link frames. You can then publish new joint angles and the frame transformations will be updated automatically by those nodes.

I've only used rolling robots with ROS so far, with fixed joint angles, so I'm working from the tutorial information here. You need to do the following:

  1. Create the URDF (or .xacro, as mentioned).
  2. Create a launch file that launches robot_state_publisher and joint_state_publisher, configuring joint_state_publisher with the topics on which you want to publish joint states.
  3. In your custom node, publish joint states on your chosen topics, configured in step #2.

You'll want to read the URDF tutorials: http://wiki.ros.org/urdf/Tutorials

Start with the tf tutorial, then read 2.1, 2.2, and 2.4. Also read 4.5, which talks about how to publish joint states.

You'll probably also need to read the documentation for robot_state_publisher and joint_state_publisher:

And maybe the xacro documentation: http://wiki.ros.org/xacro

Originally posted by Mark Rose with karma: 1563 on 2017-01-25

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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