| ![]() |
2.10 Servoservo_set_position, servo_set_speed, servo_set_accelerationservo_run_animation, servo_get_animation_number, servo_get_animation_range servo_set_positionNAMEservo_set_position, servo_set_speed, servo_set_acceleration -- set servo parametersSYNOPSIS#include <device/servo.h>void servo_set_position (DeviceTag servo, gfloat position); void servo_set_speed (DeviceTag servo, gfloat speed); void servo_set_acceleration (DeviceTag servo, gfloat acc); DESCRIPTIONThe servo_set_position function gives a new target position the servo will try to reach. If the servo is a rotation servo, the unit of the position parameter is radian, otherwise, it is meter. The servo_set_speed function gives the maximum speed the servo can reach in order to achieve the given position. If the servo is a rotation servo, the unit of the speed parameter is radian per second, otherwise, it is meter per second. The servo_set_position function gives the acceleration the servo will use to reach the given position. If the servo is a rotation servo, the unit of the acc parameter is radian per second^2, otherwise, it is meter per second^2. servo_set_positionNAMEservo_run_animation, servo_get_animation_number, servo_get_animation_range -- servo animation functionsSYNOPSIS#include <device/servo.h>void servo_run_animation (DeviceTag servo, gint32 anim); gint32 servo_get_animation_number (DeviceTag servo); gfloat servo_get_animation_range (DeviceTag servo, gint32 anim); DESCRIPTIONThese functions are useful to perform non-robot-realistic animations. They do not refer to a real servo device, and permit to change dynamically the translation and rotation field of the Servo node. This results in more life-like animations, but should not be used in realistic simulations of real servo devices. The servo_run_animation function starts the animation specified by anim which corresponds to the index of the Animation node in the Servo animation field. 0 is the first Animation node of the MFNode list. The animation is also started recursively in all the children Servo of the Servo specified by the servo parameter. Passing -1 as anim will stop the animation in the specified servo and recursively in its subsequent Servo children. The servo_get_animation_number function returns the number of Animation nodes present in the animation field of the specified servo. The servo_get_animation_range function returns the range of the animation, that is the last value of the key field of the Animation node. The Animation node is specified by its anim index like with the servo_run_animation. The range value corresponds to the length of the animation cycle expressed in seconds. ![]() ![]() ![]() ^ page top ^ |
E-mail to webmaster | Last updated: | Copyright © 2002 Cyberbotics Ltd. |