[ros-users] rviz OccupancyGrid message display

Top Page
Attachments:
Message as email
+ (text/plain)
+ map_display.cpp.patch (text/x-patch)
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
CC: clemens.eppner
Subject: [ros-users] rviz OccupancyGrid message display
Hi!

I wonder whether it would be possible to have rviz display the occupancy
values
of the nav_msgs/OccupancyGrid message as probabilities instead of the
current
ternary representation as occupied/free/unknown.
I think this decision is due to the fact that the costmap_2d package
uses the same
ternary representation. However, according to the message definition,
the data
field is supposed to store probabilities in the range of [0,100]. Hence,
I think it would
be more consistent and less confusing to have rviz indicate those
probabilities in some way.
I included a small patch which does what I think rviz should do.

Dan

On 12/25/2009 05:08 PM, Clemens Eppner wrote:
> hello,
>
> i am trying to visualize a likelihood field in rviz. but when i use
> nav_msgs/OccupancyGrid rviz only distinguishes between
> occupied/unoccupied/unknown and ignores all other grey values. How can I
> workaround this? Sending a different colored Marker/Cube message for
> every grid map cell would certainly do the trick but may be not very
> efficient.
> What would you recommend?
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> ros-users mailing list
>
> https://lists.sourceforge.net/lists/listinfo/ros-users

--- default_plugin/map_display.cpp.orig    2010-11-22 17:56:42.570676865 +0100
+++ default_plugin/map_display.cpp    2010-11-22 18:30:09.779552958 +0100
@@ -275,13 +275,7 @@
     for(unsigned int i=0;i<msg->info.width;i++)
     {
       unsigned char val;
-      if(msg->data[j*msg->info.width+i] == 100)
-        val = 0;
-      else if(msg->data[j*msg->info.width+i] == 0)
-        val = 255;
-      else
-        val = 127;
-
+      val = static_cast<int>( (100 - msg->data[j*msg->info.width+i])*255/100.0);
       int pidx = (j*width_ + i);
       pixels[pidx] = val;
     }

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev_______________________________________________
ros-users mailing list

https://lists.sourceforge.net/lists/listinfo/ros-users