Webots Reference Manual

previous page go up next page

Thanks

1.Introduction

2.Controller API

3.Webots File Format

     

2.9 Receiver

receiver_enable, receiver_disable
receiver_get_buffer, receiver_get_buffer_size

receiver_enable

NAME

   receiver_enable, receiver_disable -- enable and disable the receiver measurements

SYNOPSIS

  #include <device/receiver.h>

   void receiver_enable (DeviceTag receiver, guint16 ms);
   void receiver_disable (DeviceTag receiver);

DESCRIPTION

receiver_enable allows the user to enable a receiver measurement each ms milliseconds.

receiver_disable turns the receiver off, saving computation time.

receiver_get_buffer

NAME

   receiver_get_buffer, receiver_get_buffer_size -- get information on the receiver buffer

SYNOPSIS

  #include <device/receiver.h>

   gpointer receiver_get_buffer (DeviceTag receiver);
   gint32 receiver_get_buffer_size (DeviceTag receiver);

DESCRIPTION

The receiver_get_buffer function returns a pointer to the buffer used by the receiver to store received data. This function needs to be called each time new data arrives in the receiver because the address of the buffer changes when new data arrives. The returned memory chunk doesn't need to be released. Memory management is done by the receiver. Moreover calling receiver_get_buffer will cause the data to be flushed out of the receiver, hence calling receiver_get_buffer_size immediatly after will return 0;

The receiver_get_buffer_size function returns the size of this buffer, expressed in bytes, that is the number of bytes received and stored in the buffer. It must be called before receiver_get_buffer, otherwise, it returns always 0.

previous page go up next page
^ page top ^

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