openrave.org

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
OpenRAVE::SensorBase Class Referenceabstract

[interface] A sensor measures physical properties from the environment. If not specified, method is not multi-thread safe. See Sensor Concepts. More...

#include <sensor.h>

Inheritance diagram for OpenRAVE::SensorBase:
Inheritance graph
[legend]
Collaboration diagram for OpenRAVE::SensorBase:
Collaboration graph
[legend]

Classes

class  ActuatorGeomData
 
class  ActuatorSensorData
 An actuator for modeling motors and other mechanisms that produce torque/force. The actuator has only one degree of freedom. More...
 
class  CameraGeomData
 
class  CameraSensorData
 
class  Force6DGeomData
 
class  Force6DSensorData
 Stores force data. More...
 
class  IMUGeomData
 
class  IMUSensorData
 Stores IMU data. More...
 
class  JointEncoderGeomData
 
class  JointEncoderSensorData
 Stores joint angles and EE position. More...
 
class  LaserGeomData
 
class  LaserSensorData
 
class  OdometryGeomData
 
class  OdometrySensorData
 odometry data storing full 6D pose and velocity More...
 
class  SensorData
 used to pass sensor data around More...
 
class  SensorGeometry
 permanent properties of the sensors More...
 
class  TactileGeomData
 
class  TactileSensorData
 tactle data More...
 

Public Types

enum  SensorType {
  ST_Invalid =0, ST_Laser =1, ST_Camera =2, ST_JointEncoder =3,
  ST_Force6D =4, ST_IMU =5, ST_Odometry =6, ST_Tactile =7,
  ST_Actuator =8, ST_NumberofSensorTypes =8
}
 
enum  ConfigureCommand {
  CC_PowerOn =0x10, CC_PowerOff =0x11, CC_PowerCheck =0x12, CC_RenderDataOn =0x20,
  CC_RenderDataOff =0x21, CC_RenderDataCheck =0x23, CC_RenderGeometryOn =0x30, CC_RenderGeometryOff =0x31,
  CC_RenderGeometryCheck =0x32
}
 A set of commands used for run-time sensor configuration. More...
 
typedef
geometry::RaveCameraIntrinsics
< dReal
CameraIntrinsics
 
typedef boost::shared_ptr
< SensorBase::SensorData
SensorDataPtr
 
typedef boost::shared_ptr
< SensorBase::SensorData const > 
SensorDataConstPtr
 
typedef boost::shared_ptr
< SensorBase::SensorGeometry
SensorGeometryPtr
 
typedef boost::shared_ptr
< SensorBase::SensorGeometry
const > 
SensorGeometryConstPtr
 
- Public Types inherited from OpenRAVE::InterfaceBase
typedef std::map< std::string,
XMLReadablePtr,
CaseInsensitiveCompare
READERSMAP
 

Public Member Functions

 SensorBase (EnvironmentBasePtr penv)
 
virtual ~SensorBase ()
 
virtual int Configure (ConfigureCommand command, bool blocking=false)=0
 Configures properties of the sensor like power.
 
virtual bool SimulationStep (dReal fTimeElapsed) OPENRAVE_DUMMY_IMPLEMENTATION
 Simulate one step forward for sensors.
 
virtual SensorGeometryPtr GetSensorGeometry (SensorType type=ST_Invalid)=0
 Returns the sensor geometry. This method is thread safe.
 
virtual SensorDataPtr CreateSensorData (SensorType type=ST_Invalid)=0
 Creates the sensor data to be specifically used by this class.
 
virtual bool GetSensorData (SensorDataPtr psensordata)=0
 Copy the most recent published data of the sensor given the type.
 
virtual bool Supports (SensorType type)=0
 returns true if sensor supports a particular sensor type
 
virtual void SetTransform (const Transform &trans)=0
 Set the transform of a sensor (global coordinate system).
 
virtual Transform GetTransform ()=0
 the position of the sensor in the world coordinate system
 
virtual UserDataPtr RegisterDataCallback (SensorType type, const boost::function< void(SensorDataConstPtr)> &callback) OPENRAVE_DUMMY_IMPLEMENTATION
 Register a callback whenever new sensor data comes in.
 
