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

pass python objects in ROS messages and services

asked 2018-01-19 14:42:38 -0500

waspinator gravatar image

updated 2018-01-19 14:45:57 -0500

Is there a way to define a ROS message or service with arbitrary python objects? Is the only option to use a string and use json.dumps / json.loads?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-19 15:05:30 -0500

gvdhoorn gravatar image

updated 2018-01-19 15:10:58 -0500

Is there a way to define a ROS message or service with arbitrary python objects?

Assuming you mean: can I have fields with types of 'arbitrary Python types', then: no.

Is the only option to use a string and use json.dumps / json.loads?

Don't know whether it's the only way, but it is a way.

Can you clarify why you'd want to do this?

It's a really heavy and invasive form of coupling, which limits reusability of your components.

edit flag offensive delete link more

Comments

I use a python ORM to read/write to a database, and I was considering having a ROS node with services for each database operation. I could a) send the python object to the service to save, b) send just the properties and have the service create a new object, or c) use the ORM directly. not sure.

waspinator gravatar image waspinator  ( 2018-01-20 08:22:09 -0500 )edit

In any case: ROS 1 msg IDL only supports primitive types or composites of those types. See wiki/msg.

gvdhoorn gravatar image gvdhoorn  ( 2018-01-21 02:14:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-01-19 14:42:38 -0500

Seen: 880 times

Last updated: Jan 19 '18