|
7.1 MTNNAMEmtn_new, mtn_get_error, mtn_fprint, mtn_delete - handle an MTN motion fileC/C++ SYNOPSIS#include <device/mtn.h>#include <stdio.h> MTN *mtn_new (const char *filename); const char *mtn_get_error (); void mtn_fprint (FILE *fd, MTN *mtn); void mtn_delete (MTN *mtn); DESCRIPTIONThe MTN functions provide a facility for reading and playing back motions occurring simultaneously on several servo devices. The file format used for these motions is compatible with the Sony MTN file format used with the Sony Aibo robots. A motion file may contain all the information necessary for a walking gait. The mtn_new() function allows the user to open an MTN motion file specified by the filename parameter. If an error occurs, the mtn_get_error() function will return a text description of the last error, otherwise it returns null. The mtn_fprint() function writes the structure passed as the mtn argument into the file descriptor specified by fd. The fd parameter may be a file opened with fopen() (with write access), or a standard C output, like stdout. The mtn_delete() function deletes the mtn structure passed as an argument. This mtn parameter should not be used after calling mtn_delete(). SEE ALSONAMEmtn_play, mtn_is_over, mtn_get_length, mtn_get_time - control the execution of an MTN motion fileC/C++ SYNOPSIS#include <device/mtn.h>void mtn_play (MTN *mtn); int mtn_get_length (MTN *mtn); int mtn_get_time (MTN *mtn); int mtn_is_over (MTN *mtn); DESCRIPTIONThe mtn_play() starts the execution of an mtn motion, controlling several servos simultaneously. The control will start at the next iteration step (each time the run function returns) by automatically issuing a number of servo_set_position() function calls corresponding to the execution of the specified motion. The mtn_get_length() function returns the length in milliseconds of the specified mtn motion. The mtn_get_time() function returns the current time of execution of the specified mtn motion. This time value is expressed in millisecond. The minimum value is 0 (beginning of the motion), and the maximum value is the value returned by the mtn_get_length() function (end of the motion). The mtn_is_over() function returns 1 if the specified mtn motion has completed and 0 otherwise. It is useful to test when a motion is finished. SEE ALSO ![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2008 Cyberbotics Ltd. |