Ask Your Question
0

Overload << operator for msg

asked 2015-06-15 01:29:00 -0600

HououinKyouma gravatar image

Hi,

Simple and maybe stupid question, but is it possible to overload the << operator for ROS messages? When a message is generated this operator is automatically overloaded for them, but I would like to change the way they are printed for plotting purposes.

Wilson

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-06-15 01:49:38 -0600

ahendrix gravatar image

The C++ compiler only allows one operator overload for each method signature.

If you want to print your messages in a plot-friendly format, you can write a function that converts messages to custom formatted strings, and print those.

You should also investigate the -p option to rostopic echo, to see if it can do what you need: rostopic echo -p /my_topic

edit flag offensive delete link more

Comments

I see. I didn't know it was not possible to overload an operator again. The -p option seems useful, but I'm writing my results to a file so I can't use that now. I guess I'll just convert the messages using a function, thanks.

HououinKyouma gravatar imageHououinKyouma ( 2015-06-15 02:26:06 -0600 )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: 2015-06-15 01:29:00 -0600

Seen: 219 times

Last updated: Jun 15 '15