ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Working with a new usb-connected device on Robot in ROS?

asked 2013-04-09 04:04:37 -0600

RebeccaK375 gravatar image

updated 2013-04-11 02:11:20 -0600

felix k gravatar image

Hey all,

My goal is to have a robot output its current movement and let LEDs know when to flash, indicating that the care-o-robot is moving. I will be connecting a new LED through a USB port on the robot, but first I want to get this working in a Gazebo simulator.

The way I see it (and I may be wrong), I will need to do the following:

1) Create a node that listens to robot's base 2) Have that node output "on" or "off" to the LED connected through a USB

I am new to ROS and a little overwhelmed by the amount of tutorials. I am not sure where to look for relevant information...

Are there any tutorials that are specifically dedicated to creating new nodes for a robot? How to make that node communicate with another node on the robot?

How to define that node as the Digital Output for the LED?

I read through the general node tutorials, but when I dig through Care-o-Bot files, I find files far more complex than in the tutorial.

I know this is a lot of questions, but if you could give some advice on at least one of them, I would be very thankful! General advise is appreciated as well!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-09 04:50:41 -0600

updated 2013-04-09 04:53:48 -0600

There are conceptually two things: hardware and software. Software interacts with hardware by means of software drivers. So in your case robot, with all its motors, sensors, buttons etc. is a hardware. The low level interaction with such devices is usually achieved on OS level by drivers, these drivers in turn provide higher level software interfaces (APIs) to user programs, for instance to ROS nodes.

Thus, first you have to be able to control LED-usb-device from OS level, i.e. write/use the driver for "digital output" you mentioned. It is actually can be as simple as writing data to serial port. When it is done you will need to write a wrapper node that do the blinking. In this node add a subscriber to, for example, odometry messages and in a callback function call the LED-usb-blinking-code.

Unfortunately, I am not familiar with Care-O-Bot infrastructure and don't know the exact topic names for odometry etc, but you can try to find it out with $ rostopic list. It might be easier to do on the robot itself, but simulation should be enough as well.

Of course you may want to use services to start and stop LED-blinking-code later, but the above should be sufficient for the beginning.

P.S. Since you did the main tutorials I presume you know how to write publishers/subscribers already.

Hope it helps.

edit flag offensive delete link more


Thank you! It does give me a more clear picture!

RebeccaK375 gravatar image RebeccaK375  ( 2013-04-10 03:01:00 -0600 )edit

Question Tools


Asked: 2013-04-09 04:04:37 -0600

Seen: 1,555 times

Last updated: Apr 09 '13