command.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 COMMAND_H
22 #define COMMAND_H
23 
24 #include <ipcommunication.h>
25 #include <ypparam.h>
26 #include <ypspur.h>
27 
28 typedef enum
29 {
31  RUN_FREE = 0,
42 } SpurRunMode;
43 
44 typedef enum
45 {
53 
55 typedef struct _spur_user_params
56 {
57  double dv;
58  double dw;
59  double v;
60  double w;
61  double vref;
62  double wref;
63  double vref_smooth;
64  double wref_smooth;
66  double x;
67  double y;
78  double theta;
79  double radius;
80  double tilt;
81  double dir;
82  double control_dt;
83  int freeze;
88  pthread_mutex_t mutex;
90 
91 void init_spur_command(void);
92 void command(void);
93 void message_return(struct ipcmd_t *ipcmd, long retpid, YPSpur_msg *res_msg);
94 
95 void init_command_thread(pthread_t *thread);
96 SpurUserParamsPtr get_spur_user_param_ptr();
97 
98 /* command_run.c */
99 void line_com(int cs, double *data, SpurUserParamsPtr spur);
100 void stop_line_com(int cs, double *data, SpurUserParamsPtr spur);
101 void circle_com(int cs, double *data, SpurUserParamsPtr spur);
102 void spin_com(int cs, double *data, SpurUserParamsPtr spur);
103 void orient_com(int cs, double *data, SpurUserParamsPtr spur);
104 void stop_com(double *data, SpurUserParamsPtr spur);
105 void free_com(double *data, SpurUserParamsPtr spur);
106 void openfree_com(double *data, SpurUserParamsPtr spur);
107 void vel_com(double *data, SpurUserParamsPtr spur);
108 void wheel_vel_com(double *data, SpurUserParamsPtr spur);
109 void wheel_angle_com(double *data, SpurUserParamsPtr spur);
110 
111 /* command_set.c */
112 void set_pos_com(int cs, double *data, SpurUserParamsPtr spur);
113 void set_GL_on_GL_com(double *data, SpurUserParamsPtr spur);
114 void set_adjust_com(int cs, double *data, SpurUserParamsPtr spur);
115 void set_vel_com(double *data, SpurUserParamsPtr spur);
116 void set_ang_accel_com(double *data, SpurUserParamsPtr spur);
117 void set_accel_com(double *data, SpurUserParamsPtr spur);
118 void set_ang_vel_com(double *data, SpurUserParamsPtr spur);
119 void set_tilt_com(int cs, double *data, SpurUserParamsPtr spur);
120 void set_torque_com(double *data, SpurUserParamsPtr spur);
121 void set_wheel_vel_com(double *data, SpurUserParamsPtr spur);
122 void set_wheel_accel_com(double *data, SpurUserParamsPtr spur);
123 
124 /* command_get.c */
125 void get_pos_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
126 void get_vel_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
127 void get_vref_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
128 void get_wheel_vref_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
129 int near_pos_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
130 int near_ang_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
131 int over_line_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
132 void get_wheel_vel_com(double *data, double *resdata, SpurUserParamsPtr spur);
133 void get_wheel_ang_com(double *data, double *resdata, SpurUserParamsPtr spur);
134 void get_force_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
135 void get_wheel_torque_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur);
136 
137 /* command_param.c */
138 void param_set_com(int cs, double *data, SpurUserParamsPtr spur);
139 int param_get_com(int cs, double *resdata, SpurUserParamsPtr spur);
140 void param_state_com(int cs, double *data, SpurUserParamsPtr spur);
141 
142 /* command_ad.c */
143 void get_ad_com(double *data, double *resdata);
144 void set_io_dir_com(double *data, double *resdata);
145 void set_io_data_com(double *data, double *resdata);
146 void get_error_state_com(double *data, double *resdata);
147 
148 void joint_torque_com(int id, double *data, SpurUserParamsPtr spur);
149 void joint_vel_com(int id, double *data, SpurUserParamsPtr spur);
150 void joint_ang_com(int id, double *data, SpurUserParamsPtr spur);
151 void joint_ang_vel_com(int id, double *data, SpurUserParamsPtr spur);
152 void set_joint_accel_com(int id, double *data, SpurUserParamsPtr spur);
153 void set_joint_vel_com(int id, double *data, SpurUserParamsPtr spur);
154 void get_joint_vel_com(int id, double *data, SpurUserParamsPtr spur);
155 void get_joint_vref_com(int id, double *data, SpurUserParamsPtr spur);
156 void get_joint_ang_com(int id, double *data, SpurUserParamsPtr spur);
157 void get_joint_torque_com(int id, double *data, SpurUserParamsPtr spur);
158 
159 #endif // COMMAND_H
void free_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:129
void set_io_data_com(double *data, double *resdata)
Definition: command_aux.c:64
MotorControlMode wheel_mode_prev[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:77
SpurRunMode run_mode
Definition: command.h:85
double wheel_vel_end[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:75
void set_ang_accel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:161
void set_wheel_accel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:184
void param_state_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_param.c:93
void get_joint_torque_com(int id, double *data, SpurUserParamsPtr spur)
double control_dt
Definition: command.h:82
double wvelref[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:65
void set_joint_accel_com(int id, double *data, SpurUserParamsPtr spur)
Definition: command_joint.c:92
double theta
Definition: command.h:78
void set_torque_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:136
double torque[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:68
void init_command_thread(pthread_t *thread)
Definition: command.c:462
void get_wheel_vel_com(double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:122
double wheel_accel[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:71
void set_adjust_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_set.c:91
void get_wheel_vref_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:61
struct _spur_user_params SpurUserParams
void command(void)
Definition: command.c:87
void param_set_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_param.c:51
void set_GL_on_GL_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:80
void set_pos_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_set.c:49
MotorControlMode
Definition: command.h:44
MotorControlMode wheel_mode[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:76
void set_tilt_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_set.c:170
double radius
Definition: command.h:79
void joint_vel_com(int id, double *data, SpurUserParamsPtr spur)
Definition: command_joint.c:58
void init_spur_command(void)
Definition: command.c:68
void wheel_vel_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:146
static YPSpur spur
Definition: libypspur.c:42
int near_pos_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:148
double wheel_angle[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:74
void get_error_state_com(double *data, double *resdata)
Definition: command_aux.c:72
void get_vref_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:72
void get_pos_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:48
int over_line_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:199
SpurRunMode
Definition: command.h:28
int near_ang_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:173
double wheel_vel[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:72
void get_wheel_ang_com(double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:135
void spin_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_run.c:96
void get_ad_com(double *data, double *resdata)
Definition: command_aux.c:48
void line_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_run.c:48
SpurUserParamsPtr get_spur_user_param_ptr()
Definition: command.c:53
void set_accel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:152
void get_vel_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:83
#define YP_PARAM_MAX_MOTOR_NUM
Definition: ypparam.h:430
void wheel_angle_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:153
SpurRunMode before_run_mode
Definition: command.h:87
double grav_torque[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:70
int param_get_com(int cs, double *resdata, SpurUserParamsPtr spur)
Definition: command_param.c:60
void set_io_dir_com(double *data, double *resdata)
Definition: command_aux.c:56
void set_vel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:127
void joint_ang_vel_com(int id, double *data, SpurUserParamsPtr spur)
Definition: command_joint.c:80
pthread_mutex_t mutex
Definition: command.h:88
void set_joint_vel_com(int id, double *data, SpurUserParamsPtr spur)
void get_force_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:96
double vref_smooth
Definition: command.h:63
void message_return(struct ipcmd_t *ipcmd, long retpid, YPSpur_msg *res_msg)
Definition: command.c:453
void circle_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_run.c:80
void get_joint_ang_com(int id, double *data, SpurUserParamsPtr spur)
void stop_line_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_run.c:64
void set_ang_vel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:143
double torque_prev[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:69
void joint_ang_com(int id, double *data, SpurUserParamsPtr spur)
Definition: command_joint.c:69
double wref_smooth
Definition: command.h:64
void vel_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:139
void joint_torque_com(int id, double *data, SpurUserParamsPtr spur)
Definition: command_joint.c:47
void stop_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:124
void get_joint_vref_com(int id, double *data, SpurUserParamsPtr spur)
struct _spur_user_params * SpurUserParamsPtr
Definition: command.h:54
void get_joint_vel_com(int id, double *data, SpurUserParamsPtr spur)
void get_wheel_torque_com(int cs, double *data, double *resdata, SpurUserParamsPtr spur)
Definition: command_get.c:109
void set_wheel_vel_com(double *data, SpurUserParamsPtr spur)
Definition: command_set.c:190
double wheel_vel_smooth[YP_PARAM_MAX_MOTOR_NUM]
Definition: command.h:73
void orient_com(int cs, double *data, SpurUserParamsPtr spur)
Definition: command_run.c:110
void openfree_com(double *data, SpurUserParamsPtr spur)
Definition: command_run.c:134


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