Ask Your Question
0

Custom message type errors

asked 2015-11-16 07:45:03 -0600

yasagitov gravatar image

updated 2015-11-16 07:45:22 -0600

I am trying to create custom message with Power.msg:

# Power
std_msgs/Int64 voltage48
std_msgs/Int64 voltage12

Everything is good until i try to set a value to underlying variables, example:

 custom_msg::Power power_msgs;
 power_msgs.voltage48 = 0;
 power_msgs.voltage12 = 0;
 power_pub.publish(power_msgs);

This doesn't compile due to error: error: no match for ‘operator=’ (operand types are ‘custom_msgs::Power_<std::allocator<void> >::_voltage48_type {aka std_msgs::Int64_<std::allocator<void> >}’ and ‘int’)

What am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2015-11-16 07:50:07 -0600

Dimitri Schachmann gravatar image

try

 power_msgs.voltage48.data = 0;
 power_msgs.voltage12.data = 0;

see here:

http://docs.ros.org/jade/api/std_msgs...

edit flag offensive delete link more

Comments

Thanks! Working now

yasagitov gravatar imageyasagitov ( 2015-11-16 08:03:05 -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-11-16 07:45:03 -0600

Seen: 49 times

Last updated: Nov 16 '15