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

How to add control algorithm in ROS

asked 2015-01-19 13:13:48 -0500

Kishore Kumar gravatar image

I get values from an analog sensor via rosserial and I want to add an if condition to glow the LED if the sensor reading exceeds the threshold value. How can I add the if condition in ROS to accomplish this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-01-19 15:34:42 -0500

DevonW gravatar image

This is a programming question. Will you be using C++ or Python? You'll need to create a ROS Node and subscribe to the rosserial topic in it and assign the values from there. Then, on the node's callback from the topic subscription you can add an if statement that checks if the threshold is met. When the threshold is met, you can send a command down rosserial to your analog sensor make the LED glow.

See: creating a ROS node See: rosserial tutorials See: ROS subscribers and publishers

The function calls needed to accomplish your task can be found if you go through those tutorials. It shouldn't take long.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-01-19 13:13:48 -0500

Seen: 312 times

Last updated: Jan 19 '15