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

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
0

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 http://wiki.ros.org/ROSNodeTutorialC%... See: rosserial tutorials http://wiki.ros.org/rosserial/Tutorials See: ROS subscribers and publishers http://wiki.ros.org/ROS/Tutorials/Wri...

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

Stats

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

Seen: 313 times

Last updated: Jan 19 '15