libypspur.c
Go to the documentation of this file.
00001 // Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
00002 //
00003 // Permission is hereby granted, free of charge, to any person obtaining a copy
00004 // of this software and associated documentation files (the "Software"), to
00005 // deal in the Software without restriction, including without limitation the
00006 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00007 // sell copies of the Software, and to permit persons to whom the Software is
00008 // furnished to do so, subject to the following conditions:
00009 //
00010 // The above copyright notice and this permission notice shall be included in
00011 // all copies or substantial portions of the Software.
00012 //
00013 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00014 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00015 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00016 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00017 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00018 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00019 // SOFTWARE.
00020 
00021 /* 
00022  * YP-Spurとの通信ライブラリ Communication Library for YP-Spur
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 /* coordinatorとのメッセージ通信を開始する */
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 /* coordinatorとのメッセージ通信を開始する */
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 }


yp-spur
Author(s):
autogenerated on Fri May 10 2019 02:52:19