0
$\begingroup$

Rosanswers logo

Hello,

I was wondering what controllers does ROS provide that can run with a robot that publishes position and velocity measurements? I have my hardware up and running and publishing on the /joint_states topic but I am unsure how to approach either designing my own controller or implementing one that has already been created. Does anyone have some insights?

Kind Regards, Martin


Originally posted by MartinW on ROS Answers with karma: 464 on 2013-02-06

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

There is no unified control package so far, this is why people are often relying on Orocos and Orocos RTT so far for non-PR2 robots.

You can divide your software into two parts, the low and high level. The low-level talks with your actuators in a real-time way to ensure proper motion execution. AFAIK (except the Orocos packages), the only controller available for now is the pr2_controller_manager. This control framework embeds different controllers, in particular one to move the base and others to move the arms following a pre-planned trajectory. One can communicate with these controllers using actionlib. It is interesting because it allows you to replace the control layer easily. See pr2_controllers for more information.

Basically you have two options right now:

  1. use Orocos,
  2. fork pr2_controller_manager. Note that 2. is not that hard actually as the software is not that PR2-centric (at least on the architecture point of view).

And depending on your choice controllers may or may not come with the infrastructure. But AFAIK most of them are tightly coupled with the control architecture they depend on.

Please note that there is on-going discussion about how to write a unified framework.


Originally posted by Thomas with karma: 4478 on 2013-02-06

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by MartinW on 2013-02-07:
Thanks, this is a great help! I think I will try to do number 2, just to stay within the ROS framework but it's good to know there are other options! I have one more question though, I have encoders for 4 of the joints (pos/vel) but servers for the other 4 joints, Do I need 4 controllers for 2 arms?

Comment by fergs on 2013-02-07:
There is currently a port of pr2_controller_manager to be more generic. It is ongoing here: https://github.com/willowgarage/ros_control and https://github.com/willowgarage/ros_controllers

$\endgroup$
0
$\begingroup$

Rosanswers logo

Thomas is correct, ROS is used to give DrRobot a brain, so @martinw you have to write your own "controller" to make it move first. It's difficult and you will have to figure most of it out by yourself.

Assuming you are using this platform called DrRobot, it must be something like this
http://www.drrobot.com/products_H20.asp
which looks like a bad-ass robot, so you should contact the company and ask about ROS support.

This got me interested...
From googling, it seems they have already released a ROS driver for some of their mobile ground robots:
http://jaguar.drrobot.com/specification_V4.asp
http://code.google.com/p/drrobot-ros-demo-base/

As for writing a controller for your robot, googling
site:answers.ros.org controllers or drivers
gives many great answers, including:
http://answers.ros.org/question/12182/controllers-vs-drivers/
http://answers.ros.org/question/11833/i-have-a-mobile-robot-that-isnt-currently-supported-by-ros-how-should-i-structure-the-driver-nodes-to-expose-my-robots-integrated-sensors-and/

First do the rest of the ROS tutorials, including the 2D turtle in simulation, and install the Turtlebot simulator (by Yujin/Willow) and do the tutorials for that too.
Then buy and read the ROS book.
Look at the ROS robots page and look at the code for all robots that are like yours e.g. low cost mobile robot.
Google will also find you great blogs by fellow users who have documented the process e.g. the Pi Robot tutorials, and Clam robot
There is less information about writing ROS wrapper for a robot arm, but there are examples of ROS packages that control the Bioloid/Dynamixel motors (wrappers for the Dynamixel driver) and the Katana stack (wrapper for the Katana control library).

To write your own ROS controller for your robot, you need to check what existing code is available in C/C++/Python to control the robot, and write a ROS wrapper (google it) for that code. In the best case, you can take some example code that comes with DrRobot, that maybe controls the robot via wireless link, then link to the ROS libraries (as per the ROS C++ tutorials) and simply bolt-on ROS topics to that code. You already have a joint state publisher, so obviously you know how to read from the encoders. Now you need to write some subscribers.

For the base: Look at the functions you have for controlling DrRobot, like stop/go/left/right or velocity=0to100 and decide what ROS message type matches that, like a Boolean or Velocity message. (google ROS message types) Like in the tutorials, there will be a callback for receiving the message, which is where you pass the data to the DrRobot function. Make it so that when you send a ROS message to your drrobot_driver node, it makes the robot move.

Then from your reading above, you will have seen that other mobile robots use 1 ROS message type in particular: "twist". So you can integrate that into your driver. Then if you launch an existing ROS joystick controller, that outputs messages on the /twist topic, your robot will move. Now you have a driver and you've leveraged existing ROS code to control it with a joystick.

For an arm: Look at the functions you have for moving the arm e.g. move absolute 20 degrees or relative 1.2 radians. Then add a subscriber using the same joint states ROS Message type, which will accommodate position and velocity if required. The callback in your code will take those position or velocity values and send them to the DrRobot function. Now you can move the arm.

Lastly, you will need to modify a copy of the (Follow)JointTrajectory node to convert between trajectory messages to position/velocity messages for your robot. That step will be the most difficult. The only information currently available is looking at this code from other robot arms.


Originally posted by dbworth with karma: 1103 on 2013-02-06

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by MartinW on 2013-02-07:
Hey dbworth! Thanks for responding, this is a great answer. Right now, I can send C++ commands through their driver and I have it publishing joint states. So do I write my controller within this driver? Or get it to subscribe to a controller that publishes on a different topic?

Comment by MartinW on 2013-02-07:
I think I understand how we call trajectories with a traj_client, and I've looked at other peoples action servers, joint_trajectory_action (the motoman one you suggested). But it's the interaction with the hardware code (working in ROS), the controllers, and the action server.Cant I make it all one?

Comment by MartinW on 2013-02-07:
Also, I'm just working on the robot's arms right now, the code I adapted was the ROS Jaguar code for their mobile robot :) My research colleague is going to start working on the base when he gets back from vacation! Thanks again for all the help

$\endgroup$

Your Answer

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