Webots Reference Manual

previous page go up next page

Thanks

1. Introduction

2. Node Chart

3. Nodes and API Functions

4. Prototypes

5. Physics Plugin

6. Fast2D Plugin

7. MTN Functions

8. Webots World Files

     

7.1 MTN

NAME

   mtn_new, mtn_get_error, mtn_fprint, mtn_delete - handle an MTN motion file

C/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);

DESCRIPTION

The 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 ALSO

mtn_play

NAME

   mtn_play, mtn_is_over, mtn_get_length, mtn_get_time - control the execution of an MTN motion file

C/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);

DESCRIPTION

The 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

mtn_new

previous page go up next page
^ page top ^

  E-mail to webmaster Last updated: Copyright © 2008 Cyberbotics Ltd.