virtual const std::string & GetName () const
 
virtual void SetName (const std::string &newname)
 
- Public Member Functions inherited from OpenRAVE::InterfaceBase
 InterfaceBase (InterfaceType type, EnvironmentBasePtr penv)
 
virtual ~InterfaceBase ()
 
InterfaceType GetInterfaceType () const
 
const std::string & GetXMLId () const
 
const std::string & GetPluginName () const
 
EnvironmentBasePtr GetEnv () const
 
const READERSMAPGetReadableInterfaces () const
 Returns the raw map reference, this is not multithread safe and the GetInterfaceMutex should be locked before using.
 
virtual XMLReadablePtr GetReadableInterface (const std::string &xmltag) const
 Returns the readable interface. [multi-thread safe]
 
virtual XMLReadablePtr SetReadableInterface (const std::string &xmltag, XMLReadablePtr readable)
 Set a new readable interface and return the previously set interface if it exists. [multi-thread safe]
 
virtual const std::string & GetDescription () const
 Documentation of the interface in reStructuredText format. See Documenting Interfaces. [multi-thread safe]
 
virtual void SetDescription (const std::string &description)
 sets a description [multi-thread safe]
 
virtual void SetUserData (const std::string &key, UserDataPtr data) const
 set user data for a specific key. [multi-thread safe]
 
virtual UserDataPtr GetUserData (const std::string &key=std::string()) const
 return the user custom data [multi-thread safe]
 
virtual bool RemoveUserData (const std::string &key) const
 removes a user data pointer. if user data pointer does not exist, then return 0, otherwise 1. [multi-thread safe]
 
virtual void SetUserData (UserDataPtr data) RAVE_DEPRECATED
 
virtual const std::string & GetURI () const
 the URI used to load the interface (sometimes this is not possible if the definition lies inside an environment file). [multi-thread safe]
 
virtual const std::string & GetXMLFilename () const
 
virtual void Clone (InterfaceBaseConstPtr preference, int cloningoptions)
 Clone the contents of an interface to the current interface.
 
virtual bool SendCommand (std::ostream &os, std::istream &is)
 Used to send special commands to the interface and receive output.
 
virtual void Serialize (BaseXMLWriterPtr writer, int options=0) const
 serializes the interface
 

Static Public Member Functions

static InterfaceType GetInterfaceTypeStatic ()
 return the static interface type this class points to (used for safe casting)
 

Protected Attributes

std::string _name
 name of the sensor
 
- Protected Attributes inherited from OpenRAVE::InterfaceBase
std::string __description
 

Additional Inherited Members

- Protected Types inherited from OpenRAVE::InterfaceBase
typedef boost::function< bool(std::ostream
&, std::istream &)> 
InterfaceCommandFn
 The function to be executed for every command.
 
- Protected Member Functions inherited from OpenRAVE::InterfaceBase
virtual void RegisterCommand (const std::string &cmdname, InterfaceCommandFn fncmd, const std::string &strhelp)
 Registers a command and its help string. [multi-thread safe]
 
virtual void UnregisterCommand (const std::string &cmdname)
 Unregisters the command. [multi-thread safe]
 
virtual boost::shared_mutex & GetInterfaceMutex () const
 

Detailed Description

[interface] A sensor measures physical properties from the environment. If not specified, method is not multi-thread safe. See Sensor Concepts.

Definition at line 30 of file sensor.h.

Member Typedef Documentation

Definition at line 47 of file sensor.h.

Definition at line 64 of file sensor.h.

Definition at line 63 of file sensor.h.

Definition at line 189 of file sensor.h.

Definition at line 188 of file sensor.h.

Member Enumeration Documentation

A set of commands used for run-time sensor configuration.

Enumerator:
CC_PowerOn 

turns the sensor on, starts gathering data and using processor cycles. If the power is already on, servers as a reset. (off by default)

CC_PowerOff 

turns the sensor off, stops gathering data (off by default).

CC_PowerCheck 

returns whether power is on

CC_RenderDataOn 

turns on any rendering of the sensor data (off by default)

CC_RenderDataOff 

turns off any rendering of the sensor data (off by default)

CC_RenderDataCheck 

returns whether data rendering is on

CC_RenderGeometryOn 

