58 return std::shared_ptr<PacmodTxMsg>(
new ShiftRptMsg);
61 return std::shared_ptr<PacmodTxMsg>(
new AccelRptMsg);
67 return std::shared_ptr<PacmodTxMsg>(
new BrakeRptMsg);
70 return std::shared_ptr<PacmodTxMsg>(
new SteerRptMsg);
97 return std::shared_ptr<PacmodTxMsg>(
new HornRptMsg);
133 return std::shared_ptr<PacmodTxMsg>(
new WiperRptMsg);
136 return std::shared_ptr<PacmodTxMsg>(
new VinRptMsg);
146 enabled = in[0] & 0x01;
147 override_active = ((in[0] & 0x02) >> 1) != 0;
148 user_can_timeout = ((in[0] & 0x20) >> 5) != 0;
149 brake_can_timeout = ((in[0] & 0x10) >> 4) != 0;
150 steering_can_timeout = ((in[0] & 0x08) >> 3) != 0;
151 vehicle_can_timeout = ((in[0] & 0x04) >> 2) != 0;
152 user_can_read_errors = ((in[6] << 8) | in[7]);
157 std::ostringstream oss;
158 oss << in[0] << in[1] << in[2];
159 mfg_code = oss.str();
161 if (mfg_code ==
"52C")
162 mfg =
"POLARIS INDUSTRIES INC.";
163 else if (mfg_code ==
"3HS")
164 mfg =
"NAVISTAR, INC.";
165 else if (mfg_code ==
"2T2")
166 mfg =
"TOYOTA MOTOR MANUFACTURING CANADA";
168 model_year_code = in[3];
170 if (model_year_code >=
'1' && model_year_code <=
'9')
172 model_year = 2000 + model_year_code;
174 else if (model_year_code >=
'A' && model_year_code <
'Z')
176 switch (model_year_code)
244 serial = (in[4] & 0x0F);
245 serial = (serial << 8) | in[5];
246 serial = (serial << 8) | in[6];
251 manual_input = in[0];
260 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
261 manual_input =
static_cast<double>(temp / 1000.0);
263 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
264 command =
static_cast<double>(temp / 1000.0);
266 temp = (
static_cast<int16_t
>(in[4]) << 8) | in[5];
267 output =
static_cast<double>(temp / 1000.0);
274 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
275 vehicle_speed =
static_cast<double>(temp / 100.0);
277 vehicle_speed_valid = (in[2] == 1);
278 vehicle_speed_raw[0] = in[3];
279 vehicle_speed_raw[1] = in[4];
286 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
287 yaw_rate =
static_cast<double>(temp / 100.0);
292 latitude_degrees =
static_cast<int8_t
>(in[0]);
293 latitude_minutes = in[1];
294 latitude_seconds = in[2];
295 longitude_degrees =
static_cast<int8_t
>(in[3]);
296 longitude_minutes = in[4];
297 longitude_seconds = in[5];
298 heading = ((
static_cast<int16_t
>(in[6]) << 8) | in[7]) / 100.0;
315 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
316 front_left_wheel_speed =
static_cast<double>(temp / 100.0);
318 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
319 front_right_wheel_speed =
static_cast<double>(temp / 100.0);
321 temp = (
static_cast<int16_t
>(in[4]) << 8) | in[5];
322 rear_left_wheel_speed =
static_cast<double>(temp / 100.0);
324 temp = (
static_cast<int16_t
>(in[6]) << 8) | in[7];
325 rear_right_wheel_speed =
static_cast<double>(temp / 100.0);
332 temp = (
static_cast<int32_t
>(in[0]) << 24) |
333 (
static_cast<int32_t
>(in[1]) << 16) |
334 (
static_cast<int32_t
>(in[2]) << 8) | in[3];
335 current =
static_cast<double>(temp / 1000.0);
337 temp = (
static_cast<int32_t
>(in[4]) << 24) |
338 (
static_cast<int32_t
>(in[5]) << 16) |
339 (
static_cast<int32_t
>(in[6]) << 8) | in[7];
340 position =
static_cast<double>(temp / 1000.0);
348 temp16 = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
349 encoder_temp =
static_cast<double>(temp16);
351 temp16 = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
352 motor_temp =
static_cast<double>(temp16);
354 temp32 = (
static_cast<int32_t
>(in[7]) << 24) |
355 (
static_cast<int32_t
>(in[6]) << 16) |
356 (
static_cast<int32_t
>(in[5]) << 8) | in[4];
357 velocity =
static_cast<double>(temp32 / 1000.0);
364 temp = (
static_cast<int32_t
>(in[0]) << 24) |
365 (
static_cast<int32_t
>(in[1]) << 16) |
366 (
static_cast<int32_t
>(in[2]) << 8) | in[3];
367 torque_output =
static_cast<double>(temp / 1000.0);
369 temp = (
static_cast<int32_t
>(in[4]) << 24) |
370 (
static_cast<int32_t
>(in[5]) << 16) |
371 (
static_cast<int32_t
>(in[6]) << 8) | in[7];
372 torque_input =
static_cast<double>(temp / 1000.0);
379 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
380 dt =
static_cast<double>(temp / 1000.0);
382 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
383 Kp =
static_cast<double>(temp / 1000.0);
385 temp = (
static_cast<int16_t
>(in[4]) << 8) | in[5];
386 Ki =
static_cast<double>(temp / 1000.0);
388 temp = (
static_cast<int16_t
>(in[6]) << 8) | in[7];
389 Kd =
static_cast<double>(temp / 1000.0);
396 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
397 P_term =
static_cast<double>(temp / 1000.0);
399 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
400 I_term =
static_cast<double>(temp / 1000.0);
402 temp = (
static_cast<int16_t
>(in[4]) << 8) | in[5];
403 D_term =
static_cast<double>(temp / 1000.0);
405 temp = (
static_cast<int16_t
>(in[6]) << 8) | in[7];
406 all_terms =
static_cast<double>(temp / 1000.0);
413 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
414 new_torque =
static_cast<double>(temp / 1000.0);
416 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
417 str_angle_desired =
static_cast<double>(temp / 1000.0);
419 temp = (
static_cast<int16_t
>(in[4]) << 8) | in[5];
420 str_angle_actual =
static_cast<double>(temp / 1000.0);
422 temp = (
static_cast<int16_t
>(in[6]) << 8) | in[7];
423 error =
static_cast<double>(temp / 1000.0);
430 temp = (
static_cast<int16_t
>(in[0]) << 8) | in[1];
431 angular_velocity =
static_cast<double>(temp / 1000.0);
433 temp = (
static_cast<int16_t
>(in[2]) << 8) | in[3];
434 angular_acceleration =
static_cast<double>(temp / 1000.0);
439 parking_brake_engaged = (in[0] == 0x01);
458 data[0] = turn_signal_cmd;
464 data[0] = headlight_cmd;
488 uint16_t cmdInt =
static_cast<uint16_t
>(accel_cmd * 1000.0);
489 data[0] = (cmdInt & 0xFF00) >> 8;
490 data[1] = cmdInt & 0x00FF;
496 int32_t raw_pos =
static_cast<int32_t
>(1000.0 * steer_pos);
497 uint32_t raw_spd = (uint32_t)(1000.0 * steer_spd);
499 data[0] = (raw_pos & 0xFF000000) >> 24;
500 data[1] = (raw_pos & 0x00FF0000) >> 16;
501 data[2] = (raw_pos & 0x0000FF00) >> 8;
502 data[3] = raw_pos & 0x000000FF;
503 data[4] = (raw_spd & 0xFF000000) >> 24;
504 data[5] = (raw_spd & 0x00FF0000) >> 16;
505 data[6] = (raw_spd & 0x0000FF00) >> 8;
506 data[7] = raw_spd & 0x000000FF;
512 uint16_t raw_pct =
static_cast<uint16_t
>(1000.0 * brake_pct);
514 data[0] = (raw_pct & 0xFF00) >> 8;
515 data[1] = (raw_pct & 0x00FF);
static const int64_t CAN_ID
void encode(uint8_t horn_cmd)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void encode(double steer_pos, double steer_spd)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void encode(double accel_cmd)
void encode(uint8_t wiper_cmd)
void encode(double brake_cmd)
void encode(uint8_t turn_signal_cmd)
void encode(uint8_t shift_cmd)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
ROSLIB_DECL std::string command(const std::string &cmd)
static const int64_t CAN_ID
void encode(uint8_t headlight_cmd)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
static std::shared_ptr< PacmodTxMsg > make_message(const int64_t &can_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void encode(bool enable, bool clear_override, bool ignore_overide)