simulator-sdk  2.4.3.28-r2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Public Attributes | List of all members
Sim::HALInterface Class Reference

HALInterface is responsible for reading and writing values into the Hardware Abstraction Layer (HAL) of the robot. More...

#include <alnaosim.h>

Public Member Functions

 HALInterface (const Model *model, int NAOqiId=9559)
 creates a HALInterface given a valid model. More...
 
 ~HALInterface ()
 destructor. More...
 
float fetchAngleActuatorValue (const AngleActuator *angleActuator)
 returns the last command value (in radians) of the given angleActuator. More...
 
float fetchCoupledActuatorValue (const CoupledActuator *coupledActuator)
 returns the last command value (between 0 and 1, no unit) of the given coupledActuator. More...
 
float fetchTorqueActuatorValue (const TorqueActuator *torqueActuator)
 returns the last command value (in Newton per meter) of the given torqueActuator. More...
 
float fetchAngleSpeedActuatorValue (const AngleSpeedActuator *angleSpeedActuator)
 returns the last command value (in radians per second) of the given angleSpeedActuator. More...
 
float fetchWheelTorqueActuatorValue (const WheelTorqueActuator *wheelTorqueActuator)
 returns the last command value (in Newton per meter) of the given wheelTorqueActuator. More...
 
float fetchWheelVelocityActuatorValue (const WheelVelocityActuator *wheelVelocityActuator)
 returns the last command value (in radians per second) of the given wheelVelocityActuator. More...
 
float fetchLEDActuatorValue (const LEDActuator *ledActuator)
 returns the last command value (between 0 and 1) of the given ledActuator. More...
 
