OpenAgricultureFoundation / openag_brain

ROS package for controlling an OpenAg food computer
GNU General Public License v3.0
221 stars 68 forks source link

Add POST endpoint for ROS Topics #48

Closed gordonbrander closed 7 years ago

gordonbrander commented 7 years ago

We should be able to POST via HTTP to any existing ROS topic. This will let us manually trigger actuators via HTTP on an ad-hoc basis.

gordonbrander commented 7 years ago

Here is the work in progress PR https://github.com/OpenAgInitiative/openag_brain/pull/50. I need to figure out how to take the POST data and coerce it into a typed ROS message, but in a polymorphic way. Failing that, will have to create a map of supported endpoints and type constructors.

@LeonChambers feedback welcome, since I'm sure you thought through this problem while building topic_connector.

NVM. It turns out rospy.Publish has a polymorphic call signature.

pub = rospy.Publisher('topic_name', std_msgs.msg.String, queue_size=10)
pub.publish("Some string")

Where pub.publish(a, b, ...) passes a, b, ... arguments to the given message type constructor.

gordonbrander commented 7 years ago

Closed by https://github.com/OpenAgInitiative/openag_brain/pull/50.