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

Connecting ROS to external hardware

asked 2013-06-25 00:58:12 -0600

Praseen gravatar image

Hello, I have a ROS Groovy Galapagos bare bones installation from binary on the Raspberry Pi which has a Raspbian wheezy running on it. I intend to first connect an LED via an I2C connector to the Raspberry Pi, after this I intend to connect a simple switch via an I2C connector to the Raspberry Pi. How do I configure The ROS middleware installed on the Raspberry Pi to accept commands like ON/OFF from the switch and then convey it to the LED?. I am a beginner in ROS, with my limited understanding I believe I would need to make both the hardware switch and LED as nodes in ROS and the node for the LED as a subscriber and the node for the switch as a publisher. Please let know if I am wrong, else how can I go about doing what I require?

Thanks in advance, Praseen

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-25 01:02:26 -0600

dornhege gravatar image

You are right. The LED will be a subscriber, the switch will publish the switches state, although both functionalities can go in the same node.

std_msgs/Bool might probably be the thing you'd want to use for that.

edit flag offensive delete link more



Hi dornhege, How do I go about creating the ROS node required Which part of the tutorial tells how to create a node? I am working on the Basic Tutorial now. As mentioned in the question I also have an I2C connector connecting the Rasberry Pi and the switches and the LED. Will that make a difference?

Praseen gravatar image Praseen  ( 2013-06-25 01:11:18 -0600 )edit

The basic tutorials should contain info on creating and building packages. From then on, you'll need to do the hardware integration as you'd do with any other binary. The only difference to other nodes is that you might need a thread depending on how you access the hardware.

dornhege gravatar image dornhege  ( 2013-06-25 01:14:48 -0600 )edit

Hi dornhege, I would be indebted, if it would be possible to let me know of a step by step procedure or a link containing an example solution for such a problem? So in this case the thread which you talk of should be used to implement an I2C send/receive?

Praseen gravatar image Praseen  ( 2013-06-25 01:25:40 -0600 )edit

Not necessarily. It just depends on how you do the hardware connection. I don't know what interfaces/device drivers you have available to do that. Maybe you can do that quite simply.

dornhege gravatar image dornhege  ( 2013-06-25 01:34:28 -0600 )edit

Hi dornhege, I am building this system as part of a building block for a robot, that is the reason why I wanted to use an I2C interface. However right now I am happy to just use some GPIOs to connect the LED and switch to the RPi. I would eventually want to use an I2C connector later.

Praseen gravatar image Praseen  ( 2013-06-25 02:07:54 -0600 )edit

Question Tools


Asked: 2013-06-25 00:58:12 -0600

Seen: 517 times

Last updated: Jun 25 '13