float fetchAngleActuatorStiffness (const AngleActuator *angleActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given angleActuator. More...
 
float fetchCoupledActuatorStiffness (const CoupledActuator *coupledActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given coupledActuator. More...
 
float fetchTorqueActuatorStiffness (const TorqueActuator *torqueActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given torqueActuator. More...
 
float fetchAngleSpeedActuatorStiffness (const AngleSpeedActuator *angleSpeedActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given angleSpeedActuator. More...
 
float fetchWheelTorqueActuatorStiffness (const WheelTorqueActuator *wheelTorqueActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given wheelTorqueActuator. More...
 
float fetchWheelVelocityActuatorStiffness (const WheelVelocityActuator *wheelVelocityActuator)
 returns the last stiffness value (between 0 and 1, no unit) of the given wheelVelocityActuator. More...
 
bool sendAngleSensorValue (const AngleSensor *angleSensor, float value)
 sends value (in radians) to the given angleSensor. More...
 
bool sendCoupledSensorValue (const CoupledSensor *coupledSensor, float value)
 sends value (between 0 and 1, no unit) to the given coupledSensor. More...
 
bool sendTorqueSensorValue (const TorqueSensor *torqueSensor, float value)
 sends value in Newton per meter to the given torqueSensor. More...
 
bool sendAngleSpeedSensorValue (const AngleSpeedSensor *angleSpeedSensor, float value)
 sends value in radians per second to the given angleSpeedSensor. More...
 
bool sendWheelVelocitySensorValue (const WheelVelocitySensor *wheelVelocitySensor, float value)
 sends value in radians per second to the given wheelVelocitySensor. More...
 
bool sendCameraSensorValue (const CameraSensor *cameraSensor, const unsigned char *img)
 sends the content of the buffer img to the given cameraSensor More...
 
bool sendCameraSensorValue (const CameraSensor *cameraSensor, const unsigned char *img, CameraResolution camResolution, CameraColorSpace camColorSpace)
 sends the content of the buffer img to the given cameraSensor More...
 
bool sendCameraDepthSensorValue (const CameraDepthSensor *cameraDepthSensor, const float *buffer)
 sends the content of the buffer depth to the given cameraDepthSensor. More...
 
bool sendCameraDepthSensorValue (const CameraDepthSensor *cameraDepthSensor, const float *buffer, CameraResolution camResolution, CameraColorSpace camColorSpace)
 sends the content of the buffer depth to the given cameraDepthSensor. More...
 
bool sendFSRSensorValue (const FSRSensor *fsrSensor, float value)
 sends value (in kilograms) to the given fsrSensor. More...
 
bool sendBumperSensorValue (const BumperSensor *bumperSensor, float value)
 sends value (between 0 and 1, no unit) to the given bumperSensor. More...
 
bool sendTactileSensorValue (const TactileSensor *tactileSensor, float value)
 sends value (between 0 and 1, no unit) to the given tactileSensor. More...
 
bool sendDepthInfraredSensorValue (const DepthInfraredSensor *depthInfraredSensor, float value)
 sends value (in meters) to the given DepthInfraredSensor. More...
 
bool sendSingleDepthSensorValue (const SingleDepthSensor *singleDepthSensor, float value)
 sends value (in meters) to the given SingleDepthSensor. More...
 
bool sendInertialSensorValues (const InertialSensor *inertialSensor, const std::vector< float > &values)
 sends values (see remarks) to the given inertialSensor. More...
 
bool sendSonarSensorValues (const SonarSensor *sonarSensor, const std::vector< float > &values)
 sends values in meters to the given sonarSensor (see remarks). More...
 
bool sendSonarSensorValue (const SonarSensor *sonarSensor, float value)
 sends value in meters to the given sonarSensor (see remarks). More...
 
bool sendArrayDepthSensorValues (const ArrayDepthSensor *arrayDepthSensor, const std::vector< float > &values)
 sends values in meters to the given arrayDepthSensor More...
 
void cameraBufferSize (const CameraSensor *camera, int *cameraBufferSize, int *width, int *height)
 gives the buffer size, width and height of the given camera More...
 
int cameraBufferSize (const CameraSensor *camera)
 returns the buffer size of the camera. More...
 
void cameraDepthBufferSize (const CameraDepthSensor *camera, int *cameraBufferSize, int *width, int *height)
 gives the buffer size, width and height of the given depth camera. More...
 
CameraResolution cameraResolution (const BaseCamera *camera) const
 gives the current resolution of the given CameraSensor More...
 
CameraColorSpace cameraColorSpace (const BaseCamera *camera) const
 gives the current color space of the given CameraSensor More...
 

Public Attributes

class HALInterfaceImpl * a_impl
 Private implementation. More...
 

Detailed Description

HALInterface is responsible for reading and writing values into the Hardware Abstraction Layer (HAL) of the robot.

Remarks
Values from the HAL are read by NAOqi, so changing these values allows you to simulate stimuli from the environment to NAOqi.
This lib uses NAOqi logging system (qi::log). The log system needs to be initialized in the main of your application, see libqi documentation. NAOqi launches this logging system, so you will see log messages if you launch a NAOqi while using this lib.

Definition at line 61 of file alnaosim.h.

Constructor & Destructor Documentation

Sim::HALInterface::HALInterface ( const Model model,
int  NAOqiId = 9559 
)

creates a HALInterface given a valid model.

Sim::HALInterface::~HALInterface ( )

destructor.

Member Function Documentation

void Sim::HALInterface::cameraBufferSize ( const CameraSensor camera,
int *  cameraBufferSize,
int *  width,
int *  height 
)

gives the buffer size, width and height of the given camera

Remarks
The dimensions are expressed in pixels.
int Sim::HALInterface::cameraBufferSize ( const CameraSensor camera)

returns the buffer size of the camera.

Remarks
The value returned here is equal to width * height * 3. The dimensions are expressed in pixels. 3 corresponds to the 3 colors (RGB)
Deprecated:
Since 1.18, use cameraBufferSize(camera, bufferSize, width, height) instead.
CameraColorSpace Sim::HALInterface::cameraColorSpace ( const BaseCamera camera) const

gives the current color space of the given CameraSensor

void Sim::HALInterface::cameraDepthBufferSize ( const CameraDepthSensor camera,
int *  cameraBufferSize,
int *  width,
int *  height 
)

gives the buffer size, width and height of the given depth camera.

Remarks
The dimensions are expressed in pixels.
CameraResolution Sim::HALInterface::cameraResolution ( const BaseCamera camera) const

gives the current resolution of the given CameraSensor

float Sim::HALInterface::fetchAngleActuatorStiffness ( const AngleActuator angleActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given angleActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchAngleActuatorValue ( const AngleActuator angleActuator)

returns the last command value (in radians) of the given angleActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchAngleSpeedActuatorStiffness ( const AngleSpeedActuator angleSpeedActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given angleSpeedActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchAngleSpeedActuatorValue ( const AngleSpeedActuator angleSpeedActuator)

returns the last command value (in radians per second) of the given angleSpeedActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchCoupledActuatorStiffness ( const CoupledActuator coupledActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given coupledActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchCoupledActuatorValue ( const CoupledActuator coupledActuator)

returns the last command value (between 0 and 1, no unit) of the given coupledActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchLEDActuatorValue ( const LEDActuator ledActuator)

returns the last command value (between 0 and 1) of the given ledActuator.

Remarks
As long as the hal executable has not been launch, this will return Nan.
float Sim::HALInterface::fetchTorqueActuatorStiffness ( const TorqueActuator torqueActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given torqueActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchTorqueActuatorValue ( const TorqueActuator torqueActuator)

returns the last command value (in Newton per meter) of the given torqueActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchWheelTorqueActuatorStiffness ( const WheelTorqueActuator wheelTorqueActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given wheelTorqueActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchWheelTorqueActuatorValue ( const WheelTorqueActuator wheelTorqueActuator)

returns the last command value (in Newton per meter) of the given wheelTorqueActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchWheelVelocityActuatorStiffness ( const WheelVelocityActuator wheelVelocityActuator)

returns the last stiffness value (between 0 and 1, no unit) of the given wheelVelocityActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
float Sim::HALInterface::fetchWheelVelocityActuatorValue ( const WheelVelocityActuator wheelVelocityActuator)

returns the last command value (in radians per second) of the given wheelVelocityActuator.

Remarks
As long as the hal executable has not been launch, this will return NaN. This allows you to know when the simulation has started and gives meaningful position at start-up.
bool Sim::HALInterface::sendAngleSensorValue ( const AngleSensor angleSensor,
float  value 
)

sends value (in radians) to the given angleSensor.

bool Sim::HALInterface::sendAngleSpeedSensorValue ( const AngleSpeedSensor angleSpeedSensor,
float  value 
)

sends value in radians per second to the given angleSpeedSensor.

bool Sim::HALInterface::sendArrayDepthSensorValues ( const ArrayDepthSensor arrayDepthSensor,
const std::vector< float > &  values 
)

sends values in meters to the given arrayDepthSensor

bool Sim::HALInterface::sendBumperSensorValue ( const BumperSensor bumperSensor,
float  value 
)

sends value (between 0 and 1, no unit) to the given bumperSensor.

bool Sim::HALInterface::sendCameraDepthSensorValue ( const CameraDepthSensor cameraDepthSensor,
const float *  buffer 
)

sends the content of the buffer depth to the given cameraDepthSensor.

Remarks
The depth map contained in buffer has a size given by cameraDepthSensorBufferSize. Each value defines in float the depth of pixel in meters.
Deprecated:
since 1.18, use sendDepthCameraSensorValue with CameraResolution and CameraColorSpace instead.
bool Sim::HALInterface::sendCameraDepthSensorValue ( const CameraDepthSensor cameraDepthSensor,
const float *  buffer,
CameraResolution  camResolution,
CameraColorSpace  camColorSpace 
)

sends the content of the buffer depth to the given cameraDepthSensor.

  • camResolution is the resolution of the buffer sent
  • camColorSpace is the color space of the buffer sent
bool Sim::HALInterface::sendCameraSensorValue ( const CameraSensor cameraSensor,
const unsigned char *  img 
)

sends the content of the buffer img to the given cameraSensor

Remarks
The image contained in img can be of different sizes: 160 * 120, 320 * 240 or 640 * 480 and is defined in RGB.
Deprecated:
since 1.18, use sendCameraSensorValue with CameraResolution and CameraColorSpace instead.
bool Sim::HALInterface::sendCameraSensorValue ( const CameraSensor cameraSensor,
const unsigned char *  img,
CameraResolution  camResolution,
CameraColorSpace  camColorSpace 
)

sends the content of the buffer img to the given cameraSensor

  • camResolution is the resolution of the buffer sent
  • camColorSpace is the color space of the buffer sent
bool Sim::HALInterface::sendCoupledSensorValue ( const CoupledSensor coupledSensor,
float  value 
)

sends value (between 0 and 1, no unit) to the given coupledSensor.

bool Sim::HALInterface::sendDepthInfraredSensorValue ( const DepthInfraredSensor depthInfraredSensor,
float  value 
)

sends value (in meters) to the given DepthInfraredSensor.

Deprecated:
use sendSingleDepthSensor instead.
bool Sim::HALInterface::sendFSRSensorValue ( const FSRSensor fsrSensor,
float  value 
)

sends value (in kilograms) to the given fsrSensor.

bool Sim::HALInterface::sendInertialSensorValues ( const InertialSensor inertialSensor,
const std::vector< float > &  values 
)

sends values (see remarks) to the given inertialSensor.

Remarks
The values that you have to provide to this method are in the following order: orientation around x-axis and y-axis (in radians), accelerations along x-axis x, y-axis and z-axis (in meter per second squared), and rotational speed around x-axis and y-axis (in radian per second). For more details about the position and orientation of the axis, see the sensors Section of the Hardware documentation.
bool Sim::HALInterface::sendSingleDepthSensorValue ( const SingleDepthSensor singleDepthSensor,
float  value 
)

sends value (in meters) to the given SingleDepthSensor.

bool Sim::HALInterface::sendSonarSensorValue ( const SonarSensor sonarSensor,
float  value 
)

sends value in meters to the given sonarSensor (see remarks).

Remarks
if you use this method on a SonarSensor value that has a buffer size of 1, the space left in the array will be filled with 0s.
bool Sim::HALInterface::sendSonarSensorValues ( const SonarSensor sonarSensor,
const std::vector< float > &  values 
)

sends values in meters to the given sonarSensor (see remarks).

Remarks
10 values can be associated to a SonarSensor if it has a buffer size of 10 floats. These are the echoes received by the sonar, from the pulse signal sent by the emitter, which consists in a cone of nearly 80°. Currently only the first echo is taken into account by NAOqi, so you can fill in only the first value. You should not use this method on a sonar that has a buffer size of 1 float, but if you do, only the first value will be taken into account. In 1.12, concerning NAO the emitting sonars (1 and 3) were detected as sensors in the model, this is not the case anymore, they are not taken into account.
bool Sim::HALInterface::sendTactileSensorValue ( const TactileSensor tactileSensor,
float  value 
)

sends value (between 0 and 1, no unit) to the given tactileSensor.

bool Sim::HALInterface::sendTorqueSensorValue ( const TorqueSensor torqueSensor,
float  value 
)

sends value in Newton per meter to the given torqueSensor.

bool Sim::HALInterface::sendWheelVelocitySensorValue ( const WheelVelocitySensor wheelVelocitySensor,
float  value 
)

sends value in radians per second to the given wheelVelocitySensor.

Member Data Documentation

class HALInterfaceImpl* Sim::HALInterface::a_impl

Private implementation.

Definition at line 290 of file alnaosim.h.


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