|
3.1 AccelerometerDerived from Solid.
3.1.1 DescriptionThe Accelerometer node is used to model a 3D accelerometer device such as those commonly found in mobile electronic devices. This component can measure the instantaneous acceleration in three dimensions over the X, Y and Z axes. 3.1.2 Field Summary
3.1.3 Accelerometer FunctionsNAMEaccelerometer_enable, accelerometer_disable - enable and disable the accelerometer measurementsC/C++ SYNOPSIS#include <device/accelerometer.h>void accelerometer_enable (DeviceTag sensor, unsigned short ms); void accelerometer_disable (DeviceTag sensor); JAVA SYNOPSISimport com.cyberbotics.webots.Controller;void accelerometer_enable (int sensor, int ms); void accelerometer_disable (int sensor); DESCRIPTIONThe accelerometer_enable() function allows the user to enable an acceleration measurement each ms milliseconds. The accelerometer_disable() function turns the accelerometer off, saving computation time. NAMEaccelerometer_get_values, accelerometer_value_x, accelerometer_value_y, accelerometer_value_z - get the accelerometer measurement as an array of 3 floating point values (X, Y and Z accelerations)C/C++ SYNOPSIS#include <device/accelerometer.h>const float *accelerometer_get_values (DeviceTag sensor); float accelerometer_value_x (const float values[3]); float accelerometer_value_y (const float values[3]); float accelerometer_value_z (const float values[3]); JAVA SYNOPSISimport com.cyberbotics.webots.Controller;float[] accelerometer_get_values (int sensor); float accelerometer_value_x (float[] values); float accelerometer_value_y (float[] values); float accelerometer_value_z (float[] values); DESCRIPTIONThe accelerometer_get_values() function returns the last values measured by the specified accelerometer sensor. The value returned is an array of 3 floating point numbers representing the 3D acceleration vector of the Accelerometer node, expressed in meters per second squared (m/s2). The accelerometer_value_x(), accelerometer_value_y() and accelerometer_value_z() functions are helper macros used to retrieve the x, y and z acceleration components measured by the accelerometer sensor from the floating point array data. They are defined as follows:
![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2008 Cyberbotics Ltd. |