simulator-sdk  1.14
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
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 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 sendInertialSensorValues (const InertialSensor *inertialSensor, std::vector< const float * > values)
bool sendSonarSensorValues (const SonarSensor *sonarSensor, std::vector< const float * > values)
bool sendInertialSensorValues (const InertialSensor *inertialSensor, std::vector< float > values)
 sends values (see remarks) to the given inertialSensor.
bool sendSonarSensorValues (const SonarSensor *sonarSensor, 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).
std::string activeCamera ()
 returns the name of the CameraSensor that is currently active.
int cameraBufferSize ()
 returns the buffer size of the current camera.
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.

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 54 of file alnaosim.h.


Member Function Documentation

std::string Sim::HALInterface::activeCamera ( )

returns the name of the CameraSensor that is currently active.

Deprecated:
int Sim::HALInterface::cameraBufferSize ( )

returns the buffer size of the current camera.

Deprecated:
Remarks:
The value returned here is equal to width * height * 3. The dimensions are expressed in pixels. 3 corresponds to the 3 colors (RGB)
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. 3 corresponds to the 3 colors (RGB)
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)
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::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.
bool Sim::HALInterface::sendInertialSensorValues ( const InertialSensor inertialSensor,
std::vector< const float * >  values 
)
Deprecated:
See sendInertialSensorValues(const SonarSensor*, std::vector<float>)
bool Sim::HALInterface::sendInertialSensorValues ( const InertialSensor inertialSensor,
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,
std::vector< const float * >  values 
)
bool Sim::HALInterface::sendSonarSensorValues ( const SonarSensor sonarSensor,
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: