You are here

Representation of points on map

How I can represent the points obtained from a laser (stored in a buffer) in a Cartesianmap (represented by CDisplayWindowPlots win ("2D simulator Gridmap"))? What draws function points?

Thanks!! 

J23

Forums: 
jlblanco's picture

Hi,

Something like this should do it:

 

#include <mrpt/gui.h>
using namspace mrpt::gui;
using namspace mrpt;


int main()
{
CDisplayWindowPlots  win("Laser scans");

// Assume "theMap" is a mrpt::slam::CSimplePointsMap,
// or otherwise fill (xs,ys) as you want:
vector_float xs,ys,zs;
theMap.getAllPoints(xs,ys,zs);

// Plot it:
win.plot(xs,ys,".b3");
win.axis_equal();

// (Optional) If want to wait for user response:
win.waitForKey();

...

}

 

 

Best,

JL

j23's picture

Sorry. I am a beginner in C + +.

For my project, I have some data from a SICK LMS 291 laser in hex and I convert todecimal and stored in a buffer.

Now, I want to move the data from the laser data for use in the map. How do the step?

Do I will use the function: void mrpt:: slam:: CSimplePointsMap: loadFromRangeScanand CObservation2DRangeScan? ...?

When I convert the data to map data. How do I represent the points in the cartesian map?

Thanks! Please excuse all the inconvenience.

j23's picture

Thanks!!!

Storing the points in a vector, I have represented the points in the Cartesian map.

.....

CDisplayWindowPlots  win("Laser scans");

vector_float xs,ys,zs;

.....

win.plot(xs,ys,".b3");

win.axis_equal();

 

....