[ros-users] Displaying visualization_msgs::Marker in Stage

Brian Gerkey gerkey at willowgarage.com
Thu Jun 24 15:07:35 UTC 2010


At this point, you've surpassed my knowledge of the internals of
Stage.  I suggest posting to the playerstage-users list; Richard might
be able to point you in the right direction.

PlumeSim sounds great, btw!

	brian.

2010/6/16 Gonçalo Cabrita <goncabrita at gmail.com>:
> Thanks for you help Brian.
> Unfortunately filling a model with a bunch of blocks did not have
> the behavior I was expecting :)
> Now I'm trying an array or vector of Stg::Models but with little success,
> for the reason that I guess that Stg::Models where never meant to be deleted
> and drawn over and over again!
> Let me explain what is the purpose of all this...
> Here at the lab we work mainly with odor search. So a while ago we did a
> plugin driver for Player/Stage called PlumeSim. It is able to simulate odor
> plumes and draw them in Stage so we can simulate our odor search algorithms.
> The way we draw in Stage is by using a graphics3d interface. Plumes are
> shown as a cloud of particles.
> Now we started to try ROS here at the lab so I ported PlumeSim to ROS. We
> looked for existing msg for outputting the arrays of points that PlumeSim
> creates and show them. We did this in rviz,
> using visualization_msgs::Marker. So our PlumeSim for ROS is working and we
> can see the output in rviz.
> However we also want to be able to see the plume in stageros, where the
> simulated robots will be moving, so we decided to edit it. Our idea was to
> use the visualization_msgs::Marker pretty much like we used the graphics3d,
> however once we get the data inside stageros, which is the easy part, we
> have no idea on how to properly display the plume.
> I though we should use Stg::Model cause it is the basic model. We also tried
> to understand how graphics3d works in Player/Stage when drawing in Stage but
> we can't figure it out.
> Any thoughts on this? Probably using Stg::Model isn't even the best
> solution, is there any other way?
> You can find some pics and movies of PlumeSim running on Stage at, we
> haven't updated the website with the ROS version yet.
> http://embedded.deec.uc.pt/~guardians/plumesim/Home.html
> Thanks for your help,
> Gonçalo Cabrita
> ISR - University of Coimbra
> Portugal
> On Mon, Jun 14, 2010 at 6:04 PM, Brian Gerkey <gerkey at willowgarage.com>
> wrote:
>>
>> hi Gonçalo,
>>
>> This turned out to be more trouble than I expected, but I have a
>> proof-of-concept working.  Attached is a patch against stageros that
>> has your changes, plus one important addition: calling
>> plume_model->Subscribe().  Stage doesn't bother to update models to
>> which noone has subscribed.
>>
>> With that patch, I'm able to publish and see visualization_markers,
>> e.g., using rostopic:
>>
>> rostopic pub /plumesim_markers visualization_msgs/Marker '{header:
>> auto, ns: foo, id: 0, type: 8, action: 0., points: [{x: 1., y: 1., z:
>> 1.}, {x: 2., y: 2., z: 2.}], color: {r: 1., g: 0., b: 1., a: 1.}}'
>>
>> However, publishing again with different values didn't have any
>> effect.  It looks like Stage's redraw logic is a little broken.
>> Calling Model::NeedRedraw() doesn't actually cause the display list to
>> be rebuilt.  I was able to make it work by applying the second
>> attached patch to stage itself (apply in
>> stage/build/Stage-3.2.2-Source, then 'make install' in
>> stage/build/Stage-3.2.2-Source/build).  I don't know enough about
>> OpenGL to know whether this is a good fix (e.g., will it leak
>> memory?).
>>
>> Hopefully that gets you going.  If you get things working well, please
>> send back patches and I'll integrate them.
>>
>>        brian.
>>
>> 2010/6/8 Gonçalo Cabrita <goncabrita at gmail.com>:
>> > Hi everyone!
>> > I've recently been trying to modify stageros to draw
>> > visualization_msgs::Marker. After taking a look at Stage's API this is
>> > what
>> > I came up with:
>> > // Our node
>> > class StageNode
>> > {
>> > private:
>> >
>> >     (...)
>> >     ros::Subscriber markers_sub_;
>> >     Stg::Model * plume_model;
>> >     (...)
>> > }
>> > void
>> > StageNode::markersReceived(const
>> > boost::shared_ptr<visualization_msgs::Marker const>& msg)
>> > {
>> > boost::mutex::scoped_lock lock(msg_lock);
>> > plume_model->SetColor(Stg::Color(msg->color.r, msg->color.g,
>> > msg->color.b,
>> > msg->color.a));
>> > plume_model->ClearBlocks();
>> > for(int i=0 ; i<msg->points.size() ; i++)
>> > {
>> > plume_model->AddBlockRect(msg->points[i].x, msg->points[i].y, 0.1, 0.1,
>> > 0.1);
>> > }
>> > plume_model->NeedRedraw();
>> > }
>> > StageNode::StageNode(int argc, char** argv, bool gui, const char* fname)
>> > {
>> > (...)
>> > markers_sub_ =
>> > n_.subscribe<visualization_msgs::Marker>("plumesim_markers",
>> > 10, boost::bind(&StageNode::markersReceived, this, _1));
>> > plume_model = new Stg::Model(world);
>> > plume_model->ClearBlocks();
>> > plume_model->SetObstacleReturn(0);
>> > }
>> > So I am creating a Stg::Model and I am also creating a callback for
>> > the visualization_msgs::Marker, and my idea was to push the incoming
>> > markers
>> > as Blocks into my Stg:Model and redraw it (not worrying for now how they
>> > look, just want them to show up).
>> > However so far I have had no luck. Does anyone have any experience with
>> > libstage? Am I missing something or is this entirely wrong?
>> > Thanks for the help,
>> > Gonçalo Cabrita
>> > ISR - University of Coimbra
>> > Portugal
>> > _______________________________________________
>> > ros-users mailing list
>> > ros-users at code.ros.org
>> > https://code.ros.org/mailman/listinfo/ros-users
>> >
>> >
>>
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>



More information about the ros-users mailing list