Re: [ros-users] Filling in all fields of a ROS msg in C++, a…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] Filling in all fields of a ROS msg in C++, at once
2011/2/12 Adam Leeper <>:
> 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?


And on top of that maybe even operators to sum, multiply etc messages
of the same type...

Steven

>
> --Adam
>
>
> Adam Leeper
> Stanford University
>
> 719.358.3804
>
>
> On Sat, Feb 12, 2011 at 2:29 PM, Steven Bellens
> <> 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
>>
>> https://code.ros.org/mailman/listinfo/ros-users
>
>
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>
>