Ask Your Question

Problems in setting up a new robot and hardware interfacing!

asked 2015-07-28 18:15:47 -0500

Mos gravatar image

Hi folks,

I have a 4WD/4WS mobile robot, which I can control it through rosserial/arduino (open loop control). I have setup the robot in Gazebo and I'm able to use ros controllers to control each joint with position_joint_controller and velocity_joint_controller. As we know setting up and applying ros control is easy for simulation in Gazebo using URDF files which make it easy for us to use ros control just by adding plugins and transmission tags, but when it's coming to real hardware it makes a lot of confusions.

I followed Adolfo Rodriguez's RosCon 2014 lecture and it explains everything very well and of course very brief.

Q1) How can I read from and write to my hardware? (Adolfo's lecture page 43) Do you have a good example for rosserial? What do I need to have to define each of my actuators as a joint? (it can be easily done by URDF files for Gazebo usuing transmission tags).

I tried to write an interface node to get cmd_vel and publish it to my servos but what I want is to use ros_control. Sorry if my question is not that clear but if you please help me with some examples if you have.


edit retag flag offensive close merge delete


Can you already read/write raw data from your arduino device?.

Adolfo Rodriguez T gravatar image Adolfo Rodriguez T  ( 2015-08-06 06:02:42 -0500 )edit

I actually have a node, subscribing to cmd_vel from ROS and encoder ticks from ardunio usuing rosserial. It also publishes RPM/Speed to ROS and PWM to arduino to drive the dc motors.

Mos gravatar image Mos  ( 2015-08-06 21:28:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-06 06:15:55 -0500

Adolfo Rodriguez T gravatar image

If you can already read/write raw data from hardware, you need to map this raw data into ros_control interfaces. Regardless of how you talk to hardware, these are some examples of how to do this mapping:

edit flag offensive delete link more


Thanks! So far what I did to finally figuring everything out is to subscribe to data I need in read function and publish the required data through write function and now everything works perfectly fine.

Mos gravatar image Mos  ( 2015-08-14 20:27:39 -0500 )edit

hey Mos, can you add your solution like example? I don't know how i can map the raw data

al0ne gravatar image al0ne  ( 2017-04-04 07:56:08 -0500 )edit

For anyone stumbling upon this and found that the linked lines no longer match up, here are the commit-independent links to the snippets: gz_ros_ctrl, KUKA.

Irin Thirdwater gravatar image Irin Thirdwater  ( 2019-03-24 21:02:11 -0500 )edit

For al0ne, you've probably already solved your problem so I doubt you will need this, but it generally involves:

  1. Having a set of variables representing your data (in KUKA's example, they have arrays for position, velocity, and effort for each joints) (these, you should update constantly through your robot hw's read/write methods)
  2. Assigning these variables to a corresponding resource handle (note in KUKA's, this is done in a loop for each joint j)
  3. Registering the handle(s) to the interface in your robot hw (for joint states in KUKA, step 2 and 3 have been inlined)
Irin Thirdwater gravatar image Irin Thirdwater  ( 2019-03-24 21:06:57 -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



Asked: 2015-07-28 18:15:47 -0500

Seen: 1,059 times

Last updated: Aug 06 '15