00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028 #include <unistd.h>
00029
00030 #include <sys/types.h>
00031
00032 #ifdef HAVE_CONFIG_H
00033 #include <config.h>
00034 #endif // HAVE_CONFIG_H
00035
00036 #define YP_SPUR_RUNTIME
00037
00038 #include <ipcommunication.h>
00039 #include <ypspur.h>
00040 #include <ypspur-md.h>
00041
00042 static YPSpur spur;
00043
00044
00045 int YP_get_error_state()
00046 {
00047 return YP_md_get_error_state(&spur);
00048 }
00049
00050 double YP_get_device_error_state(int id, int *err)
00051 {
00052 return YP_md_get_device_error_state(&spur, id, err);
00053 }
00054
00055
00056 int YPSpur_initex(int msq_key)
00057 {
00058 return YPSpur_md_initex(&spur, msq_key);
00059 }
00060
00061 int YPSpur_init_socket(char *ip, int port)
00062 {
00063 return YPSpur_md_init_socket(&spur, ip, port);
00064 }
00065
00066
00067 int YPSpur_init(void)
00068 {
00069 return YPSpur_md_init(&spur);
00070 }
00071
00072
00073 int YPSpur_line(int cs, double x, double y, double theta)
00074 {
00075 return YPSpur_md_line(&spur, cs, x, y, theta);
00076 }
00077
00078
00079 int YPSpur_stop_line(int cs, double x, double y, double theta)
00080 {
00081 return YPSpur_md_stop_line(&spur, cs, x, y, theta);
00082 }
00083
00084
00085 int YPSpur_circle(int cs, double x, double y, double r)
00086 {
00087 return YPSpur_md_circle(&spur, cs, x, y, r);
00088 }
00089
00090
00091 int YPSpur_spin(int cs, double theta)
00092 {
00093 return YPSpur_md_spin(&spur, cs, theta);
00094 }
00095
00096
00097 int YPSpur_orient(int cs, double theta)
00098 {
00099 return YPSpur_md_orient(&spur, cs, theta);
00100 }
00101
00102
00103 int YPSpur_stop(void)
00104 {
00105 return YPSpur_md_stop(&spur);
00106 }
00107
00108
00109 int YPSpur_freeze(void)
00110 {
00111 return YPSpur_md_freeze(&spur);
00112 }
00113
00114
00115 int YPSpur_unfreeze(void)
00116 {
00117 return YPSpur_md_unfreeze(&spur);
00118 }
00119
00120
00121 int YPSpur_free(void)
00122 {
00123 return YPSpur_md_free(&spur);
00124 }
00125
00126
00127 int YP_openfree(void)
00128 {
00129 return YP_md_openfree(&spur);
00130 }
00131
00132
00133 int YPSpur_set_pos(int cs, double x, double y, double theta)
00134 {
00135 return YPSpur_md_set_pos(&spur, cs, x, y, theta);
00136 }
00137
00138
00139 int YPSpur_adjust_pos(int cs, double x, double y, double theta)
00140 {
00141 return YPSpur_md_adjust_pos(&spur, cs, x, y, theta);
00142 }
00143
00144
00145 int YPSpur_set_vel(double v)
00146 {
00147 return YPSpur_md_set_vel(&spur, v);
00148 }
00149
00150
00151 int YPSpur_set_angvel(double w)
00152 {
00153 return YPSpur_md_set_angvel(&spur, w);
00154 }
00155
00156
00157 int YPSpur_set_accel(double dv)
00158 {
00159 return YPSpur_md_set_accel(&spur, dv);
00160 }
00161
00162
00163 int YPSpur_set_angaccel(double dw)
00164 {
00165 return YPSpur_md_set_angaccel(&spur, dw);
00166 }
00167
00168
00169 double YPSpur_get_pos(int cs, double *x, double *y, double *theta)
00170 {
00171 return YPSpur_md_get_pos(&spur, cs, x, y, theta);
00172 }
00173
00174
00175 double YPSpur_get_vel(double *v, double *w)
00176 {
00177 return YPSpur_md_get_vel(&spur, v, w);
00178 }
00179
00180
00181 double YP_get_vref(double *v, double *w)
00182 {
00183 return YP_md_get_vref(&spur, v, w);
00184 }
00185
00186
00187 double YP_get_wheel_vref(double *wr, double *wl)
00188 {
00189 return YP_md_get_wheel_vref(&spur, wr, wl);
00190 }
00191
00192
00193 double YP_get_wheel_vel(double *wr, double *wl)
00194 {
00195 return YP_md_get_wheel_vel(&spur, wr, wl);
00196 }
00197
00198
00199 double YP_get_wheel_ang(double *theta_r, double *theta_l)
00200 {
00201 return YP_md_get_wheel_ang(&spur, theta_r, theta_l);
00202 }
00203
00204
00205 double YP_get_wheel_torque(double *torque_r, double *torque_l)
00206 {
00207 return YP_md_get_wheel_torque(&spur, torque_r, torque_l);
00208 }
00209
00210
00211 double YPSpur_get_force(double *trans, double *angular)
00212 {
00213 return YPSpur_md_get_force(&spur, trans, angular);
00214 }
00215
00216
00217 int YPSpur_isfreeze(void)
00218 {
00219 return YPSpur_md_isfreeze(&spur);
00220 }
00221
00222
00223 int YPSpur_vel(double v, double w)
00224 {
00225 return YPSpur_md_vel(&spur, v, w);
00226 }
00227
00228
00229 int YP_set_parameter(int param_id, double value)
00230 {
00231 return YP_md_set_parameter(&spur, param_id, value);
00232 }
00233
00234
00235 int YP_set_parameter_array(int param_id, double *value)
00236 {
00237 return YP_md_set_parameter_array(&spur, param_id, value);
00238 }
00239
00240
00241 int YP_get_parameter(int param_id, double *value)
00242 {
00243 return YP_md_get_parameter(&spur, param_id, value);
00244 }
00245
00246
00247 int YP_get_parameter_array(int param_id, double *value)
00248 {
00249 return YP_md_get_parameter_array(&spur, param_id, value);
00250 }
00251
00252
00253 int YP_set_control_state(int control_id, int state)
00254 {
00255 return YP_md_set_control_state(&spur, control_id, state);
00256 }
00257
00258
00259 int YPSpur_tilt(int cs, double dir, double tilt)
00260 {
00261 return YPSpur_md_tilt(&spur, cs, dir, tilt);
00262 }
00263
00264
00265 int YPSpur_near_pos(int cs, double x, double y, double r)
00266 {
00267 return YPSpur_md_near_pos(&spur, cs, x, y, r);
00268 }
00269
00270
00271 int YPSpur_near_ang(int cs, double th, double d)
00272 {
00273 return YPSpur_md_near_ang(&spur, cs, th, d);
00274 }
00275
00276
00277 int YPSpur_over_line(int cs, double x, double y, double theta)
00278 {
00279 return YPSpur_md_over_line(&spur, cs, x, y, theta);
00280 }
00281
00282
00283 int YP_get_ad_value(int num)
00284 {
00285 return YP_md_get_ad_value(&spur, num);
00286 }
00287
00288 int YP_set_io_dir(unsigned char dir)
00289 {
00290 return YP_md_set_io_dir(&spur, dir);
00291 }
00292
00293 int YP_set_io_data(unsigned char data)
00294 {
00295 return YP_md_set_io_data(&spur, data);
00296 }
00297
00298
00299 int YP_wheel_vel(double r, double l)
00300 {
00301 return YP_md_wheel_vel(&spur, r, l);
00302 }
00303
00304 int YP_wheel_torque(double r, double l)
00305 {
00306 return YP_md_wheel_torque(&spur, r, l);
00307 }
00308
00309 int YP_set_wheel_vel(double r, double l)
00310 {
00311 return YP_md_set_wheel_vel(&spur, r, l);
00312 }
00313
00314 int YP_set_wheel_accel(double r, double l)
00315 {
00316 return YP_md_set_wheel_accel(&spur, r, l);
00317 }
00318
00319 int YP_wheel_ang(double r, double l)
00320 {
00321 return YP_md_wheel_ang(&spur, r, l);
00322 }
00323
00324 int YP_joint_torque(int id, double t)
00325 {
00326 return YP_md_joint_torque(&spur, id, t);
00327 }
00328
00329 int YP_joint_vel(int id, double v)
00330 {
00331 return YP_md_joint_vel(&spur, id, v);
00332 }
00333
00334 int YP_joint_ang(int id, double a)
00335 {
00336 return YP_md_joint_ang(&spur, id, a);
00337 }
00338
00339 int YP_joint_ang_vel(int id, double a, double v)
00340 {
00341 return YP_md_joint_ang_vel(&spur, id, a, v);
00342 }
00343
00344 int YP_set_joint_accel(int id, double a)
00345 {
00346 return YP_md_set_joint_accel(&spur, id, a);
00347 }
00348
00349 int YP_set_joint_vel(int id, double v)
00350 {
00351 return YP_md_set_joint_vel(&spur, id, v);
00352 }
00353
00354 double YP_get_joint_vel(int id, double *v)
00355 {
00356 return YP_md_get_joint_vel(&spur, id, v);
00357 }
00358
00359 double YP_get_joint_vref(int id, double *v)
00360 {
00361 return YP_md_get_joint_vref(&spur, id, v);
00362 }
00363
00364 double YP_get_joint_ang(int id, double *a)
00365 {
00366 return YP_md_get_joint_ang(&spur, id, a);
00367 }
00368
00369 double YP_get_joint_torque(int id, double *w)
00370 {
00371 return YP_md_get_joint_torque(&spur, id, w);
00372 }