ypspur-md.h
Go to the documentation of this file.
1 // Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef YPSPUR_MD_H
22 #define YPSPUR_MD_H
23 
24 #include <ypparam.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif // __cplusplus
29 
30 #define Spur_md_init(dev) YPSpur_md_init(dev)
31 #define Spur_md_initex(dev, msq) YPSpur_md_initex(dev, msq)
32 #define Spur_md_init_socket(dev, ip, port) YPSpur_md_init_socket(dev, ip, port)
33 #define Spur_md_stop(dev) YPSpur_md_stop(dev)
34 #define Spur_md_free(dev) YPSpur_md_free(dev)
35 
36 #define Spur_md_freeze(dev) YPSpur_md_freeze(dev)
37 #define Spur_md_isfreeze(dev) YPSpur_md_isfreeze(dev)
38 #define Spur_md_unfreeze(dev) YPSpur_md_unfreeze(dev)
39 
40 #define Spur_md_line_GL(dev, x, y, th) YPSpur_md_line(dev, CS_GL, x, y, th)
41 #define Spur_md_line_LC(dev, x, y, th) YPSpur_md_line(dev, CS_LC, x, y, th)
42 #define Spur_md_line_FS(dev, x, y, th) YPSpur_md_line(dev, CS_FS, x, y, th)
43 #define Spur_md_line_BS(dev, x, y, th) YPSpur_md_line(dev, CS_BS, x, y, th)
44 #define Spur_md_line_BL(dev, x, y, th) YPSpur_md_line(dev, CS_BL, x, y, th)
45 
46 #define Spur_md_stop_line_GL(dev, x, y, th) YPSpur_md_stop_line(dev, CS_GL, x, y, th)
47 #define Spur_md_stop_line_LC(dev, x, y, th) YPSpur_md_stop_line(dev, CS_LC, x, y, th)
48 #define Spur_md_stop_line_FS(dev, x, y, th) YPSpur_md_stop_line(dev, CS_FS, x, y, th)
49 #define Spur_md_stop_line_BS(dev, x, y, th) YPSpur_md_stop_line(dev, CS_BS, x, y, th)
50 #define Spur_md_stop_line_BL(dev, x, y, th) YPSpur_md_stop_line(dev, CS_BL, x, y, th)
51 
52 #define Spur_md_circle_GL(dev, x, y, d) YPSpur_md_circle(dev, CS_GL, x, y, d)
53 #define Spur_md_circle_LC(dev, x, y, d) YPSpur_md_circle(dev, CS_LC, x, y, d)
54 #define Spur_md_circle_FS(dev, x, y, d) YPSpur_md_circle(dev, CS_FS, x, y, d)
55 #define Spur_md_circle_BS(dev, x, y, d) YPSpur_md_circle(dev, CS_BS, x, y, d)
56 #define Spur_md_circle_BL(dev, x, y, d) YPSpur_md_circle(dev, CS_BL, x, y, d)
57 
58 #define Spur_md_spin_GL(dev, th) YPSpur_md_spin(dev, CS_GL, th)
59 #define Spur_md_spin_LC(dev, th) YPSpur_md_spin(dev, CS_LC, th)
60 #define Spur_md_spin_FS(dev, th) YPSpur_md_spin(dev, CS_FS, th)
61 #define Spur_md_spin_BS(dev, th) YPSpur_md_spin(dev, CS_BS, th)
62 #define Spur_md_spin_BL(dev, th) YPSpur_md_spin(dev, CS_BL, th)
63 
64 #define Spur_md_orient_GL(dev, th) YPSpur_md_orient(dev, CS_GL, th)
65 #define Spur_md_orient_LC(dev, th) YPSpur_md_orient(dev, CS_LC, th)
66 #define Spur_md_orient_FS(dev, th) YPSpur_md_orient(dev, CS_FS, th)
67 #define Spur_md_orient_BS(dev, th) YPSpur_md_orient(dev, CS_BS, th)
68 #define Spur_md_orient_BL(dev, th) YPSpur_md_orient(dev, CS_BL, th)
69 
70 #define Spur_md_set_pos_GL(dev, x, y, th) YPSpur_md_set_pos(dev, CS_GL, x, y, th)
71 #define Spur_md_set_pos_LC(dev, x, y, th) YPSpur_md_set_pos(dev, CS_LC, x, y, th)
72 #define Spur_md_set_pos_BL(dev, x, y, th) YPSpur_md_set_pos(dev, CS_BL, x, y, th)
73 
74 #define Spur_md_set_vel(dev, v) YPSpur_md_set_vel(dev, v)
75 #define Spur_md_set_angvel(dev, w) YPSpur_md_set_angvel(dev, w)
76 #define Spur_md_set_accel(dev, v) YPSpur_md_set_accel(dev, v)
77 #define Spur_md_set_angaccel(dev, w) YPSpur_md_set_angaccel(dev, w)
78 
79 #define Spur_md_adjust_pos_GL(dev, x, y, th) YPSpur_md_adjust_pos(dev, CS_GL, x, y, th)
80 #define Spur_md_adjust_pos_LC(dev, x, y, th) YPSpur_md_adjust_pos(dev, CS_LC, x, y, th)
81 #define Spur_md_adjust_pos_FS(dev, x, y, th) YPSpur_md_adjust_pos(dev, CS_FS, x, y, th)
82 #define Spur_md_adjust_pos_BS(dev, x, y, th) YPSpur_md_adjust_pos(dev, CS_BS, x, y, th)
83 #define Spur_md_adjust_pos_BL(dev, x, y, th) YPSpur_md_adjust_pos(dev, CS_BL, x, y, th)
84 
85 #define Spur_md_get_pos_GL(dev, x, y, th) YPSpur_md_get_pos(dev, CS_GL, x, y, th)
86 #define Spur_md_get_pos_LC(dev, x, y, th) YPSpur_md_get_pos(dev, CS_LC, x, y, th)
87 #define Spur_md_get_pos_BS(dev, x, y, th) YPSpur_md_get_pos(dev, CS_BS, x, y, th)
88 #define Spur_md_get_pos_BL(dev, x, y, th) YPSpur_md_get_pos(dev, CS_BL, x, y, th)
89 
90 #define Spur_md_get_vel(dev, v, w) YPSpur_md_get_vel(dev, v, w)
91 #define Spur_md_get_force(dev, trans, angular) YPSpur_md_get_force(dev, trans, angular)
92 
93 #define Spur_md_near_pos_GL(dev, x, y, r) YPSpur_md_near_pos(dev, CS_GL, x, y, r)
94 #define Spur_md_near_pos_LC(dev, x, y, r) YPSpur_md_near_pos(dev, CS_LC, x, y, r)
95 #define Spur_md_near_pos_BS(dev, x, y, r) YPSpur_md_near_pos(dev, CS_BS, x, y, r)
96 #define Spur_md_near_pos_BL(dev, x, y, r) YPSpur_md_near_pos(dev, CS_BL, x, y, r)
97 
98 #define Spur_md_near_ang_GL(dev, th, d) YPSpur_md_near_ang(dev, CS_GL, th, d)
99 #define Spur_md_near_ang_LC(dev, th, d) YPSpur_md_near_ang(dev, CS_LC, th, d)
100 #define Spur_md_near_ang_BS(dev, th, d) YPSpur_md_near_ang(dev, CS_BS, th, d)
101 #define Spur_md_near_ang_BL(dev, th, d) YPSpur_md_near_ang(dev, CS_BL, th, d)
102 
103 #define Spur_md_over_line_GL(dev, x, y, th) YPSpur_md_over_line(dev, CS_GL, x, y, th)
104 #define Spur_md_over_line_LC(dev, x, y, th) YPSpur_md_over_line(dev, CS_LC, x, y, th)
105 #define Spur_md_over_line_BS(dev, x, y, th) YPSpur_md_over_line(dev, CS_BS, x, y, th)
106 #define Spur_md_over_line_BL(dev, x, y, th) YPSpur_md_over_line(dev, CS_BL, x, y, th)
107 
108 #define Spur_md_vel(dev, v, w) YPSpur_md_vel(dev, v, w)
109 
110 #define Spur_md_tilt_GL(dev, d, t) YPSpur_md_tilt(dev, CS_GL, d, t)
111 #define Spur_md_tilt_LC(dev, d, t) YPSpur_md_tilt(dev, CS_LC, d, t)
112 #define Spur_md_tilt_FS(dev, d, t) YPSpur_md_tilt(dev, CS_FS, d, t)
113 #define Spur_md_tilt_BS(dev, d, t) YPSpur_md_tilt(dev, CS_BS, d, t)
114 #define Spur_md_tilt_BL(dev, d, t) YPSpur_md_tilt(dev, CS_BL, d, t)
115 
116 typedef struct
117 {
118  struct ipcmd_t dev;
119  int pid;
121 } YPSpur;
122 
124 int YPSpur_md_init(YPSpur *dev);
125 int YPSpur_md_initex(YPSpur *dev, int msq_key);
126 int YPSpur_md_init_socket(YPSpur *dev, char *ip, int port);
127 
129 int YPSpur_md_isfreeze(YPSpur *dev);
130 int YPSpur_md_freeze(YPSpur *dev);
131 int YPSpur_md_unfreeze(YPSpur *dev);
132 
134 int YPSpur_md_stop(YPSpur *dev);
135 int YPSpur_md_free(YPSpur *dev);
136 int YP_md_openfree(YPSpur *dev);
137 
139 int YPSpur_md_line(YPSpur *dev, int cs, double x, double y, double theta);
140 int YPSpur_md_stop_line(YPSpur *dev, int cs, double x, double y, double theta);
141 int YPSpur_md_circle(YPSpur *dev, int cs, double x, double y, double r);
142 int YPSpur_md_spin(YPSpur *dev, int cs, double theta);
143 int YPSpur_md_orient(YPSpur *dev, int cs, double theta);
144 
146 int YPSpur_md_set_pos(YPSpur *dev, int cs, double x, double y, double theta);
147 int YPSpur_md_adjust_pos(YPSpur *dev, int cs, double x, double y, double theta);
148 int YPSpur_md_set_vel(YPSpur *dev, double v);
149 int YPSpur_md_set_angvel(YPSpur *dev, double w);
150 int YPSpur_md_set_accel(YPSpur *dev, double v);
151 int YPSpur_md_set_angaccel(YPSpur *dev, double w);
152 
154 double YPSpur_md_get_pos(YPSpur *dev, int cs, double *x, double *y, double *theta);
155 double YPSpur_md_get_vel(YPSpur *dev, double *v, double *w);
156 double YPSpur_md_get_force(YPSpur *dev, double *trans, double *angular);
157 
159 int YPSpur_md_near_pos(YPSpur *dev, int cs, double x, double y, double r);
160 int YPSpur_md_near_ang(YPSpur *dev, int cs, double th, double d);
161 int YPSpur_md_over_line(YPSpur *dev, int cs, double x, double y, double theta);
162 
164 int YPSpur_md_vel(YPSpur *dev, double v, double w);
165 
167 int YPSpur_md_tilt(YPSpur *dev, int cs, double dir, double tilt);
168 
169 /* 裏コマンド集 */
170 int YP_md_get_error_state(YPSpur *dev);
171 
172 int YP_md_set_parameter(YPSpur *dev, int param_id, double value);
173 int YP_md_set_parameter_array(YPSpur *dev, int param_id, double *value);
174 int YP_md_get_parameter(YPSpur *dev, int param_id, double *value);
175 int YP_md_get_parameter_array(YPSpur *dev, int param_id, double *value);
176 int YP_md_set_control_state(YPSpur *dev, int control_id, int state);
177 
178 int YP_md_get_ad_value(YPSpur *dev, int num);
179 int YP_md_set_io_dir(YPSpur *dev, unsigned char dir);
180 int YP_md_set_io_data(YPSpur *dev, unsigned char data);
181 double YP_md_get_device_error_state(YPSpur *dev, int id, int *err);
182 int YP_md_wheel_vel(YPSpur *dev, double r, double l);
183 int YP_md_wheel_torque(YPSpur *dev, double r, double l);
184 double YP_md_get_wheel_vel(YPSpur *dev, double *wr, double *wl);
185 double YP_md_get_wheel_ang(YPSpur *dev, double *theta_r, double *theta_l);
186 double YP_md_get_wheel_torque(YPSpur *dev, double *torque_r, double *torque_l);
187 int YP_md_set_wheel_vel(YPSpur *dev, double r, double l);
188 int YP_md_set_wheel_accel(YPSpur *dev, double r, double l);
189 int YP_md_wheel_ang(YPSpur *dev, double r, double l);
190 double YP_md_get_vref(YPSpur *dev, double *vref, double *wref);
191 double YP_md_get_wheel_vref(YPSpur *dev, double *wrref, double *wlref);
192 
193 int YP_md_joint_torque(YPSpur *spur, int id, double t);
194 int YP_md_joint_vel(YPSpur *spur, int id, double v);
195 int YP_md_joint_ang(YPSpur *spur, int id, double a);
196 int YP_md_joint_ang_vel(YPSpur *spur, int id, double a, double v);
197 int YP_md_set_joint_accel(YPSpur *spur, int id, double a);
198 int YP_md_set_joint_vel(YPSpur *spur, int id, double v);
199 double YP_md_get_joint_vel(YPSpur *spur, int id, double *v);
200 double YP_md_get_joint_vref(YPSpur *spur, int id, double *v);
201 double YP_md_get_joint_ang(YPSpur *spur, int id, double *a);
202 double YP_md_get_joint_torque(YPSpur *spur, int id, double *t);
203 
204 #define YPSPUR_JOINT_SUPPORT 1
205 #define YPSPUR_JOINT_ANG_VEL_SUPPORT 1
206 #define YPSPUR_GET_DEVICE_ERROR_STATE_SUPPORT 1
207 
208 #ifdef __cplusplus
209 }
210 #endif // __cplusplus
211 #endif // YPSPUR_MD_H
int YPSpur_md_set_vel(YPSpur *dev, double v)
Definition: libypspur-md.c:359
int YPSpur_md_initex(YPSpur *dev, int msq_key)
Definition: libypspur-md.c:81
int YP_md_wheel_ang(YPSpur *dev, double r, double l)
int YPSpur_md_free(YPSpur *dev)
Definition: libypspur-md.c:277
int YPSpur_md_line(YPSpur *dev, int cs, double x, double y, double theta)
Definition: libypspur-md.c:114
int YP_md_joint_ang_vel(YPSpur *spur, int id, double a, double v)
int YPSpur_md_isfreeze(YPSpur *dev)
Definition: libypspur-md.c:704
double YP_md_get_joint_vel(YPSpur *spur, int id, double *v)
double YPSpur_md_get_pos(YPSpur *dev, int cs, double *x, double *y, double *theta)
Definition: libypspur-md.c:439
int YPSpur_md_freeze(YPSpur *dev)
Definition: libypspur-md.c:239
double YP_md_get_wheel_vel(YPSpur *dev, double *wr, double *wl)
Definition: libypspur-md.c:572
int YPSpur_md_orient(YPSpur *dev, int cs, double theta)
Definition: libypspur-md.c:200
int YPSpur_md_over_line(YPSpur *dev, int cs, double x, double y, double theta)
Definition: libypspur-md.c:966
int YPSpur_md_set_pos(YPSpur *dev, int cs, double x, double y, double theta)
Definition: libypspur-md.c:315
int YPSpur_md_set_accel(YPSpur *dev, double v)
Definition: libypspur-md.c:399
int YP_md_set_io_dir(YPSpur *dev, unsigned char dir)
int YPSpur_md_circle(YPSpur *dev, int cs, double x, double y, double r)
Definition: libypspur-md.c:158
int YP_md_wheel_torque(YPSpur *dev, double r, double l)
double YP_md_get_joint_torque(YPSpur *spur, int id, double *t)
int YP_md_set_parameter_array(YPSpur *dev, int param_id, double *value)
Definition: libypspur-md.c:778
static YPSpur spur
Definition: libypspur.c:42
double YP_md_get_joint_vref(YPSpur *spur, int id, double *v)
int YPSpur_md_near_ang(YPSpur *dev, int cs, double th, double d)
Definition: libypspur-md.c:935
int YP_md_set_io_data(YPSpur *dev, unsigned char data)
int YP_md_set_joint_accel(YPSpur *spur, int id, double a)
int YPSpur_md_stop_line(YPSpur *dev, int cs, double x, double y, double theta)
Definition: libypspur-md.c:136
int YP_md_wheel_vel(YPSpur *dev, double r, double l)
int connection_error
Definition: ypspur-md.h:120
double YPSpur_md_get_force(YPSpur *dev, double *trans, double *angular)
Definition: libypspur-md.c:671
int YP_md_get_ad_value(YPSpur *dev, int num)
Definition: libypspur-md.c:998
int YP_md_set_joint_vel(YPSpur *spur, int id, double v)
int YP_md_set_parameter(YPSpur *dev, int param_id, double value)
Definition: libypspur-md.c:756
int YPSpur_md_tilt(YPSpur *dev, int cs, double dir, double tilt)
Definition: libypspur-md.c:881
int YPSpur_md_init(YPSpur *dev)
Definition: libypspur-md.c:108
double YP_md_get_wheel_vref(YPSpur *dev, double *wrref, double *wlref)
Definition: libypspur-md.c:539
int YPSpur_md_near_pos(YPSpur *dev, int cs, double x, double y, double r)
Definition: libypspur-md.c:903
int YP_md_joint_ang(YPSpur *spur, int id, double a)
int YP_md_set_wheel_accel(YPSpur *dev, double r, double l)
double YPSpur_md_get_vel(YPSpur *dev, double *v, double *w)
Definition: libypspur-md.c:473
int YP_md_get_error_state(YPSpur *dev)
Definition: libypspur-md.c:43
int YP_md_get_parameter(YPSpur *dev, int param_id, double *value)
Definition: libypspur-md.c:800
double YP_md_get_wheel_ang(YPSpur *dev, double *theta_r, double *theta_l)
Definition: libypspur-md.c:605
double YP_md_get_wheel_torque(YPSpur *dev, double *torque_r, double *torque_l)
Definition: libypspur-md.c:638
int YP_md_set_wheel_vel(YPSpur *dev, double r, double l)
int pid
Definition: ypspur-md.h:119
int YP_md_get_parameter_array(YPSpur *dev, int param_id, double *value)
Definition: libypspur-md.c:829
int YPSpur_md_set_angaccel(YPSpur *dev, double w)
Definition: libypspur-md.c:419
int YPSpur_md_unfreeze(YPSpur *dev)
Definition: libypspur-md.c:258
double YP_md_get_device_error_state(YPSpur *dev, int id, int *err)
Definition: libypspur-md.c:48
double YP_md_get_vref(YPSpur *dev, double *vref, double *wref)
Definition: libypspur-md.c:506
int YPSpur_md_init_socket(YPSpur *dev, char *ip, int port)
Definition: libypspur-md.c:94
int state(YPSpur_state id)
Definition: param.c:64
int YPSpur_md_vel(YPSpur *dev, double v, double w)
Definition: libypspur-md.c:735
double YP_md_get_joint_ang(YPSpur *spur, int id, double *a)
int YPSpur_md_adjust_pos(YPSpur *dev, int cs, double x, double y, double theta)
Definition: libypspur-md.c:337
int YP_md_joint_torque(YPSpur *spur, int id, double t)
int YPSpur_md_set_angvel(YPSpur *dev, double w)
Definition: libypspur-md.c:379
int YP_md_openfree(YPSpur *dev)
Definition: libypspur-md.c:296
int YP_md_joint_vel(YPSpur *spur, int id, double v)
int YPSpur_md_spin(YPSpur *dev, int cs, double theta)
Definition: libypspur-md.c:180
int YPSpur_md_stop(YPSpur *dev)
Definition: libypspur-md.c:220
int YP_md_set_control_state(YPSpur *dev, int control_id, int state)
Definition: libypspur-md.c:860


yp-spur
Author(s):
autogenerated on Sat May 11 2019 02:08:24