libkindrv 0.1
Loading...
Searching...
No Matches
types.h
1
2/***************************************************************************
3 * types.h - KinDrv common typedef structs and enums
4 *
5 * Created: Fri Oct 11 00:31:00 2013
6 * Copyright 2013 Bahram Maleki-Fard
7 * Copyright 2014 Tekin Mericli
8 ****************************************************************************/
9
10/* This file is part of libkindrv.
11 *
12 * libkindrv is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * libkindrv is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser Public License
23 * along with libkindrv. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26#ifndef __KINDRV_TYPES_H_
27#define __KINDRV_TYPES_H_
28
29namespace KinDrv {
30
31typedef enum {
32 ERROR_NONE = 0,
33 ERROR_UNKNOWN = 1,
34
35 ERROR_USB_INIT = 101,
36 ERROR_USB_DEVICE = 102,
37 ERROR_USB_INTERFACE = 103,
38
39 ERROR_USB_INTERRUPT = 201,
40 ERROR_USB_SHORT_WRITE = 202,
41 ERROR_USB_SHORT_READ = 203,
42
43 ERROR_CMD_ID_MISMATCH = 301,
44} error_t;
45
46typedef enum {
47 POSITION_NO_MOVEMENT = 0,
48 POSITION_CARTESIAN = 1,
49 POSITION_ANGULAR = 2,
50 SPEED_CARTESIAN = 7,
51 SPEED_ANGULAR = 8,
52 TIME_DELAY = 12
53} jaco_position_type_t;
54
55typedef enum {
56 NO_MOVEMENT = 0,
57 MODE_POSITION = 1,
58 MODE_SPEED = 2
59} jaco_hand_mode_t;
60
61typedef enum {
62 MODE_NORMAL_TO_READY = 0,
63 MODE_READY_STANDBY = 1,
64 MODE_READY_TO_RETRACT = 2,
65 MODE_RETRACT_STANDBY = 3,
66 MODE_RETRACT_TO_READY = 4,
67 MODE_NORMAL = 5,
68 MODE_NOINIT = 6,
69 MODE_ERROR = 25000
70} jaco_retract_mode_t;
71
72typedef enum {
73 LATERALITY_LEFT,
74 LATERALITY_RIGHT
75} jaco_laterality_t;
76
77
79
81typedef struct {
82 union {
83 float joints[6];
84 struct {
85 float position[3];
86 float rotation[3];
87 };
88 };
89 float finger_position[3];
90} jaco_position_t; // 36 bytes
91
93typedef struct {
95 float time_delay;
96 jaco_hand_mode_t hand_mode;
97 jaco_position_type_t pos_type;
99
101typedef unsigned short jaco_joystick_button_t[16];
102
104typedef struct {
105 union {
106 float axis[6];
107 struct {
108 float trans_lr;
109 float trans_fb;
110 float trans_rot;
111 float wrist_fb;
112 float wrist_lr;
113 float wrist_rot;
114 };
115 };
116} jaco_joystick_axis_t;
117
119typedef struct {
120 jaco_joystick_button_t button;
123
125typedef struct {
126 float voltage;
127 float current;
128 float acceleration[3];
129 float joint_temperature[6];
130 float finger_temperature[3];
132
134typedef struct {
135 jaco_position_type_t pos_type;
136 float delay;
140 jaco_hand_mode_t hand_mode;
141 float finger_position[3];
142} jaco_user_position_t; // 96 bytes
143
145typedef struct {
146 union {
147 unsigned char data[112]; // raw data
148 struct {
149 // client information; 100 bytes
150 char id[20];
151 char name[20];
152 char organization[20];
153 char sn[20];
154 char model_no[20];
155
156 char temp_buffer[12]; // just to make the total size a multiple of 56
157 };
158 };
159/*
160
161 jaco_laterality_t laterality;
162
163 // thresholds; 20 bytes
164 float max_linear_speed;
165 float max_angular_speed;
166 float max_linear_acc;
167 float max_angular_acc;
168 float max_force;
169
170 float sensibility;
171 float drinking_height;
172
173 // retract settings; 1932 bytes
174 int complex_retract_active;
175 float retracted_position_angle;
176 int retracted_position_count;
177 jaco_user_position_t retract_positions[20]; // 1920 bytes
178
179 float drinking_distance;
180 int fingers_2and3_inverted;
181 float drinking_lenght;
182
183 int reset_at_retract;
184
185 int enable_flash_error_log;
186 int enable_flash_position_log;
187*/
188} jaco_client_config_t; //2088 bytes
189
190
192typedef struct {
193 unsigned short id_packet;
194 unsigned short packet_quantity;
195 unsigned short command_id;
196 unsigned short command_size;
198
200typedef struct {
201 union {
202 unsigned char data[64];
203 struct {
205 float body[14];
206 };
207 };
208} usb_packet_t;
209
210
211} // end namespace KinDrv
212#endif
Basic trajectory struct.
Definition types.h:93
jaco_position_t target
Definition types.h:94
jaco_hand_mode_t hand_mode
Definition types.h:96
jaco_position_type_t pos_type
Definition types.h:97
float time_delay
Definition types.h:95
Struct containing the client information and configuration.
Definition types.h:145
Struct for joystick axis movement. Make sure to initialze with 0s!
Definition types.h:104
float trans_lr
Definition types.h:108
float wrist_rot
Definition types.h:113
float trans_rot
Definition types.h:110
float wrist_fb
Definition types.h:111
float wrist_lr
Definition types.h:112
float trans_fb
Definition types.h:109
Each joystick action (button,axis) as a whole is represented by one of this struct....
Definition types.h:119
jaco_joystick_axis_t axis
Definition types.h:121
jaco_joystick_button_t button
Definition types.h:120
Jaco universal position struct.
Definition types.h:81
Struct that holds values of various sensors of the robot.
Definition types.h:125
float voltage
Definition types.h:126
float current
Definition types.h:127
User position struct.
Definition types.h:134
jaco_position_t cartesian_pos
Definition types.h:137
jaco_hand_mode_t hand_mode
Definition types.h:140
float delay
Definition types.h:136
jaco_position_type_t pos_type
Definition types.h:135
jaco_position_t angular_pos
Definition types.h:138
USB packet header struct. All USB packets must have this header structure.
Definition types.h:192
unsigned short command_size
Definition types.h:196
unsigned short packet_quantity
Definition types.h:194
unsigned short command_id
Definition types.h:195
unsigned short id_packet
Definition types.h:193
usb_packet_header_t header
Definition types.h:204