playerc.h
00001 /*
00002  *  libplayerc : a Player client library
00003  *  Copyright (C) Andrew Howard and contributors 2002-2007
00004  *
00005  *  This program is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU General Public License
00007  *  as published by the Free Software Foundation; either version 2
00008  *  of the License, or (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  */
00020 
00021 /***************************************************************************
00022  * Desc: Player client
00023  * Author: Andrew Howard
00024  * Date: 24 Aug 2001
00025  # CVS: $Id: playerc.h 8173 2009-08-04 07:25:00Z gbiggs $
00026  **************************************************************************/
00027 
00028 
00051 #ifndef PLAYERC_H
00052 #define PLAYERC_H
00053 
00054 #if !defined (WIN32)
00055   #include <netinet/in.h> /* need this for struct sockaddr_in */
00056 #endif
00057 #include <stddef.h> /* size_t */
00058 #include <stdio.h>
00059 
00060 #include <playerconfig.h>
00061 
00062 /* Get the message structures from Player*/
00063 #include <libplayercommon/playercommon.h>
00064 #include <libplayerinterface/player.h>
00065 #include <libplayercommon/playercommon.h>
00066 #include <libplayerinterface/interface_util.h>
00067 #include <libplayerinterface/playerxdr.h>
00068 #include <libplayerinterface/functiontable.h>
00069 #include <libplayerwkb/playerwkb.h>
00070 #if defined (WIN32)
00071   #include <winsock2.h>
00072 #endif
00073 
00074 #ifndef MIN
00075   #define MIN(a,b) ((a < b) ? a : b)
00076 #endif
00077 #ifndef MAX
00078   #define MAX(a,b) ((a > b) ? a : b)
00079 #endif
00080 
00081 #if defined (WIN32)
00082   #if defined (PLAYER_STATIC)
00083     #define PLAYERC_EXPORT
00084   #elif defined (playerc_EXPORTS)
00085     #define PLAYERC_EXPORT    __declspec (dllexport)
00086   #else
00087     #define PLAYERC_EXPORT    __declspec (dllimport)
00088   #endif
00089 #else
00090   #define PLAYERC_EXPORT
00091 #endif
00092 
00093 
00094 #ifdef __cplusplus
00095 extern "C" {
00096 #endif
00097 
00098 
00099 /***************************************************************************
00100  * Useful constants (re-defined here so SWIG can pick them up easily)
00101  **************************************************************************/
00102 
00104 #define PLAYERC_OPEN_MODE     PLAYER_OPEN_MODE
00105 #define PLAYERC_CLOSE_MODE    PLAYER_CLOSE_MODE
00106 #define PLAYERC_ERROR_MODE    PLAYER_ERROR_MODE
00107 
00108 
00110 #define PLAYERC_DATAMODE_PUSH PLAYER_DATAMODE_PUSH
00111 #define PLAYERC_DATAMODE_PULL PLAYER_DATAMODE_PULL
00112 
00114 #define PLAYERC_TRANSPORT_TCP 1
00115 #define PLAYERC_TRANSPORT_UDP 2
00116 
00117 #define PLAYERC_QUEUE_RING_SIZE 512
00118 
00334 /***************************************************************************/
00340 /***************************************************************************/
00341 
00346 PLAYERC_EXPORT const char *playerc_error_str(void);
00347 
00349 /*const char *playerc_lookup_name(int code);*/
00350 
00352 /*int playerc_lookup_code(const char *name);*/
00353 
00355 PLAYERC_EXPORT int playerc_add_xdr_ftable(playerxdr_function_t *flist, int replace);
00356 
00358 /***************************************************************************/
00359 
00360 
00361 /* Forward declare types*/
00362 struct _playerc_client_t;
00363 struct _playerc_device_t;
00364 
00365 
00366 /* forward declaration to avoid including <sys/poll.h>, which may not be
00367    available when people are building clients against this lib*/
00368 struct pollfd;
00369 
00370 
00371 /***************************************************************************/
00382 /* Items in incoming data queue.*/
00383 typedef struct
00384 {
00385   player_msghdr_t header;
00386   void *data;
00387 } playerc_client_item_t;
00388 
00389 
00390 /* Multi-client data*/
00391 typedef struct
00392 {
00393   /* List of clients being managed*/
00394   int client_count;
00395   struct _playerc_client_t *client[128];
00396 
00397   /* Poll info*/
00398   struct pollfd* pollfd;
00399 
00400   /* Latest time received from any server*/
00401   double time;
00402 
00403 } playerc_mclient_t;
00404 
00405 /* Create a multi-client object*/
00406 PLAYERC_EXPORT playerc_mclient_t *playerc_mclient_create(void);
00407 
00408 /* Destroy a multi-client object*/
00409 PLAYERC_EXPORT void playerc_mclient_destroy(playerc_mclient_t *mclient);
00410 
00411 /* Add a client to the multi-client (private).*/
00412 PLAYERC_EXPORT int playerc_mclient_addclient(playerc_mclient_t *mclient, struct _playerc_client_t *client);
00413 
00414 /* Test to see if there is pending data.
00415    Returns -1 on error, 0 or 1 otherwise.*/
00416 PLAYERC_EXPORT int playerc_mclient_peek(playerc_mclient_t *mclient, int timeout);
00417 
00418 /* Read incoming data.  The timeout is in ms.  Set timeout to a
00419    negative value to wait indefinitely.*/
00420 PLAYERC_EXPORT int playerc_mclient_read(playerc_mclient_t *mclient, int timeout);
00421 
00423 /***************************************************************************/
00424 
00425 
00426 /***************************************************************************/
00439 PLAYERC_EXPORT typedef void (*playerc_putmsg_fn_t) (void *device, char *header, char *data);
00440 
00442 PLAYERC_EXPORT typedef void (*playerc_callback_fn_t) (void *data);
00443 
00444 
00448 typedef struct
00449 {
00451   player_devaddr_t addr;
00452 
00454   char drivername[PLAYER_MAX_DRIVER_STRING_LEN];
00455 
00456 } playerc_device_info_t;
00457 
00458 
00460 typedef struct _playerc_client_t
00461 {
00464   void *id;
00465 
00467   char *host;
00468   int port;
00469   int transport;
00470   struct sockaddr_in server;
00471 
00474   int connected;
00475 
00479   int retry_limit;
00480 
00483   double retry_time;
00484 
00486   uint32_t overflow_count;
00487 
00488 
00490   int sock;
00491 
00493   uint8_t mode;
00494 
00497   int data_requested;
00498 
00501   int data_received;
00502 
00503 
00506   playerc_device_info_t devinfos[PLAYER_MAX_DEVICES];
00507   int devinfo_count;
00508 
00510   struct _playerc_device_t *device[PLAYER_MAX_DEVICES];
00511   int device_count;
00512 
00514   playerc_client_item_t qitems[PLAYERC_QUEUE_RING_SIZE];
00515   int qfirst, qlen, qsize;
00516 
00518   char *data;
00519   char *write_xdrdata;
00520   char *read_xdrdata;
00521   size_t read_xdrdata_len;
00522 
00523 
00525   double datatime;
00527   double lasttime;
00528 
00529   double request_timeout;
00530 
00531 } playerc_client_t;
00532 
00533 
00549 PLAYERC_EXPORT playerc_client_t *playerc_client_create(playerc_mclient_t *mclient,
00550                                         const char *host, int port);
00551 
00557 PLAYERC_EXPORT void playerc_client_destroy(playerc_client_t *client);
00558 
00563 PLAYERC_EXPORT void playerc_client_set_transport(playerc_client_t* client,
00564                                   unsigned int transport);
00565 
00574 PLAYERC_EXPORT int playerc_client_connect(playerc_client_t *client);
00575 
00584 PLAYERC_EXPORT int playerc_client_disconnect(playerc_client_t *client);
00585 
00592 PLAYERC_EXPORT int playerc_client_disconnect_retry(playerc_client_t *client);
00593 
00608 PLAYERC_EXPORT int playerc_client_datamode(playerc_client_t *client, uint8_t mode);
00609 
00621 PLAYERC_EXPORT int playerc_client_requestdata(playerc_client_t* client);
00622 
00645 PLAYERC_EXPORT int playerc_client_set_replace_rule(playerc_client_t *client, int interf, int index, int type, int subtype, int replace);
00646 
00647 
00650 PLAYERC_EXPORT int playerc_client_adddevice(playerc_client_t *client, struct _playerc_device_t *device);
00651 
00652 
00655 PLAYERC_EXPORT int playerc_client_deldevice(playerc_client_t *client, struct _playerc_device_t *device);
00656 
00659 PLAYERC_EXPORT int  playerc_client_addcallback(playerc_client_t *client, struct _playerc_device_t *device,
00660                                 playerc_callback_fn_t callback, void *data);
00661 
00664 PLAYERC_EXPORT int  playerc_client_delcallback(playerc_client_t *client, struct _playerc_device_t *device,
00665                                 playerc_callback_fn_t callback, void *data);
00666 
00678 PLAYERC_EXPORT int playerc_client_get_devlist(playerc_client_t *client);
00679 
00682 PLAYERC_EXPORT int playerc_client_subscribe(playerc_client_t *client, int code, int index,
00683                              int access, char *drivername, size_t len);
00684 
00687 PLAYERC_EXPORT int playerc_client_unsubscribe(playerc_client_t *client, int code, int index);
00688 
00699 PLAYERC_EXPORT int playerc_client_request(playerc_client_t *client,
00700                            struct _playerc_device_t *device, uint8_t reqtype,
00701                            const void *req_data, void **rep_data);
00702 
00713 /*int playerc_client_getresponse(playerc_client_t *client, uint16_t device,
00714     uint16_t index, uint16_t sequence, uint8_t * resptype, uint8_t * resp_data, int resp_len);
00715 */
00727 PLAYERC_EXPORT int playerc_client_peek(playerc_client_t *client, int timeout);
00728 
00741 PLAYERC_EXPORT int playerc_client_internal_peek(playerc_client_t *client, int timeout);
00742 
00757 PLAYERC_EXPORT void *playerc_client_read(playerc_client_t *client);
00758 
00761 PLAYERC_EXPORT int playerc_client_read_nonblock(playerc_client_t *client);
00764 PLAYERC_EXPORT int playerc_client_read_nonblock_withproxy(playerc_client_t *client, void ** proxy);
00765 
00772 PLAYERC_EXPORT void playerc_client_set_request_timeout(playerc_client_t* client, uint32_t seconds);
00773 
00780 PLAYERC_EXPORT void playerc_client_set_retry_limit(playerc_client_t* client, int limit);
00781 
00787 PLAYERC_EXPORT void playerc_client_set_retry_time(playerc_client_t* client, double time);
00788 
00791 PLAYERC_EXPORT int playerc_client_write(playerc_client_t *client,
00792                          struct _playerc_device_t *device,
00793                          uint8_t subtype,
00794                          void *cmd, double* timestamp);
00795 
00796 
00798 /**************************************************************************/
00799 
00800 
00801 /***************************************************************************/
00814 typedef struct _playerc_device_t
00815 {
00819   void *id;
00820 
00822   playerc_client_t *client;
00823 
00825   player_devaddr_t addr;
00826 
00828   char drivername[PLAYER_MAX_DRIVER_STRING_LEN];
00829 
00832   int subscribed;
00833 
00835   double datatime;
00836 
00838   double lasttime;
00839 
00843   int fresh;
00847   int freshgeom;
00851   int freshconfig;
00852 
00854   playerc_putmsg_fn_t putmsg;
00855 
00857   void *user_data;
00858 
00860   int callback_count;
00861   playerc_callback_fn_t callback[4];
00862   void *callback_data[4];
00863 
00864 } playerc_device_t;
00865 
00866 
00868 PLAYERC_EXPORT void playerc_device_init(playerc_device_t *device, playerc_client_t *client,
00869                          int code, int index, playerc_putmsg_fn_t putmsg);
00870 
00872 PLAYERC_EXPORT void playerc_device_term(playerc_device_t *device);
00873 
00875 PLAYERC_EXPORT int playerc_device_subscribe(playerc_device_t *device, int access);
00876 
00878 PLAYERC_EXPORT int playerc_device_unsubscribe(playerc_device_t *device);
00879 
00881 PLAYERC_EXPORT int playerc_device_hascapability(playerc_device_t *device, uint32_t type, uint32_t subtype);
00882 
00884 PLAYERC_EXPORT int playerc_device_get_boolprop(playerc_device_t *device, char *property, BOOL *value);
00885 
00887 PLAYERC_EXPORT int playerc_device_set_boolprop(playerc_device_t *device, char *property, BOOL value);
00888 
00890 PLAYERC_EXPORT int playerc_device_get_intprop(playerc_device_t *device, char *property, int32_t *value);
00891 
00893 PLAYERC_EXPORT int playerc_device_set_intprop(playerc_device_t *device, char *property, int32_t value);
00894 
00896 PLAYERC_EXPORT int playerc_device_get_dblprop(playerc_device_t *device, char *property, double *value);
00897 
00899 PLAYERC_EXPORT int playerc_device_set_dblprop(playerc_device_t *device, char *property, double value);
00900 
00902 PLAYERC_EXPORT int playerc_device_get_strprop(playerc_device_t *device, char *property, char **value);
00903 
00905 PLAYERC_EXPORT int playerc_device_set_strprop(playerc_device_t *device, char *property, char *value);
00906 
00907 
00909 /**************************************************************************/
00910 
00911 
00912 /***************************************************************************/
00917 /***************************************************************************/
00918 
00919 /**************************************************************************/
00929 typedef struct
00930 {
00932   playerc_device_t info;
00933 
00934   /* The number of valid analog inputs.*/
00935   uint8_t voltages_count;
00936 
00937   /* A bitfield of the current digital inputs.*/
00938   float *voltages;
00939 
00940 } playerc_aio_t;
00941 
00942 
00944 PLAYERC_EXPORT playerc_aio_t *playerc_aio_create(playerc_client_t *client, int index);
00945 
00947 PLAYERC_EXPORT void playerc_aio_destroy(playerc_aio_t *device);
00948 
00950 PLAYERC_EXPORT int playerc_aio_subscribe(playerc_aio_t *device, int access);
00951 
00953 PLAYERC_EXPORT int playerc_aio_unsubscribe(playerc_aio_t *device);
00954 
00956 PLAYERC_EXPORT int playerc_aio_set_output(playerc_aio_t *device, uint8_t id, float volt);
00957 
00959 PLAYERC_EXPORT float playerc_aio_get_data(playerc_aio_t *device, uint32_t index);
00960 
00962 /***************************************************************************/
00963 
00964 
00965 /***************************************************************************/
00976 #define PLAYERC_ACTARRAY_NUM_ACTUATORS PLAYER_ACTARRAY_NUM_ACTUATORS
00977 #define PLAYERC_ACTARRAY_ACTSTATE_IDLE PLAYER_ACTARRAY_ACTSTATE_IDLE
00978 #define PLAYERC_ACTARRAY_ACTSTATE_MOVING PLAYER_ACTARRAY_ACTSTATE_MOVING
00979 #define PLAYERC_ACTARRAY_ACTSTATE_BRAKED PLAYER_ACTARRAY_ACTSTATE_BRAKED
00980 #define PLAYERC_ACTARRAY_ACTSTATE_STALLED PLAYER_ACTARRAY_ACTSTATE_STALLED
00981 #define PLAYERC_ACTARRAY_TYPE_LINEAR PLAYER_ACTARRAY_TYPE_LINEAR
00982 #define PLAYERC_ACTARRAY_TYPE_ROTARY PLAYER_ACTARRAY_TYPE_ROTARY
00983 
00984 
00986 typedef struct
00987 {
00989   playerc_device_t info;
00990 
00992   uint32_t actuators_count;
00994   player_actarray_actuator_t *actuators_data;
00996   uint32_t actuators_geom_count;
00997   player_actarray_actuatorgeom_t *actuators_geom;
00999   uint8_t motor_state;
01001   player_point_3d_t base_pos;
01003   player_orientation_3d_t base_orientation;
01004 } playerc_actarray_t;
01005 
01007 PLAYERC_EXPORT playerc_actarray_t *playerc_actarray_create(playerc_client_t *client, int index);
01008 
01010 PLAYERC_EXPORT void playerc_actarray_destroy(playerc_actarray_t *device);
01011 
01013 PLAYERC_EXPORT int playerc_actarray_subscribe(playerc_actarray_t *device, int access);
01014 
01016 PLAYERC_EXPORT int playerc_actarray_unsubscribe(playerc_actarray_t *device);
01017 
01019 PLAYERC_EXPORT player_actarray_actuator_t playerc_actarray_get_actuator_data(playerc_actarray_t *device, uint32_t index);
01020 
01022 PLAYERC_EXPORT player_actarray_actuatorgeom_t playerc_actarray_get_actuator_geom(playerc_actarray_t *device, uint32_t index);
01023 
01026 PLAYERC_EXPORT int playerc_actarray_get_geom(playerc_actarray_t *device);
01027 
01029 PLAYERC_EXPORT int playerc_actarray_position_cmd(playerc_actarray_t *device, int joint, float position);
01030 
01032 PLAYERC_EXPORT int playerc_actarray_multi_position_cmd(playerc_actarray_t *device, float *positions, int positions_count);
01033 
01035 PLAYERC_EXPORT int playerc_actarray_speed_cmd(playerc_actarray_t *device, int joint, float speed);
01036 
01038 PLAYERC_EXPORT int playerc_actarray_multi_speed_cmd(playerc_actarray_t *device, float *speeds, int speeds_count);
01039 
01041 PLAYERC_EXPORT int playerc_actarray_home_cmd(playerc_actarray_t *device, int joint);
01042 
01044 PLAYERC_EXPORT int playerc_actarray_current_cmd(playerc_actarray_t *device, int joint, float current);
01045 
01047 PLAYERC_EXPORT int playerc_actarray_multi_current_cmd(playerc_actarray_t *device, float *currents, int currents_count);
01048 
01049 
01053 PLAYERC_EXPORT int playerc_actarray_power(playerc_actarray_t *device, uint8_t enable);
01054 
01056 PLAYERC_EXPORT int playerc_actarray_brakes(playerc_actarray_t *device, uint8_t enable);
01057 
01059 PLAYERC_EXPORT int playerc_actarray_speed_config(playerc_actarray_t *device, int joint, float speed);
01060 
01061 /* Set the accelration of a joint (-1 for all joints) for all subsequent movement commands*/
01062 PLAYERC_EXPORT int playerc_actarray_accel_config(playerc_actarray_t *device, int joint, float accel);
01063 
01064 
01066 /**************************************************************************/
01067 
01068 /***************************************************************************/
01080 typedef struct
01081 {
01083   playerc_device_t info;
01084 
01086   player_audio_mixer_channel_list_detail_t channel_details_list;
01087 
01089   player_audio_wav_t wav_data;
01090 
01092   player_audio_seq_t seq_data;
01093 
01095   player_audio_mixer_channel_list_t mixer_data;
01096 
01098   uint32_t state;
01099 
01100   int last_index;
01101 
01102 } playerc_audio_t;
01103 
01105 PLAYERC_EXPORT playerc_audio_t *playerc_audio_create(playerc_client_t *client, int index);
01106 
01108 PLAYERC_EXPORT void playerc_audio_destroy(playerc_audio_t *device);
01109 
01111 PLAYERC_EXPORT int playerc_audio_subscribe(playerc_audio_t *device, int access);
01112 
01114 PLAYERC_EXPORT int playerc_audio_unsubscribe(playerc_audio_t *device);
01115 
01117 PLAYERC_EXPORT int playerc_audio_wav_play_cmd(playerc_audio_t *device, uint32_t data_count, uint8_t data[], uint32_t format);
01118 
01120 PLAYERC_EXPORT int playerc_audio_wav_stream_rec_cmd(playerc_audio_t *device, uint8_t state);
01121 
01123 PLAYERC_EXPORT int playerc_audio_sample_play_cmd(playerc_audio_t *device, int index);
01124 
01126 PLAYERC_EXPORT int playerc_audio_seq_play_cmd(playerc_audio_t *device, player_audio_seq_t * tones);
01127 
01129 PLAYERC_EXPORT int playerc_audio_mixer_multchannels_cmd(playerc_audio_t *device, player_audio_mixer_channel_list_t * levels);
01130 
01132 PLAYERC_EXPORT int playerc_audio_mixer_channel_cmd(playerc_audio_t *device, uint32_t index, float amplitude, uint8_t active);
01133 
01136 PLAYERC_EXPORT int playerc_audio_wav_rec(playerc_audio_t *device);
01137 
01139 PLAYERC_EXPORT int playerc_audio_sample_load(playerc_audio_t *device, int index, uint32_t data_count, uint8_t data[], uint32_t format);
01140 
01143 PLAYERC_EXPORT int playerc_audio_sample_retrieve(playerc_audio_t *device, int index);
01144 
01146 PLAYERC_EXPORT int playerc_audio_sample_rec(playerc_audio_t *device, int index, uint32_t length);
01147 
01150 PLAYERC_EXPORT int playerc_audio_get_mixer_levels(playerc_audio_t *device);
01151 
01154 PLAYERC_EXPORT int playerc_audio_get_mixer_details(playerc_audio_t *device);
01155 
01157 /**************************************************************************/
01158 
01168 #define PLAYERC_BLACKBOARD_DATA_TYPE_NONE       0
01169 #define PLAYERC_BLACKBOARD_DATA_TYPE_SIMPLE     1
01170 #define PLAYERC_BLACKBOARD_DATA_TYPE_COMPLEX    2
01171 
01172 #define PLAYERC_BLACKBOARD_DATA_SUBTYPE_NONE    0
01173 #define PLAYERC_BLACKBOARD_DATA_SUBTYPE_STRING  1
01174 #define PLAYERC_BLACKBOARD_DATA_SUBTYPE_INT     2
01175 #define PLAYERC_BLACKBOARD_DATA_SUBTYPE_DOUBLE  3
01176 
01178 typedef struct playerc_blackboard
01179 {
01181   playerc_device_t info;
01183   void (*on_blackboard_event)(struct playerc_blackboard*, player_blackboard_entry_t);
01185   void *py_private;
01186 } playerc_blackboard_t;
01187 
01189 PLAYERC_EXPORT playerc_blackboard_t *playerc_blackboard_create(playerc_client_t *client, int index);
01190 
01192 PLAYERC_EXPORT void playerc_blackboard_destroy(playerc_blackboard_t *device);
01193 
01195 PLAYERC_EXPORT int playerc_blackboard_subscribe(playerc_blackboard_t *device, int access);
01196 
01198 PLAYERC_EXPORT int playerc_blackboard_unsubscribe(playerc_blackboard_t *device);
01199 
01202 PLAYERC_EXPORT int playerc_blackboard_subscribe_to_key(playerc_blackboard_t *device, const char* key, const char* group, player_blackboard_entry_t** entry);
01203 
01206 PLAYERC_EXPORT int playerc_blackboard_get_entry(playerc_blackboard_t *device, const char* key, const char* group, player_blackboard_entry_t** entry);
01207 
01209 PLAYERC_EXPORT int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t *device, const char* key, const char* group);
01210 
01212 PLAYERC_EXPORT int playerc_blackboard_subscribe_to_group(playerc_blackboard_t *device, const char* group);
01213 
01215 PLAYERC_EXPORT int playerc_blackboard_unsubscribe_from_group(playerc_blackboard_t *device, const char* group);
01216 
01218 PLAYERC_EXPORT int playerc_blackboard_set_entry(playerc_blackboard_t *device, player_blackboard_entry_t* entry);
01219 
01220 PLAYERC_EXPORT int playerc_blackboard_set_string(playerc_blackboard_t *device, const char* key, const char* group, const char* value);
01221 
01222 PLAYERC_EXPORT int playerc_blackboard_set_int(playerc_blackboard_t *device, const char* key, const char* group, const int value);
01223 
01224 PLAYERC_EXPORT int playerc_blackboard_set_double(playerc_blackboard_t *device, const char* key, const char* group, const double value);
01225 
01228 /**************************************************************************/
01239 typedef struct
01240 {
01242   playerc_device_t info;
01243 
01244   uint32_t enabled;
01245   double duty_cycle;
01246   double period;
01247   uint8_t red, green, blue;
01248 } playerc_blinkenlight_t;
01249 
01250 
01252 PLAYERC_EXPORT playerc_blinkenlight_t *playerc_blinkenlight_create(playerc_client_t *client, int index);
01253 
01255 PLAYERC_EXPORT void playerc_blinkenlight_destroy(playerc_blinkenlight_t *device);
01256 
01258 PLAYERC_EXPORT int playerc_blinkenlight_subscribe(playerc_blinkenlight_t *device, int access);
01259 
01261 PLAYERC_EXPORT int playerc_blinkenlight_unsubscribe(playerc_blinkenlight_t *device);
01262 
01264 PLAYERC_EXPORT int playerc_blinkenlight_enable( playerc_blinkenlight_t *device,
01265                                  uint32_t enable );
01266 
01268 PLAYERC_EXPORT int playerc_blinkenlight_color( playerc_blinkenlight_t *device,
01269                                 uint32_t id,
01270                                 uint8_t red,
01271                                 uint8_t green,
01272                                 uint8_t blue );
01275 PLAYERC_EXPORT int playerc_blinkenlight_blink( playerc_blinkenlight_t *device,
01276                                 uint32_t id,
01277                                 float period,
01278                                 float duty_cycle );
01281 /***************************************************************************/
01292 typedef player_blobfinder_blob_t playerc_blobfinder_blob_t;
01293 
01295 typedef struct
01296 {
01298   playerc_device_t info;
01299 
01301   unsigned int width, height;
01302 
01304   unsigned int blobs_count;
01305   playerc_blobfinder_blob_t *blobs;
01306 
01307 } playerc_blobfinder_t;
01308 
01309 
01311 PLAYERC_EXPORT playerc_blobfinder_t *playerc_blobfinder_create(playerc_client_t *client, int index);
01312 
01314 PLAYERC_EXPORT void playerc_blobfinder_destroy(playerc_blobfinder_t *device);
01315 
01317 PLAYERC_EXPORT int playerc_blobfinder_subscribe(playerc_blobfinder_t *device, int access);
01318 
01320 PLAYERC_EXPORT int playerc_blobfinder_unsubscribe(playerc_blobfinder_t *device);
01321 
01322 
01324 /**************************************************************************/
01325 
01326 
01327 /**************************************************************************/
01338 typedef struct
01339 {
01341   playerc_device_t info;
01342 
01344   int pose_count;
01345 
01349   player_bumper_define_t *poses;
01350 
01352   int bumper_count;
01353 
01355   uint8_t *bumpers;
01356 
01357 } playerc_bumper_t;
01358 
01359 
01361 PLAYERC_EXPORT playerc_bumper_t *playerc_bumper_create(playerc_client_t *client, int index);
01362 
01364 PLAYERC_EXPORT void playerc_bumper_destroy(playerc_bumper_t *device);
01365 
01367 PLAYERC_EXPORT int playerc_bumper_subscribe(playerc_bumper_t *device, int access);
01368 
01370 PLAYERC_EXPORT int playerc_bumper_unsubscribe(playerc_bumper_t *device);
01371 
01378 PLAYERC_EXPORT int playerc_bumper_get_geom(playerc_bumper_t *device);
01379 
01380 
01382 /***************************************************************************/
01383 
01384 
01385 /***************************************************************************/
01395 typedef struct
01396 {
01398   playerc_device_t info;
01399 
01401   int width, height;
01402 
01404   int bpp;
01405 
01407   int format;
01408 
01412   int fdiv;
01413 
01415   int compression;
01416 
01418   int image_count;
01419 
01424   uint8_t *image;
01425 
01426 } playerc_camera_t;
01427 
01428 
01430 PLAYERC_EXPORT playerc_camera_t *playerc_camera_create(playerc_client_t *client, int index);
01431 
01433 PLAYERC_EXPORT void playerc_camera_destroy(playerc_camera_t *device);
01434 
01436 PLAYERC_EXPORT int playerc_camera_subscribe(playerc_camera_t *device, int access);
01437 
01439 PLAYERC_EXPORT int playerc_camera_unsubscribe(playerc_camera_t *device);
01440 
01442 PLAYERC_EXPORT void playerc_camera_decompress(playerc_camera_t *device);
01443 
01445 PLAYERC_EXPORT void playerc_camera_save(playerc_camera_t *device, const char *filename);
01446 
01448 /**************************************************************************/
01449 
01450 
01451 /**************************************************************************/
01461 typedef struct
01462 {
01464   playerc_device_t info;
01465 
01466     /*/ The number of valid digital inputs.*/
01467     uint8_t count;
01468 
01469     /*/ A bitfield of the current digital inputs.*/
01470     uint32_t digin;
01471 
01472 } playerc_dio_t;
01473 
01474 
01476 PLAYERC_EXPORT playerc_dio_t *playerc_dio_create(playerc_client_t *client, int index);
01477 
01479 PLAYERC_EXPORT void playerc_dio_destroy(playerc_dio_t *device);
01480 
01482 PLAYERC_EXPORT int playerc_dio_subscribe(playerc_dio_t *device, int access);
01483 
01485 PLAYERC_EXPORT int playerc_dio_unsubscribe(playerc_dio_t *device);
01486 
01488 PLAYERC_EXPORT int playerc_dio_set_output(playerc_dio_t *device, uint8_t output_count, uint32_t digout);
01489 
01490 
01492 /***************************************************************************/
01493 
01494 
01495 /***************************************************************************/
01510 typedef struct
01511 {
01513   playerc_device_t info;
01514 
01519   player_fiducial_geom_t fiducial_geom;
01520 
01522   int fiducials_count;
01523   player_fiducial_item_t *fiducials;
01524 
01525 } playerc_fiducial_t;
01526 
01527 
01529 PLAYERC_EXPORT playerc_fiducial_t *playerc_fiducial_create(playerc_client_t *client, int index);
01530 
01532 PLAYERC_EXPORT void playerc_fiducial_destroy(playerc_fiducial_t *device);
01533 
01535 PLAYERC_EXPORT int playerc_fiducial_subscribe(playerc_fiducial_t *device, int access);
01536 
01538 PLAYERC_EXPORT int playerc_fiducial_unsubscribe(playerc_fiducial_t *device);
01539 
01546 PLAYERC_EXPORT int playerc_fiducial_get_geom(playerc_fiducial_t *device);
01547 
01548 
01550 /**************************************************************************/
01551 
01552 /***************************************************************************/
01561 typedef struct
01562 {
01564   playerc_device_t info;
01565 
01567   double utc_time;
01568 
01572   double lat, lon;
01573 
01576   double alt;
01577 
01579   double utm_e, utm_n;
01580 
01582   double hdop;
01583 
01585   double vdop;
01586 
01588   double err_horz, err_vert;
01589 
01591   int quality;
01592 
01594   int sat_count;
01595 
01596 } playerc_gps_t;
01597 
01598 
01600 PLAYERC_EXPORT playerc_gps_t *playerc_gps_create(playerc_client_t *client, int index);
01601 
01603 PLAYERC_EXPORT void playerc_gps_destroy(playerc_gps_t *device);
01604 
01606 PLAYERC_EXPORT int playerc_gps_subscribe(playerc_gps_t *device, int access);
01607 
01609 PLAYERC_EXPORT int playerc_gps_unsubscribe(playerc_gps_t *device);
01610 
01611 
01613 /**************************************************************************/
01614 
01615 /***************************************************************************/
01625 typedef struct
01626 {
01628   playerc_device_t info;
01629 
01631   player_color_t color;
01632 
01633 } playerc_graphics2d_t;
01634 
01635 
01637 PLAYERC_EXPORT playerc_graphics2d_t *playerc_graphics2d_create(playerc_client_t *client, int index);
01638 
01640 PLAYERC_EXPORT void playerc_graphics2d_destroy(playerc_graphics2d_t *device);
01641 
01643 PLAYERC_EXPORT int playerc_graphics2d_subscribe(playerc_graphics2d_t *device, int access);
01644 
01646 PLAYERC_EXPORT int playerc_graphics2d_unsubscribe(playerc_graphics2d_t *device);
01647 
01649 PLAYERC_EXPORT int playerc_graphics2d_setcolor(playerc_graphics2d_t *device,
01650                                 player_color_t col );
01651 
01653 PLAYERC_EXPORT int playerc_graphics2d_draw_points(playerc_graphics2d_t *device,
01654            player_point_2d_t pts[],
01655            int count );
01656 
01658 PLAYERC_EXPORT int playerc_graphics2d_draw_polyline(playerc_graphics2d_t *device,
01659              player_point_2d_t pts[],
01660              int count );
01661 
01663 PLAYERC_EXPORT int playerc_graphics2d_draw_polygon(playerc_graphics2d_t *device,
01664             player_point_2d_t pts[],
01665             int count,
01666             int filled,
01667             player_color_t fill_color );
01668 
01670 PLAYERC_EXPORT int playerc_graphics2d_clear(playerc_graphics2d_t *device );
01671 
01672 
01675 /***************************************************************************/
01685 typedef struct
01686 {
01688   playerc_device_t info;
01689 
01691   player_color_t color;
01692 
01693 } playerc_graphics3d_t;
01694 
01695 
01697 PLAYERC_EXPORT playerc_graphics3d_t *playerc_graphics3d_create(playerc_client_t *client, int index);
01698 
01700 PLAYERC_EXPORT void playerc_graphics3d_destroy(playerc_graphics3d_t *device);
01701 
01703 PLAYERC_EXPORT int playerc_graphics3d_subscribe(playerc_graphics3d_t *device, int access);
01704 
01706 PLAYERC_EXPORT int playerc_graphics3d_unsubscribe(playerc_graphics3d_t *device);
01707 
01709 PLAYERC_EXPORT int playerc_graphics3d_setcolor(playerc_graphics3d_t *device,
01710                                 player_color_t col );
01711 
01713 PLAYERC_EXPORT int playerc_graphics3d_draw(playerc_graphics3d_t *device,
01714            player_graphics3d_draw_mode_t mode,
01715            player_point_3d_t pts[],
01716            int count );
01717 
01719 PLAYERC_EXPORT int playerc_graphics3d_clear(playerc_graphics3d_t *device );
01720 
01722 PLAYERC_EXPORT int playerc_graphics3d_translate(playerc_graphics3d_t *device,
01723                                  double x, double y, double z );
01724 
01725 
01727 PLAYERC_EXPORT int playerc_graphics3d_rotate( playerc_graphics3d_t *device,
01728                                double a, double x, double y, double z );
01731 /***************************************************************************/
01741 typedef struct
01742 {
01744   playerc_device_t info;
01745 
01752   player_pose3d_t pose;
01753   player_bbox3d_t outer_size;
01754   player_bbox3d_t inner_size;
01756   uint8_t num_beams;
01758   uint8_t capacity;
01759 
01763   uint8_t state;
01765   uint32_t beams;
01767   uint8_t stored;
01768 } playerc_gripper_t;
01769 
01771 PLAYERC_EXPORT playerc_gripper_t *playerc_gripper_create(playerc_client_t *client, int index);
01772 
01774 PLAYERC_EXPORT void playerc_gripper_destroy(playerc_gripper_t *device);
01775 
01777 PLAYERC_EXPORT int playerc_gripper_subscribe(playerc_gripper_t *device, int access);
01778 
01780 PLAYERC_EXPORT int playerc_gripper_unsubscribe(playerc_gripper_t *device);
01781 
01783 PLAYERC_EXPORT int playerc_gripper_open_cmd(playerc_gripper_t *device);
01784 
01786 PLAYERC_EXPORT int playerc_gripper_close_cmd(playerc_gripper_t *device);
01787 
01789 PLAYERC_EXPORT int playerc_gripper_stop_cmd(playerc_gripper_t *device);
01790 
01792 PLAYERC_EXPORT int playerc_gripper_store_cmd(playerc_gripper_t *device);
01793 
01795 PLAYERC_EXPORT int playerc_gripper_retrieve_cmd(playerc_gripper_t *device);
01796 
01799 PLAYERC_EXPORT void playerc_gripper_printout(playerc_gripper_t *device, const char* prefix);
01800 
01805 PLAYERC_EXPORT int playerc_gripper_get_geom(playerc_gripper_t *device);
01806 
01808 /**************************************************************************/
01809 
01810 /***************************************************************************/
01824 typedef struct
01825 {
01827     playerc_device_t info;
01829     player_health_cpu_t cpu_usage;
01831     player_health_memory_t mem;
01833     player_health_memory_t swap;
01834 } playerc_health_t;
01835 
01836 
01838 PLAYERC_EXPORT playerc_health_t *playerc_health_create(playerc_client_t *client, int index);
01839 
01841 PLAYERC_EXPORT void playerc_health_destroy(playerc_health_t *device);
01842 
01844 PLAYERC_EXPORT int playerc_health_subscribe(playerc_health_t *device, int access);
01845 
01847 PLAYERC_EXPORT int playerc_health_unsubscribe(playerc_health_t *device);
01848 
01849 
01851 /***************************************************************************/
01852 
01853 
01854 /***************************************************************************/
01865 typedef struct
01866 {
01868   playerc_device_t info;
01869 
01870   /* data*/
01871   player_ir_data_t data;
01872 
01873   /* config*/
01874   player_ir_pose_t poses;
01875 
01876 } playerc_ir_t;
01877 
01878 
01880 PLAYERC_EXPORT playerc_ir_t *playerc_ir_create(playerc_client_t *client, int index);
01881 
01883 PLAYERC_EXPORT void playerc_ir_destroy(playerc_ir_t *device);
01884 
01886 PLAYERC_EXPORT int playerc_ir_subscribe(playerc_ir_t *device, int access);
01887 
01889 PLAYERC_EXPORT int playerc_ir_unsubscribe(playerc_ir_t *device);
01890 
01897 PLAYERC_EXPORT int playerc_ir_get_geom(playerc_ir_t *device);
01898 
01899 
01901 /***************************************************************************/
01902 
01903 
01904 /***************************************************************************/
01914 typedef struct
01915 {
01917   playerc_device_t info;
01918   int32_t axes_count;
01919   int32_t pos[8];
01920   uint32_t buttons;
01921   int * axes_max;
01922   int * axes_min;
01923   double * scale_pos;
01924 
01925 
01926 } playerc_joystick_t;
01927 
01928 
01930 PLAYERC_EXPORT playerc_joystick_t *playerc_joystick_create(playerc_client_t *client, int index);
01931 
01933 PLAYERC_EXPORT void playerc_joystick_destroy(playerc_joystick_t *device);
01934 
01936 PLAYERC_EXPORT int playerc_joystick_subscribe(playerc_joystick_t *device, int access);
01937 
01939 PLAYERC_EXPORT int playerc_joystick_unsubscribe(playerc_joystick_t *device);
01940 
01942 /**************************************************************************/
01943 
01944 
01945 /***************************************************************************/
01959 typedef struct
01960 {
01962   playerc_device_t info;
01963 
01967   double pose[3];
01968   double size[2];
01969 
01971   double robot_pose[3];
01972 
01974   int intensity_on;
01975 
01977   int scan_count;
01978 
01980   double scan_start;
01981 
01983   double scan_res;
01984 
01986   double range_res;
01987 
01989   double max_range;
01990 
01992   double scanning_frequency;
01993 
01995   double *ranges;
01996 
01998   double (*scan)[2];
01999 
02001   player_point_2d_t *point;
02002 
02006   int *intensity;
02007 
02009   int scan_id;
02010 
02012   int laser_id;
02013 
02017   double min_right;
02018 
02022   double min_left;
02023 } playerc_laser_t;
02024 
02025 
02027 PLAYERC_EXPORT playerc_laser_t *playerc_laser_create(playerc_client_t *client, int index);
02028 
02030 PLAYERC_EXPORT void playerc_laser_destroy(playerc_laser_t *device);
02031 
02033 PLAYERC_EXPORT int playerc_laser_subscribe(playerc_laser_t *device, int access);
02034 
02036 PLAYERC_EXPORT int playerc_laser_unsubscribe(playerc_laser_t *device);
02037 
02060 PLAYERC_EXPORT int playerc_laser_set_config(playerc_laser_t *device,
02061                              double min_angle, double max_angle,
02062                              double resolution,
02063                              double range_res,
02064                              unsigned char intensity,
02065                              double scanning_frequency);
02066 
02089 PLAYERC_EXPORT int playerc_laser_get_config(playerc_laser_t *device,
02090                              double *min_angle,
02091                              double *max_angle,
02092                              double *resolution,
02093                              double *range_res,
02094                              unsigned char *intensity,
02095                              double *scanning_frequency);
02096 
02103 PLAYERC_EXPORT int playerc_laser_get_geom(playerc_laser_t *device);
02104 
02109 PLAYERC_EXPORT int playerc_laser_get_id (playerc_laser_t *device);
02110 
02113 PLAYERC_EXPORT void playerc_laser_printout( playerc_laser_t * device,
02114         const char* prefix );
02115 
02117 /**************************************************************************/
02118 
02119 
02131 typedef struct
02132 {
02134   playerc_device_t info;
02135 
02136   player_limb_data_t data;
02137   player_limb_geom_req_t geom;
02138 } playerc_limb_t;
02139 
02141 PLAYERC_EXPORT playerc_limb_t *playerc_limb_create(playerc_client_t *client, int index);
02142 
02144 PLAYERC_EXPORT void playerc_limb_destroy(playerc_limb_t *device);
02145 
02147 PLAYERC_EXPORT int playerc_limb_subscribe(playerc_limb_t *device, int access);
02148 
02150 PLAYERC_EXPORT int playerc_limb_unsubscribe(playerc_limb_t *device);
02151 
02154 PLAYERC_EXPORT int playerc_limb_get_geom(playerc_limb_t *device);
02155 
02157 PLAYERC_EXPORT int playerc_limb_home_cmd(playerc_limb_t *device);
02158 
02160 PLAYERC_EXPORT int playerc_limb_stop_cmd(playerc_limb_t *device);
02161 
02163 PLAYERC_EXPORT int playerc_limb_setpose_cmd(playerc_limb_t *device, float pX, float pY, float pZ, float aX, float aY, float aZ, float oX, float oY, float oZ);
02164 
02167 PLAYERC_EXPORT int playerc_limb_setposition_cmd(playerc_limb_t *device, float pX, float pY, float pZ);
02168 
02171 PLAYERC_EXPORT int playerc_limb_vecmove_cmd(playerc_limb_t *device, float x, float y, float z, float length);
02172 
02176 PLAYERC_EXPORT int playerc_limb_power(playerc_limb_t *device, uint32_t enable);
02177 
02179 PLAYERC_EXPORT int playerc_limb_brakes(playerc_limb_t *device, uint32_t enable);
02180 
02182 PLAYERC_EXPORT int playerc_limb_speed_config(playerc_limb_t *device, float speed);
02183 
02185 /**************************************************************************/
02186 
02187 
02188 /***************************************************************************/
02205 typedef struct playerc_localize_particle
02206 {
02207   double pose[3];
02208   double weight;
02209 } playerc_localize_particle_t;
02210 
02211 
02213 typedef struct
02214 {
02216   playerc_device_t info;
02217 
02219   int map_size_x, map_size_y;
02220 
02222   double map_scale;
02223 
02225   int map_tile_x, map_tile_y;
02226 
02228   int8_t *map_cells;
02229 
02231   int pending_count;
02232 
02234   double pending_time;
02235 
02237   int hypoth_count;
02238   player_localize_hypoth_t *hypoths;
02239 
02240   double mean[3];
02241   double variance;
02242   int num_particles;
02243   playerc_localize_particle_t *particles;
02244 
02245 } playerc_localize_t;
02246 
02247 
02249 PLAYERC_EXPORT playerc_localize_t *playerc_localize_create(playerc_client_t *client, int index);
02250 
02252 PLAYERC_EXPORT void playerc_localize_destroy(playerc_localize_t *device);
02253 
02255 PLAYERC_EXPORT int playerc_localize_subscribe(playerc_localize_t *device, int access);
02256 
02258 PLAYERC_EXPORT int playerc_localize_unsubscribe(playerc_localize_t *device);
02259 
02261 PLAYERC_EXPORT int playerc_localize_set_pose(playerc_localize_t *device, double pose[3], double cov[3]);
02262 
02265 PLAYERC_EXPORT int playerc_localize_get_particles(playerc_localize_t *device);
02266 
02268 /**************************************************************************/
02269 
02270 
02271 /***************************************************************************/
02281 typedef struct
02282 {
02284   playerc_device_t info;
02285 
02288   int type;
02289 
02292   int state;
02293 } playerc_log_t;
02294 
02295 
02297 PLAYERC_EXPORT playerc_log_t *playerc_log_create(playerc_client_t *client, int index);
02298 
02300 PLAYERC_EXPORT void playerc_log_destroy(playerc_log_t *device);
02301 
02303 PLAYERC_EXPORT int playerc_log_subscribe(playerc_log_t *device, int access);
02304 
02306 PLAYERC_EXPORT int playerc_log_unsubscribe(playerc_log_t *device);
02307 
02309 PLAYERC_EXPORT int playerc_log_set_write_state(playerc_log_t* device, int state);
02310 
02312 PLAYERC_EXPORT int playerc_log_set_read_state(playerc_log_t* device, int state);
02313 
02315 PLAYERC_EXPORT int playerc_log_set_read_rewind(playerc_log_t* device);
02316 
02322 PLAYERC_EXPORT int playerc_log_get_state(playerc_log_t* device);
02323 
02325 PLAYERC_EXPORT int playerc_log_set_filename(playerc_log_t* device, const char* fname);
02326 
02327 
02331 /***************************************************************************/
02341 typedef struct
02342 {
02344   playerc_device_t info;
02345 
02347   double resolution;
02348 
02350   int width, height;
02351 
02353   double origin[2];
02354 
02356   char* cells;
02357 
02360   double vminx, vminy, vmaxx, vmaxy;
02361   int num_segments;
02362   player_segment_t* segments;
02363 } playerc_map_t;
02364 
02367 #define PLAYERC_MAP_INDEX(dev, i, j) ((dev->width) * (j) + (i))
02368 
02370 PLAYERC_EXPORT playerc_map_t *playerc_map_create(playerc_client_t *client, int index);
02371 
02373 PLAYERC_EXPORT void playerc_map_destroy(playerc_map_t *device);
02374 
02376 PLAYERC_EXPORT int playerc_map_subscribe(playerc_map_t *device, int access);
02377 
02379 PLAYERC_EXPORT int playerc_map_unsubscribe(playerc_map_t *device);
02380 
02382 PLAYERC_EXPORT int playerc_map_get_map(playerc_map_t* device);
02383 
02385 PLAYERC_EXPORT int playerc_map_get_vector(playerc_map_t* device);
02386 
02388 /**************************************************************************/
02389 
02398 typedef struct
02399 {
02401   playerc_device_t info;
02403   uint32_t srid;
02405   player_extent2d_t extent;
02407   uint32_t layers_count;
02409   player_vectormap_layer_data_t** layers_data;
02411   player_vectormap_layer_info_t** layers_info;
02413   playerwkbprocessor_t wkbprocessor;
02414 
02415 } playerc_vectormap_t;
02416 
02418 PLAYERC_EXPORT playerc_vectormap_t *playerc_vectormap_create(playerc_client_t *client, int index);
02419 
02421 PLAYERC_EXPORT void playerc_vectormap_destroy(playerc_vectormap_t *device);
02422 
02424 PLAYERC_EXPORT int playerc_vectormap_subscribe(playerc_vectormap_t *device, int access);
02425 
02427 PLAYERC_EXPORT int playerc_vectormap_unsubscribe(playerc_vectormap_t *device);
02428 
02430 PLAYERC_EXPORT int playerc_vectormap_get_map_info(playerc_vectormap_t* device);
02431 
02433 PLAYERC_EXPORT int playerc_vectormap_get_layer_data(playerc_vectormap_t *device, unsigned layer_index);
02434 
02436 PLAYERC_EXPORT int playerc_vectormap_write_layer(playerc_vectormap_t *device, const player_vectormap_layer_data_t * data);
02437 
02439 PLAYERC_EXPORT void playerc_vectormap_cleanup(playerc_vectormap_t *device);
02440 
02443 PLAYERC_EXPORT uint8_t * playerc_vectormap_get_feature_data(playerc_vectormap_t *device, unsigned layer_index, unsigned feature_index);
02444 PLAYERC_EXPORT size_t playerc_vectormap_get_feature_data_count(playerc_vectormap_t *device, unsigned layer_index, unsigned feature_index);
02445 
02448 /***************************************************************************/
02459 typedef struct
02460 {
02462   playerc_device_t info;
02463 
02465   int data_count;
02466 
02468   uint8_t *data;
02469 } playerc_opaque_t;
02470 
02472 PLAYERC_EXPORT playerc_opaque_t *playerc_opaque_create(playerc_client_t *client, int index);
02473 
02475 PLAYERC_EXPORT void playerc_opaque_destroy(playerc_opaque_t *device);
02476 
02478 PLAYERC_EXPORT int playerc_opaque_subscribe(playerc_opaque_t *device, int access);
02479 
02481 PLAYERC_EXPORT int playerc_opaque_unsubscribe(playerc_opaque_t *device);
02482 
02484 PLAYERC_EXPORT int playerc_opaque_cmd(playerc_opaque_t *device, player_opaque_data_t *data);
02485 
02492 PLAYERC_EXPORT int playerc_opaque_req(playerc_opaque_t *device, player_opaque_data_t *request, player_opaque_data_t **reply);
02493 
02495 /**************************************************************************/
02496 
02497 
02498 /***************************************************************************/
02508 typedef struct
02509 {
02511   playerc_device_t info;
02512 
02514   int path_valid;
02515 
02517   int path_done;
02518 
02520   double px, py, pa;
02521 
02523   double gx, gy, ga;
02524 
02526   double wx, wy, wa;
02527 
02531   int curr_waypoint;
02532 
02534   int waypoint_count;
02535 
02538   double (*waypoints)[3];
02539 
02540 } playerc_planner_t;
02541 
02543 PLAYERC_EXPORT playerc_planner_t *playerc_planner_create(playerc_client_t *client, int index);
02544 
02546 PLAYERC_EXPORT void playerc_planner_destroy(playerc_planner_t *device);
02547 
02549 PLAYERC_EXPORT int playerc_planner_subscribe(playerc_planner_t *device, int access);
02550 
02552 PLAYERC_EXPORT int playerc_planner_unsubscribe(playerc_planner_t *device);
02553 
02555 PLAYERC_EXPORT int playerc_planner_set_cmd_pose(playerc_planner_t *device,
02556                                   double gx, double gy, double ga);
02557 
02564 PLAYERC_EXPORT int playerc_planner_get_waypoints(playerc_planner_t *device);
02565 
02571 PLAYERC_EXPORT int playerc_planner_enable(playerc_planner_t *device, int state);
02572 
02574 /**************************************************************************/
02575 
02576 /***************************************************************************/
02587 typedef struct
02588 {
02590   playerc_device_t info;
02591 
02595   double pose[3];
02596   double size[2];
02597 
02599   double pos;
02600 
02602   double vel;
02603 
02605   int stall;
02606 
02618   int status;
02619 
02620 } playerc_position1d_t;
02621 
02623 PLAYERC_EXPORT playerc_position1d_t *playerc_position1d_create(playerc_client_t *client,
02624                                                 int index);
02625 
02627 PLAYERC_EXPORT void playerc_position1d_destroy(playerc_position1d_t *device);
02628 
02630 PLAYERC_EXPORT int playerc_position1d_subscribe(playerc_position1d_t *device, int access);
02631 
02633 PLAYERC_EXPORT int playerc_position1d_unsubscribe(playerc_position1d_t *device);
02634 
02636 PLAYERC_EXPORT int playerc_position1d_enable(playerc_position1d_t *device, int enable);
02637 
02640 PLAYERC_EXPORT int playerc_position1d_get_geom(playerc_position1d_t *device);
02641 
02643 PLAYERC_EXPORT int playerc_position1d_set_cmd_vel(playerc_position1d_t *device,
02644                                    double vel, int state);
02645 
02649 PLAYERC_EXPORT int playerc_position1d_set_cmd_pos(playerc_position1d_t *device,
02650                                    double pos, int state);
02651 
02656 PLAYERC_EXPORT int playerc_position1d_set_cmd_pos_with_vel(playerc_position1d_t *device,
02657                                             double pos, double vel, int state);
02658 
02660 PLAYERC_EXPORT int playerc_position1d_set_odom(playerc_position1d_t *device,
02661                                 double odom);
02662 
02664 /**************************************************************************/
02665 
02666 
02667 /***************************************************************************/
02681 typedef struct
02682 {
02684   playerc_device_t info;
02685 
02689   double pose[3];
02690   double size[2];
02691 
02693   double px, py, pa;
02694 
02696   double vx, vy, va;
02697 
02699   int stall;
02700 
02701 } playerc_position2d_t;
02702 
02704 PLAYERC_EXPORT playerc_position2d_t *playerc_position2d_create(playerc_client_t *client,
02705                                                 int index);
02706 
02708 PLAYERC_EXPORT void playerc_position2d_destroy(playerc_position2d_t *device);
02709 
02711 PLAYERC_EXPORT int playerc_position2d_subscribe(playerc_position2d_t *device, int access);
02712 
02714 PLAYERC_EXPORT int playerc_position2d_unsubscribe(playerc_position2d_t *device);
02715 
02717 PLAYERC_EXPORT int playerc_position2d_enable(playerc_position2d_t *device, int enable);
02718 
02721 PLAYERC_EXPORT int playerc_position2d_get_geom(playerc_position2d_t *device);
02722 
02727 PLAYERC_EXPORT int playerc_position2d_set_cmd_vel(playerc_position2d_t *device,
02728                                    double vx, double vy, double va, int state);
02729 
02731 PLAYERC_EXPORT int playerc_position2d_set_cmd_pose_with_vel(playerc_position2d_t *device,
02732                                              player_pose2d_t pos,
02733                                              player_pose2d_t vel,
02734                                              int state);
02735 
02740 PLAYERC_EXPORT int playerc_position2d_set_cmd_vel_head(playerc_position2d_t *device,
02741                                    double vx, double vy, double pa, int state);
02742 
02743 
02744 
02747 PLAYERC_EXPORT int playerc_position2d_set_cmd_pose(playerc_position2d_t *device,
02748                                     double gx, double gy, double ga, int state);
02749 
02751 PLAYERC_EXPORT int playerc_position2d_set_cmd_car(playerc_position2d_t *device,
02752                                     double vx, double a);
02753 
02755 PLAYERC_EXPORT int playerc_position2d_set_odom(playerc_position2d_t *device,
02756                                 double ox, double oy, double oa);
02757 
02759 /**************************************************************************/
02760 
02761 /***************************************************************************/
02776 typedef struct
02777 {
02779   playerc_device_t info;
02780 
02784   double pose[3];
02785   double size[2];
02786 
02788   double pos_x, pos_y, pos_z;
02789 
02791   double pos_roll, pos_pitch, pos_yaw;
02792 
02794   double vel_x, vel_y, vel_z;
02795 
02797   double vel_roll, vel_pitch, vel_yaw;
02798 
02800   int stall;
02801 
02802 } playerc_position3d_t;
02803 
02804 
02806 PLAYERC_EXPORT playerc_position3d_t *playerc_position3d_create(playerc_client_t *client,
02807                                                 int index);
02808 
02810 PLAYERC_EXPORT void playerc_position3d_destroy(playerc_position3d_t *device);
02811 
02813 PLAYERC_EXPORT int playerc_position3d_subscribe(playerc_position3d_t *device, int access);
02814 
02816 PLAYERC_EXPORT int playerc_position3d_unsubscribe(playerc_position3d_t *device);
02817 
02819 PLAYERC_EXPORT int playerc_position3d_enable(playerc_position3d_t *device, int enable);
02820 
02823 PLAYERC_EXPORT int playerc_position3d_get_geom(playerc_position3d_t *device);
02824 
02829 PLAYERC_EXPORT int playerc_position3d_set_velocity(playerc_position3d_t *device,
02830                                     double vx, double vy, double vz,
02831                                     double vr, double vp, double vt,
02832                                     int state);
02833 
02835 PLAYERC_EXPORT int playerc_position3d_set_speed(playerc_position3d_t *device,
02836                                  double vx, double vy, double vz, int state);
02837 
02840 PLAYERC_EXPORT int playerc_position3d_set_pose(playerc_position3d_t *device,
02841                                 double gx, double gy, double gz,
02842                                 double gr, double gp, double gt);
02843 
02844 
02846 PLAYERC_EXPORT int playerc_position3d_set_pose_with_vel(playerc_position3d_t *device,
02847                                          player_pose3d_t pos,
02848                                          player_pose3d_t vel);
02849 
02851 PLAYERC_EXPORT int playerc_position3d_set_cmd_pose(playerc_position3d_t *device,
02852                                     double gx, double gy, double gz);
02853 
02855 PLAYERC_EXPORT int playerc_position3d_set_vel_mode(playerc_position3d_t *device, int mode);
02856 
02858 PLAYERC_EXPORT int playerc_position3d_set_odom(playerc_position3d_t *device,
02859                                 double ox, double oy, double oz,
02860                                 double oroll, double opitch, double oyaw);
02861 
02863 PLAYERC_EXPORT int playerc_position3d_reset_odom(playerc_position3d_t *device);
02864 
02866 /**************************************************************************/
02867 
02868 
02869 /***************************************************************************/
02880 typedef struct
02881 {
02883   playerc_device_t info;
02884 
02887   int valid;
02888 
02890   double charge;
02891 
02893   double percent;
02894 
02896   double joules;
02897 
02900   double watts;
02901 
02903   int charging;
02904 
02905 } playerc_power_t;
02906 
02907 
02909 PLAYERC_EXPORT playerc_power_t *playerc_power_create(playerc_client_t *client, int index);
02910 
02912 PLAYERC_EXPORT void playerc_power_destroy(playerc_power_t *device);
02913 
02915 PLAYERC_EXPORT int playerc_power_subscribe(playerc_power_t *device, int access);
02916 
02918 PLAYERC_EXPORT int playerc_power_unsubscribe(playerc_power_t *device);
02919 
02920 
02922 /**************************************************************************/
02923 
02924 
02925 
02926 /***************************************************************************/
02937 typedef struct
02938 {
02940   playerc_device_t info;
02941 
02945   double pan, tilt;
02946 
02948   double zoom;
02949 
02951   int status;
02952 } playerc_ptz_t;
02953 
02954 
02956 PLAYERC_EXPORT playerc_ptz_t *playerc_ptz_create(playerc_client_t *client, int index);
02957 
02959 PLAYERC_EXPORT void playerc_ptz_destroy(playerc_ptz_t *device);
02960 
02962 PLAYERC_EXPORT int playerc_ptz_subscribe(playerc_ptz_t *device, int access);
02963 
02965 PLAYERC_EXPORT int playerc_ptz_unsubscribe(playerc_ptz_t *device);
02966 
02975 PLAYERC_EXPORT int playerc_ptz_set(playerc_ptz_t *device, double pan, double tilt, double zoom);
02976 
02982 PLAYERC_EXPORT int playerc_ptz_query_status(playerc_ptz_t *device);
02983 
02994 PLAYERC_EXPORT int playerc_ptz_set_ws(playerc_ptz_t *device, double pan, double tilt, double zoom,
02995                        double panspeed, double tiltspeed);
02996 
03004 PLAYERC_EXPORT int playerc_ptz_set_control_mode(playerc_ptz_t *device, int mode);
03005 
03007 /**************************************************************************/
03008 
03009 /***************************************************************************/
03019 typedef struct
03020 {
03022   playerc_device_t info;
03023 
03025   uint32_t element_count;
03026 
03028   double min_angle;
03030   double max_angle;
03032   double angular_res;
03035   double min_range;
03037   double max_range;
03039   double range_res;
03041   double frequency;
03042 
03046   player_pose3d_t device_pose;
03047   player_bbox3d_t device_size;
03051   player_pose3d_t *element_poses;
03052   player_bbox3d_t *element_sizes;
03053 
03055   uint32_t ranges_count;
03057   double *ranges;
03058 
03060   uint32_t intensities_count;
03064   double *intensities;
03065 
03067   uint32_t bearings_count;
03070   double *bearings;
03071 
03073   uint32_t points_count;
03075   player_point_3d_t *points;
03076 
03077 } playerc_ranger_t;
03078 
03080 PLAYERC_EXPORT playerc_ranger_t *playerc_ranger_create(playerc_client_t *client, int index);
03081 
03083 PLAYERC_EXPORT void playerc_ranger_destroy(playerc_ranger_t *device);
03084 
03086 PLAYERC_EXPORT int playerc_ranger_subscribe(playerc_ranger_t *device, int access);
03087 
03089 PLAYERC_EXPORT int playerc_ranger_unsubscribe(playerc_ranger_t *device);
03090 
03095 PLAYERC_EXPORT int playerc_ranger_get_geom(playerc_ranger_t *device);
03096 
03100 PLAYERC_EXPORT int playerc_ranger_power_config(playerc_ranger_t *device, uint8_t value);
03101 
03105 PLAYERC_EXPORT int playerc_ranger_intns_config(playerc_ranger_t *device, uint8_t value);
03106 
03115 PLAYERC_EXPORT int playerc_ranger_set_config(playerc_ranger_t *device, double min_angle,
03116                               double max_angle, double angular_res,
03117                               double min_range, double max_range,
03118                               double range_res, double frequency);
03119 
03128 PLAYERC_EXPORT int playerc_ranger_get_config(playerc_ranger_t *device, double *min_angle,
03129                               double *max_angle, double *angular_res,
03130                               double *min_range, double *max_range,
03131                               double *range_res, double *frequency);
03132 
03134 /**************************************************************************/
03135 
03136 /***************************************************************************/
03147 typedef struct
03148 {
03150   playerc_device_t info;
03151 
03153   int pose_count;
03154 
03157   player_pose3d_t *poses;
03158 
03160   int scan_count;
03161 
03163   double *scan;
03164 
03165 } playerc_sonar_t;
03166 
03167 
03169 PLAYERC_EXPORT playerc_sonar_t *playerc_sonar_create(playerc_client_t *client, int index);
03170 
03172 PLAYERC_EXPORT void playerc_sonar_destroy(playerc_sonar_t *device);
03173 
03175 PLAYERC_EXPORT int playerc_sonar_subscribe(playerc_sonar_t *device, int access);
03176 
03178 PLAYERC_EXPORT int playerc_sonar_unsubscribe(playerc_sonar_t *device);
03179 
03185 PLAYERC_EXPORT int playerc_sonar_get_geom(playerc_sonar_t *device);
03186 
03188 /**************************************************************************/
03189 
03190 /***************************************************************************/
03202 typedef struct
03203 {
03205   uint8_t mac[32];
03206 
03208   uint8_t ip[32];
03209 
03211   uint8_t essid[32];
03212 
03214   int mode;
03215 
03217   int encrypt;
03218 
03220   double freq;
03221 
03223   int qual, level, noise;
03224 
03225 } playerc_wifi_link_t;
03226 
03227 
03229 typedef struct
03230 {
03232   playerc_device_t info;
03233 
03235   playerc_wifi_link_t *links;
03236   int link_count;
03237   char ip[32];
03238 } playerc_wifi_t;
03239 
03240 
03242 PLAYERC_EXPORT playerc_wifi_t *playerc_wifi_create(playerc_client_t *client, int index);
03243 
03245 PLAYERC_EXPORT void playerc_wifi_destroy(playerc_wifi_t *device);
03246 
03248 PLAYERC_EXPORT int playerc_wifi_subscribe(playerc_wifi_t *device, int access);
03249 
03251 PLAYERC_EXPORT int playerc_wifi_unsubscribe(playerc_wifi_t *device);
03252 
03254 PLAYERC_EXPORT playerc_wifi_link_t *playerc_wifi_get_link(playerc_wifi_t *device, int link);
03255 
03256 
03258 /**************************************************************************/
03259 
03260 /***************************************************************************/
03272 typedef struct
03273 {
03275   playerc_device_t info;
03276 
03277 } playerc_simulation_t;
03278 
03279 
03281 PLAYERC_EXPORT playerc_simulation_t *playerc_simulation_create(playerc_client_t *client, int index);
03282 
03284 PLAYERC_EXPORT void playerc_simulation_destroy(playerc_simulation_t *device);
03285 
03287 PLAYERC_EXPORT int playerc_simulation_subscribe(playerc_simulation_t *device, int access);
03288 
03290 PLAYERC_EXPORT int playerc_simulation_unsubscribe(playerc_simulation_t *device);
03291 
03293 PLAYERC_EXPORT int playerc_simulation_set_pose2d(playerc_simulation_t *device, char* name,
03294                                   double gx, double gy, double ga);
03295 
03297 PLAYERC_EXPORT int playerc_simulation_get_pose2d(playerc_simulation_t *device, char* identifier,
03298                                   double *x, double *y, double *a);
03299 
03301 PLAYERC_EXPORT int playerc_simulation_set_pose3d(playerc_simulation_t *device, char* name,
03302                                   double gx, double gy, double gz,
03303                                   double groll, double gpitch, double gyaw);
03304 
03306 PLAYERC_EXPORT int playerc_simulation_get_pose3d(playerc_simulation_t *device, char* identifier,
03307                                   double *x, double *y, double *z,
03308                                   double *roll, double *pitch, double *yaw, double *time);
03309 
03311 PLAYERC_EXPORT int playerc_simulation_set_property(playerc_simulation_t *device,
03312                                     char* name,
03313                                     char* property,
03314                                     void* value,
03315                                     size_t value_len);
03316 
03318 PLAYERC_EXPORT int playerc_simulation_get_property(playerc_simulation_t *device,
03319                                     char* name,
03320                                     char* property,
03321                                     void* value,
03322                                     size_t value_len);
03323 
03325 PLAYERC_EXPORT int playerc_simulation_pause(playerc_simulation_t *device );
03326 
03328 PLAYERC_EXPORT int playerc_simulation_reset(playerc_simulation_t *device );
03329 
03331 PLAYERC_EXPORT int playerc_simulation_save(playerc_simulation_t *device );
03332 
03333 
03335 /***************************************************************************/
03336 
03337 
03338 /**************************************************************************/
03348 typedef struct
03349 {
03351   playerc_device_t info;
03352 } playerc_speech_t;
03353 
03354 
03356 PLAYERC_EXPORT playerc_speech_t *playerc_speech_create(playerc_client_t *client, int index);
03357 
03359 PLAYERC_EXPORT void playerc_speech_destroy(playerc_speech_t *device);
03360 
03362 PLAYERC_EXPORT int playerc_speech_subscribe(playerc_speech_t *device, int access);
03363 
03365 PLAYERC_EXPORT int playerc_speech_unsubscribe(playerc_speech_t *device);
03366 
03368 PLAYERC_EXPORT int playerc_speech_say (playerc_speech_t *device, char *);
03369 
03370 
03372 /***************************************************************************/
03373 
03374 /**************************************************************************/
03384 typedef struct
03385 {
03387   playerc_device_t info;
03388 
03389   char *rawText;
03390   /* Just estimating that no more than 20 words will be spoken between updates.
03391    Assuming that the longest word is <= 30 characters.*/
03392   char **words;
03393   int wordCount;
03394 } playerc_speechrecognition_t;
03395 
03396 
03398 PLAYERC_EXPORT playerc_speechrecognition_t *playerc_speechrecognition_create(playerc_client_t *client, int index);
03399 
03401 PLAYERC_EXPORT void playerc_speechrecognition_destroy(playerc_speechrecognition_t *device);
03402 
03404 PLAYERC_EXPORT int playerc_speechrecognition_subscribe(playerc_speechrecognition_t *device, int access);
03405 
03407 PLAYERC_EXPORT int playerc_speechrecognition_unsubscribe(playerc_speechrecognition_t *device);
03408 
03410 /***************************************************************************/
03411 
03412 /**************************************************************************/
03422 typedef struct
03423 {
03425     uint32_t type;
03427     uint32_t guid_count;
03429     uint8_t *guid;
03430 }  playerc_rfidtag_t;
03431 
03433 typedef struct
03434 {
03436   playerc_device_t info;
03437 
03439   uint16_t tags_count;
03440 
03442   playerc_rfidtag_t *tags;
03443 } playerc_rfid_t;
03444 
03445 
03447 PLAYERC_EXPORT playerc_rfid_t *playerc_rfid_create(playerc_client_t *client, int index);
03448 
03450 PLAYERC_EXPORT void playerc_rfid_destroy(playerc_rfid_t *device);
03451 
03453 PLAYERC_EXPORT int playerc_rfid_subscribe(playerc_rfid_t *device, int access);
03454 
03456 PLAYERC_EXPORT int playerc_rfid_unsubscribe(playerc_rfid_t *device);
03457 
03459 /***************************************************************************/
03460 
03461 /**************************************************************************/
03471 typedef player_pointcloud3d_element_t playerc_pointcloud3d_element_t;
03472 
03474 typedef struct
03475 {
03477   playerc_device_t info;
03478 
03480   uint16_t points_count;
03481 
03483   playerc_pointcloud3d_element_t *points;
03484 } playerc_pointcloud3d_t;
03485 
03486 
03488 PLAYERC_EXPORT playerc_pointcloud3d_t *playerc_pointcloud3d_create (playerc_client_t *client, int index);
03489 
03491 PLAYERC_EXPORT void playerc_pointcloud3d_destroy (playerc_pointcloud3d_t *device);
03492 
03494 PLAYERC_EXPORT int playerc_pointcloud3d_subscribe (playerc_pointcloud3d_t *device, int access);
03495 
03497 PLAYERC_EXPORT int playerc_pointcloud3d_unsubscribe (playerc_pointcloud3d_t *device);
03498 
03500 /***************************************************************************/
03501 
03502 /**************************************************************************/
03511 typedef player_pointcloud3d_stereo_element_t playerc_pointcloud3d_stereo_element_t;
03512 
03514 typedef struct
03515 {
03517   playerc_device_t info;
03518 
03519   /* Left channel image */
03520   playerc_camera_t left_channel;
03521   /* Right channel image */
03522   playerc_camera_t right_channel;
03523 
03524   /* Disparity image */
03525   playerc_camera_t disparity;
03526   
03527   /* 3-D stereo point cloud */
03528   uint32_t points_count;
03529   playerc_pointcloud3d_stereo_element_t *points;
03530 //  player_pointcloud3d_data_t pointcloud;
03531 } playerc_stereo_t;
03532 
03533 
03535 PLAYERC_EXPORT playerc_stereo_t *playerc_stereo_create (playerc_client_t *client, int index);
03536 
03538 PLAYERC_EXPORT void playerc_stereo_destroy (playerc_stereo_t *device);
03539 
03541 PLAYERC_EXPORT int playerc_stereo_subscribe (playerc_stereo_t *device, int access);
03542 
03544 PLAYERC_EXPORT int playerc_stereo_unsubscribe (playerc_stereo_t *device);
03545 
03547 /***************************************************************************/
03548 
03549 /**************************************************************************/
03559 typedef struct
03560 {
03562     playerc_device_t info;
03563 
03565     player_pose3d_t pose;
03566         player_pose3d_t vel;
03567         player_pose3d_t acc;
03568 
03570     player_imu_data_calib_t calib_data;
03571 
03573     float q0, q1, q2, q3;
03574 } playerc_imu_t;
03575 
03577 PLAYERC_EXPORT playerc_imu_t *playerc_imu_create (playerc_client_t *client, int index);
03578 
03580 PLAYERC_EXPORT void playerc_imu_destroy (playerc_imu_t *device);
03581 
03583 PLAYERC_EXPORT int playerc_imu_subscribe (playerc_imu_t *device, int access);
03584 
03586 PLAYERC_EXPORT int playerc_imu_unsubscribe (playerc_imu_t *device);
03587 
03589 PLAYERC_EXPORT int playerc_imu_datatype (playerc_imu_t *device, int value);
03590 
03592 PLAYERC_EXPORT int playerc_imu_reset_orientation (playerc_imu_t *device, int value);
03593 
03595 /***************************************************************************/
03596 
03597 /**************************************************************************/
03610 typedef struct
03611 {
03613     playerc_device_t info;
03614 
03616     uint32_t node_type;
03618     uint32_t node_id;
03620     uint32_t node_parent_id;
03622     player_wsn_node_data_t data_packet;
03623 } playerc_wsn_t;
03624 
03625 
03627 PLAYERC_EXPORT playerc_wsn_t *playerc_wsn_create(playerc_client_t *client, int index);
03628 
03630 PLAYERC_EXPORT void playerc_wsn_destroy(playerc_wsn_t *device);
03631 
03633 PLAYERC_EXPORT int playerc_wsn_subscribe(playerc_wsn_t *device, int access);
03634 
03636 PLAYERC_EXPORT int playerc_wsn_unsubscribe(playerc_wsn_t *device);
03637 
03639 PLAYERC_EXPORT int playerc_wsn_set_devstate(playerc_wsn_t *device, int node_id,
03640                              int group_id, int devnr, int state);
03641 
03643 PLAYERC_EXPORT int playerc_wsn_power(playerc_wsn_t *device, int node_id, int group_id,
03644                       int value);
03645 
03647 PLAYERC_EXPORT int playerc_wsn_datatype(playerc_wsn_t *device, int value);
03648 
03650 PLAYERC_EXPORT int playerc_wsn_datafreq(playerc_wsn_t *device, int node_id, int group_id,
03651                          double frequency);
03652 
03654 /***************************************************************************/
03655 
03656 #ifdef __cplusplus
03657 }
03658 #endif
03659 
03660 #endif

Last updated 25 May 2011 21:17:00