turns on any rendering of the sensor geometry (on by default)

CC_RenderGeometryOff 

turns off any rendering of the sensor geometry (on by default)

CC_RenderGeometryCheck 

returns whether geometry rendering is on

Definition at line 300 of file sensor.h.

Enumerator:
ST_Invalid 
ST_Laser 
ST_Camera 
ST_JointEncoder 
ST_Force6D 
ST_IMU 
ST_Odometry 
ST_Tactile 
ST_Actuator 
ST_NumberofSensorTypes 

Definition at line 33 of file sensor.h.

Constructor & Destructor Documentation

OpenRAVE::SensorBase::SensorBase ( EnvironmentBasePtr  penv)
inline

Definition at line 289 of file sensor.h.

virtual OpenRAVE::SensorBase::~SensorBase ( )
inlinevirtual

Definition at line 291 of file sensor.h.

Member Function Documentation

virtual int OpenRAVE::SensorBase::Configure ( ConfigureCommand  command,
bool  blocking = false 
)
pure virtual

Configures properties of the sensor like power.

Parameters
typeConfigureCommand
blockingIf set to true, makes sure the configuration ends before this function returns.(might cause problems if environment is locked).
Exceptions
openrave_exceptionif command doesn't succeed
virtual SensorDataPtr OpenRAVE::SensorBase::CreateSensorData ( SensorType  type = ST_Invalid)
pure virtual

Creates the sensor data to be specifically used by this class.

Parameters
typethe requested sensor type to create. A sensor can support many types. If type is ST_Invalid, then returns a data structure of the type most representative of this sensor.
Returns
new SensorData class
static InterfaceType OpenRAVE::SensorBase::GetInterfaceTypeStatic ( )
inlinestatic

return the static interface type this class points to (used for safe casting)

Definition at line 295 of file sensor.h.

virtual const std::string& OpenRAVE::SensorBase::GetName ( ) const
inlinevirtual
Returns
the name of the sensor

Definition at line 363 of file sensor.h.

virtual bool OpenRAVE::SensorBase::GetSensorData ( SensorDataPtr  psensordata)
pure virtual

Copy the most recent published data of the sensor given the type.

Once GetSensorData returns, the caller has full unrestricted access to the data. This method is thread safe.

Parameters
psensordataA pointer to SensorData returned from CreateSensorData, the plugin will use psensordata->GetType() in order to return the correctly supported type.
virtual SensorGeometryPtr OpenRAVE::SensorBase::GetSensorGeometry ( SensorType  type = ST_Invalid)
pure virtual

Returns the sensor geometry. This method is thread safe.

Parameters
typethe requested sensor type to create. A sensor can support many types. If type is ST_Invalid, then returns a data structure
Returns
sensor geometry pointer, use delete to destroy it
virtual Transform OpenRAVE::SensorBase::GetTransform ( )
pure virtual

the position of the sensor in the world coordinate system

virtual UserDataPtr OpenRAVE::SensorBase::RegisterDataCallback ( SensorType  type,
const boost::function< void(SensorDataConstPtr)> &  callback 
)
virtual

Register a callback whenever new sensor data comes in.

Parameters
typethe sensor type to register for
callbackthe user function to call, note that this might block the thread generating/receiving sensor data
virtual void OpenRAVE::SensorBase::SetName ( const std::string &  newname)
inlinevirtual

Definition at line 366 of file sensor.h.

virtual void OpenRAVE::SensorBase::SetTransform ( const Transform trans)
pure virtual

Set the transform of a sensor (global coordinate system).

Sensors attached to the robot have their transforms automatically set every time the robot is moved

Parameters
trans- The transform defining the frame of the sensor.
virtual bool OpenRAVE::SensorBase::SimulationStep ( dReal  fTimeElapsed)
virtual

Simulate one step forward for sensors.

Only valid if this sensor is simulation based. A sensor hooked up to a real device can ignore this call

virtual bool OpenRAVE::SensorBase::Supports ( SensorType  type)
pure virtual

returns true if sensor supports a particular sensor type

Member Data Documentation

std::string OpenRAVE::SensorBase::_name
protected

name of the sensor

Definition at line 371 of file sensor.h.


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