Ask Your Question
0

How can I build messages separately from services ?

asked 2018-05-19 17:23:43 -0500

elpidiovaldez gravatar image

I am trying to use the i2cpwm_board package. This compiles and runs on the Raspberry Pi without problems. However I want to send servo control messages to the Pi from a PC. As I understand it this is trivial in ROS. I run the servo control service on the Pi:

roscore and rosrun i2cpwm_board i2cpwm_board

... and then send messages to it via ROS topics from the PC:

rostopic pub -1 /servos_absolute i2cpwm_board/ServoArray "{servos:[{servo: 1, value: 300}]}"

The problem is that that the PC does not understand the message ? I tried to build the i2cpwm_board package on the PC, but of course this is designed for the Pi and has many errors (the PC does not have I2C).

What is the approach for this type of multi-architecture problem ? I feel that I have to change the CMakeLists or package.xml in some way so that the PC only tries to build the messages, but I am very inexperienced with ROS and do not see how to do that.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-19 18:24:15 -0500

jayess gravatar image

updated 2018-05-19 18:26:58 -0500

Why not put the message and service definitions in a separate package from the actual service? It's actually a pretty common practice to separate code into separate minimal packages instead of one package that does everything.

edit flag offensive delete link more

Comments

Thanks. That is exactly what I need to do. I had just managed to figure it out for myself by trying to write my own version based on the ROS subscriber example.

elpidiovaldez gravatar image elpidiovaldez  ( 2018-05-19 20:54:47 -0500 )edit

As I understand it this is trivial in ROS.

@elpidiovaldez: that's exactly true, provided that the author of the package(s) that you want to communicate with don't do what the i2cpwm_board devs have done: put everything in a single package.

The suggestion by @jayess is exactly right.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-20 05:44:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-05-19 17:23:43 -0500

Seen: 53 times

Last updated: May 19 '18