26 #endif // HAVE_CONFIG_H 45 SSM_sid g_odm_bs_sid = 0, g_odm_sid = 0, g_motor_sid = 0, g_odm_adj_sid = 0, g_ad_sid = 0;
47 int g_ssm_adj_enable = 0;
71 if (!(g_odm_bs_sid && g_odm_sid && g_motor_sid && g_ad_sid))
86 releaseSSM(&g_odm_bs_sid);
87 releaseSSM(&g_odm_sid);
88 releaseSSM(&g_motor_sid);
89 releaseSSM(&g_ad_sid);
90 releaseSSM(&g_odm_adj_sid);
110 time_offset = receive_count - odometry_updated + 1;
111 for (i = 0; i < odometry_updated; i++)
115 odm.
x = odm_log[i].
x;
116 odm.
y = odm_log[i].
y;
118 odm.
v = odm_log[i].
v;
119 odm.
w = odm_log[i].
w;
120 writeSSM(g_odm_bs_sid, &odm, time);
123 writeSSM(g_odm_sid, &odm, time);
126 time_offset = receive_count - readdata_num + 1;
127 for (i = 0; i < readdata_num; i++)
134 memcpy(ad.
ad, ad_log[i],
sizeof(
int) * 8);
135 writeSSM(g_motor_sid, &motor, time);
136 writeSSM(g_ad_sid, &ad, time);
146 static double before_time;
147 double now_time, time;
148 Odometry bs_odometry, adj_odometry, target_pos;
153 if (!g_ssm_adj_enable)
156 if (now_time > before_time + 1)
159 if (g_odm_adj_sid > 0)
161 g_ssm_adj_enable = 1;
166 g_ssm_adj_enable = 0;
168 before_time = now_time;
174 pthread_mutex_lock(&spur->
mutex);
176 if ((tid = readSSM(g_odm_adj_sid, (
char *)&adj_odometry, &now_time, -1)) >= 0)
181 if ((tid = readSSM_time(g_odm_bs_sid, (
char *)&bs_odometry, now_time, &time)) >= 0)
185 bs_cs.
x = bs_odometry.
x;
186 bs_cs.
y = bs_odometry.
y;
188 adj_cs.
x = adj_odometry.
x;
189 adj_cs.
y = adj_odometry.
y;
198 double data[3] = { target_pos.
x, target_pos.
y, target_pos.
theta };
204 pthread_mutex_unlock(&spur->
mutex);
void init_ypspurSSM(int ssm_id)
void coordinate_synchronize(Odometry *odm, SpurUserParamsPtr spur)
void inv_trans_cs(CSptr target_cs, double *x, double *y, double *theta)
void trans_cs(CSptr target_cs, double *x, double *y, double *theta)
void CS_recursive_trans(CSptr target_cs, CSptr now_cs, double *x, double *y, double *theta)
void set_adjust_com(int cs, double *data, SpurUserParamsPtr spur)
CSptr get_cs_pointer(YPSpur_cs cs)
void write_ypspurSSM(int odometry_updated, int receive_count, Odometry *odm_log, int readdata_num, Short_2Char *cnt1_log, Short_2Char *cnt2_log, Short_2Char *pwm1_log, Short_2Char *pwm2_log, int ad_log[][8])
void yprintf(ParamOutputLv level, const char *format,...)
double time_estimate(int readnum)
時刻の推定 (n回目の計測結果の時刻を計算する)