simulator-sdk  2.0.6.8
 All Classes Namespaces Functions Variables Enumerations
Public Member Functions | Public Attributes
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>

List of all members.

Public Member Functions

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

Public Attributes

class HALInterfaceImpl * a_impl
 Private implementation.

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.


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.

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.
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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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::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::sendDepthInfraredSensorValue ( const DepthInfraredSensor depthInfraredSensor,
float  value 
)

sends value (in meters) to the given DepthInfraredSensor.

Deprecated:
use sendSingleDepthSensor instead.
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::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.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations