Hi Steven-
I don't think there is. I wrote myself a helper file with a bunch of
functions to populate and return a variety of message objects like that so I
could do it in my main code in a single line.
e.g.
std_msgs::ColorRGBA createColorMsg(double red, double blue, double
green, double alpha)
{
std_msgs::ColorRGBA color;
color.r = red;
color.g = green;
color.b = blue;
color.a = alpha;
return color;
}
It seems like a collection of functions like this would be very helpful in
general, but I'm not sure where it should live. It seems the best solution
would be if each message type included such a function with it, or better
yet, a constructor that supported this, but that would imply some additional
automation in the message generation script...To the ROS devs: How hard
would it be to make the message generation step include an overloaded
constructor for each message type that could take in values?
--Adam
Adam Leeper
Stanford University
aleeper@stanford.edu
719.358.3804
On Sat, Feb 12, 2011 at 2:29 PM, Steven Bellens <
steven.bellens@mech.kuleuven.be> wrote:
> Hi,
>
> is there a way to declare a ROS msg in C++ and filling in all message
> fields at once?
> E.g. I want a message geometry_msgs/Pose:
> const geometry_msgs::Pose world = {position.x = , ... } ?
>
> regards,
>
> Steven
> _______________________________________________
> ros-users mailing list
> ros-users@code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>