0
$\begingroup$

Rosanswers logo

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


Originally posted by Praseen on ROS Answers with karma: 28 on 2013-06-25

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by dornhege with karma: 31395 on 2013-06-25

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Praseen on 2013-06-25:
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?

Comment by dornhege on 2013-06-25:
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.

Comment by Praseen on 2013-06-25:
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?

Comment by dornhege on 2013-06-25:
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.

Comment by Praseen on 2013-06-25:
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.

$\endgroup$

Your Answer

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