| ![]() |
2.1 Robotrobot_dierobot_get_device robot_live robot_step robot_dieNAMErobot_die -- declare an exit functionSYNOPSIS#include <device/robot.h>void robot_die(void (*exit_function)(void)); DESCRIPTIONThis function declares an exit function to be used whenever a controller quits. A controller can quit for the following reasons: the simulator quits, or the robot quits the simulator by entering an HyperGate to be transfered to another simulation server. In the latter case, it might be useful for the robot to save important data (like an acquired behaviour) before it quits, so that this data can be transfered to the target simulator corresponding to the HyperGate. Hence, when the robot restarts on the other side of the HyperGate, it can retrieve its data in its reset function before it starts running again. SEE ALSOrobot_get_deviceNAMErobot_get_device -- get a pointer to a deviceSYNOPSIS#include <device/robot.h>DeviceTag robot_get_device(const gchar *name); DESCRIPTIONThis function returns a pointer to a device corresponding to a specified DEF name. For example, if the robot contains a DistanceSensor node which DEF name is "ds1", the function will return a pointer to that device. This DeviceTag pointer will be used subsequently for enabling, sending command to, or reading data from this device. SEE ALSOrobot_liveNAMErobot_live -- initialize a robot controllerSYNOPSIS#include <device/robot.h>void robot_live(void (*reset_function)(void)); DESCRIPTIONThis function must be called before any other controller API function. It is necessary to initialize the robot controller and optionally to provide a reset function to the controller. This reset function is useful to perform some initializations, so that the controller knows which sensors and actuators are available. The reset function should be a void function without any argument. It is called once at the beginning of the simualtion and may be called again if the simulator needs to reset the robot. However, this rarely happens in practise. EXAMPLE
SEE ALSOrobot_stepNAMErobot_step -- execute a simulation stepSYNOPSIS#include <device/robot.h>guint32 robot_step(guint32 ms); DESCRIPTIONThis function requests the simulator to perform a simulation step of ms milliseconds, that is to advance in the simulated time of this amount of time. In synchronous simulation mode, the request is always fulfilled and the function always return 0. In asynchronous mode, the request may not be fulfilled. In this case, the return value dt, representing the delay, may not be 0. Let controller_date be the current time of the controller, the return value be interpreted as follow:
SEE ALSO![]() ![]() ![]() ^ page top ^ |
E-mail to webmaster | Last updated: | Copyright © 2002 Cyberbotics Ltd. |