Klamp't  0.9.0
Public Types | Public Member Functions | Public Attributes | List of all members
Klampt::LaserRangeSensor Class Reference

Simulates a laser range sensor, either sweeping or stationary. Can both simulate both 1D sweeping and 2D sweeping. More...

#include <VisualSensors.h>

Inheritance diagram for Klampt::LaserRangeSensor:
Klampt::SensorBase

Public Types

enum  { SweepSinusoid, SweepTriangular, SweepSawtooth }
 

Public Member Functions

virtual const char * Type () const override
 
virtual void Simulate (SimRobotController *robot, Simulator *sim) override
 Called whenever the sensor is updated from the simulaton.
 
virtual void SimulateKinematic (RobotModel &robot, WorldModel &world) override
 Updates the sensor for a kinematic world. Useful for non-simulation debugging.
 
virtual void Advance (double dt) override
 Advances to the next time step with duration dt elapsed.
 
virtual void Reset () override
 Should be overridden if the sensor is stateful to reset to an initial state.
 
virtual void MeasurementNames (vector< string > &names) const override
 Must be overridden to produce a list of names of each measurement.
 
virtual void GetMeasurements (vector< double > &values) const override
 Must be overridden to returns a list of all measurements.
 
virtual void SetMeasurements (const vector< double > &values) override
 
virtual map< string, string > Settings () const override
 Returns a map of all current name-value pairs of the sensor's settings.
 
virtual bool GetSetting (const string &name, string &str) const override
 Get a named setting. Returns false if the name is not supported.
 
virtual bool SetSetting (const string &name, const string &str) override
 
virtual void DrawGL (const RobotModel &robot, const vector< double > &measurements) override
 
- Public Member Functions inherited from Klampt::SensorBase
virtual bool ReadState (File &f)
 
virtual bool WriteState (File &f) const
 
virtual void GetInternalState (vector< double > &state) const
 Any other state besides measurements/settings that you might want to store. Used in ReadState.
 
virtual void SetInternalState (const vector< double > &state)
 Any other state besides measurements/settings that you might want to store. Used in WriteState.
 

Public Attributes

int link
 
RigidTransform Tsensor
 z is forward, x points left, y points up
 
int measurementCount
 number of readings per cycle
 
double depthResolution
 resolution of the depth measurement
 
double depthMinimum
 
double depthMaximum
 minimum / maximum depth
 
double depthVarianceLinear
 
double depthVarianceConstant
 
Real xSweepMagnitude
 
Real xSweepPeriod
 
Real xSweepPhase
 
int xSweepType
 
Real ySweepMagnitude
 
Real ySweepPeriod
 
Real ySweepPhase
 
int ySweepType
 
vector< double > depthReadings
 
Real last_dt
 
Real last_t
 
- Public Attributes inherited from Klampt::SensorBase
string name
 
double rate
 
bool enabled
 

Detailed Description

Simulates a laser range sensor, either sweeping or stationary. Can both simulate both 1D sweeping and 2D sweeping.

Default configuration sets up a 1D triangular scan along x direction with 180 degree field of view and instantaneous measurement.

Note: if you place this inside a robot's geometry, the minimum range should extend past the robot's geometry.

Currently intensity information is not provided.

Configurable settings:

Member Enumeration Documentation

anonymous enum

enum defining a pattern of the sweep.

  • Sinusoid is sin(u*2pi),
  • Triangular is 2*(1+abs(u mod 2 - 1))-1 (range is [-1,1])
  • Sawtooth is 2*(u mod 1)-1 (range is [-1,1])

To do a continuously rotating sensor, do a sawtooth with magnitude 2pi

Member Function Documentation

virtual void Klampt::LaserRangeSensor::DrawGL ( const RobotModel robot,
const vector< double > &  measurements 
)
overridevirtual

If the sensor can be drawn, draw the sensor on the robot's current configuration, using these measurements, using OpenGL calls.

Reimplemented from Klampt::SensorBase.

virtual void Klampt::LaserRangeSensor::SetMeasurements ( const vector< double > &  values)
overridevirtual

Updates the internal measurement vector. Should be overridden to correctly restore state using ReadState(), or to visualize a physical robot's sensors.

Reimplemented from Klampt::SensorBase.

virtual bool Klampt::LaserRangeSensor::SetSetting ( const string &  name,
const string &  str 
)
overridevirtual

Set a named setting. Returns false if the name is not supported, or the value is formatted incorrectly

Reimplemented from Klampt::SensorBase.

Member Data Documentation

Real Klampt::LaserRangeSensor::xSweepMagnitude

if period != 0: yaw angle (rotation about y axis) at time t is magnitude*f((t+phase)/period) where f is the sweep type. A measurement is produced every 2 * magnitude / measurementCount radians. If period = 0: measurement sweeps over range of [-magnitude,magnitude]

Real Klampt::LaserRangeSensor::ySweepMagnitude

If period != 0: pitch angle (rotation about x axis) at time t is magnitude*f((t+phase)/period) where f is the sweep type. A measurement is produced every 2 * magnitude / measurementCount radians. If period = 0: measurement sweeps over range of [-magnitude,magnitude]


The documentation for this class was generated from the following file: