Hi Steven- <br><br>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.<br>e.g.<br>
<br><pre><font style="font-family: courier new,monospace;" size="2">    std_msgs::ColorRGBA createColorMsg(double red, double blue, double green, double alpha)<br>    {<br>        std_msgs::ColorRGBA color;<br>        color.r = red;<br>
        color.g = green;<br>        color.b = blue;<br>        color.a = alpha;<br>        return color;<br>    }</font><br></pre><br>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?<br>
<br>--Adam<br><br><br clear="all">Adam Leeper<br>Stanford University<br><a href="mailto:aleeper@stanford.edu">aleeper@stanford.edu</a><br>719.358.3804<br>
<br><br><div class="gmail_quote">On Sat, Feb 12, 2011 at 2:29 PM, Steven Bellens <span dir="ltr"><<a href="mailto:steven.bellens@mech.kuleuven.be">steven.bellens@mech.kuleuven.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
is there a way to declare a ROS msg in C++ and filling in all message<br>
fields at once?<br>
E.g. I want a message geometry_msgs/Pose:<br>
const geometry_msgs::Pose world = {position.x = , ... } ?<br>
<br>
regards,<br>
<br>
Steven<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br>