37 std::lock_guard<std::mutex> lck(
_data_mut);
43 std::lock_guard<std::mutex> lck(
_data_mut);
50 const std::shared_ptr<PacmodTxMsg>& parser_class)
58 pacmod_msgs::SystemRptInt new_msg;
59 fillSystemRptInt(parser_class, &new_msg, frame_id);
68 pacmod_msgs::SystemRptFloat new_msg;
69 fillSystemRptFloat(parser_class, &new_msg, frame_id);
74 pacmod_msgs::GlobalRpt new_msg;
75 fillGlobalRpt(parser_class, &new_msg, frame_id);
80 pacmod_msgs::VehicleSpeedRpt new_msg;
81 fillVehicleSpeedRpt(parser_class, &new_msg, frame_id);
87 pacmod_msgs::MotorRpt1 new_msg;
88 fillMotorRpt1(parser_class, &new_msg, frame_id);
94 pacmod_msgs::MotorRpt2 new_msg;
95 fillMotorRpt2(parser_class, &new_msg, frame_id);
101 pacmod_msgs::MotorRpt3 new_msg;
102 fillMotorRpt3(parser_class, &new_msg, frame_id);
107 pacmod_msgs::WheelSpeedRpt new_msg;
108 fillWheelSpeedRpt(parser_class, &new_msg, frame_id);
113 pacmod_msgs::SteeringPIDRpt1 new_msg;
114 fillSteeringPIDRpt1(parser_class, &new_msg, frame_id);
119 pacmod_msgs::SteeringPIDRpt2 new_msg;
120 fillSteeringPIDRpt2(parser_class, &new_msg, frame_id);
125 pacmod_msgs::SteeringPIDRpt3 new_msg;
126 fillSteeringPIDRpt3(parser_class, &new_msg, frame_id);
131 pacmod_msgs::ParkingBrakeStatusRpt new_msg;
132 fillParkingBrakeStatusRpt(parser_class, &new_msg, frame_id);
137 pacmod_msgs::YawRateRpt new_msg;
138 fillYawRateRpt(parser_class, &new_msg, frame_id);
143 pacmod_msgs::LatLonHeadingRpt new_msg;
144 fillLatLonHeadingRpt(parser_class, &new_msg, frame_id);
149 pacmod_msgs::DateTimeRpt new_msg;
150 fillDateTimeRpt(parser_class, &new_msg, frame_id);
155 pacmod_msgs::SteeringPIDRpt4 new_msg;
156 fillSteeringPIDRpt4(parser_class, &new_msg, frame_id);
161 pacmod_msgs::VinRpt new_msg;
162 fillVinRpt(parser_class, &new_msg, frame_id);
168 pacmod_msgs::SystemRptInt* new_msg,
169 std::string frame_id)
171 auto dc_parser = std::dynamic_pointer_cast<
SystemRptIntMsg>(parser_class);
174 new_msg->command = dc_parser->command;
175 new_msg->output = dc_parser->output;
177 new_msg->header.frame_id = frame_id;
182 pacmod_msgs::SystemRptFloat* new_msg,
183 std::string frame_id)
188 new_msg->command = dc_parser->command;
189 new_msg->output = dc_parser->output;
191 new_msg->header.frame_id = frame_id;
196 pacmod_msgs::GlobalRpt* new_msg,
197 std::string frame_id)
199 auto dc_parser = std::dynamic_pointer_cast<
GlobalRptMsg>(parser_class);
201 new_msg->
enabled = dc_parser->enabled;
202 new_msg->override_active = dc_parser->override_active;
203 new_msg->user_can_timeout = dc_parser->user_can_timeout;
204 new_msg->brake_can_timeout = dc_parser->brake_can_timeout;
205 new_msg->steering_can_timeout = dc_parser->steering_can_timeout;
206 new_msg->vehicle_can_timeout = dc_parser->vehicle_can_timeout;
207 new_msg->user_can_read_errors = dc_parser->user_can_read_errors;
209 new_msg->header.frame_id = frame_id;
214 pacmod_msgs::VehicleSpeedRpt* new_msg,
215 std::string frame_id)
220 new_msg->vehicle_speed_valid = dc_parser->vehicle_speed_valid;
221 new_msg->vehicle_speed_raw[0] = dc_parser->vehicle_speed_raw[0];
222 new_msg->vehicle_speed_raw[1] = dc_parser->vehicle_speed_raw[1];
224 new_msg->header.frame_id = frame_id;
229 pacmod_msgs::MotorRpt1* new_msg,
230 std::string frame_id)
232 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt1Msg>(parser_class);
234 new_msg->
current = dc_parser->current;
235 new_msg->position = dc_parser->position;
237 new_msg->header.frame_id = frame_id;
242 pacmod_msgs::MotorRpt2* new_msg,
243 std::string frame_id)
245 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt2Msg>(parser_class);
248 new_msg->motor_temp = dc_parser->motor_temp;
249 new_msg->angular_velocity = dc_parser->velocity;
251 new_msg->header.frame_id = frame_id;
256 pacmod_msgs::MotorRpt3* new_msg,
257 std::string frame_id)
259 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt3Msg>(parser_class);
262 new_msg->torque_input = dc_parser->torque_input;
264 new_msg->header.frame_id = frame_id;
269 pacmod_msgs::WheelSpeedRpt* new_msg,
270 std::string frame_id)
275 new_msg->front_right_wheel_speed = dc_parser->front_right_wheel_speed;
276 new_msg->rear_left_wheel_speed = dc_parser->rear_left_wheel_speed;
277 new_msg->rear_right_wheel_speed = dc_parser->rear_right_wheel_speed;
279 new_msg->header.frame_id = frame_id;
284 pacmod_msgs::SteeringPIDRpt1* new_msg,
285 std::string frame_id)
289 new_msg->
dt = dc_parser->dt;
290 new_msg->Kp = dc_parser->Kp;
291 new_msg->Ki = dc_parser->Ki;
292 new_msg->Kd = dc_parser->Kd;
294 new_msg->header.frame_id = frame_id;
299 pacmod_msgs::SteeringPIDRpt2* new_msg,
300 std::string frame_id)
304 new_msg->
P_term = dc_parser->P_term;
305 new_msg->I_term = dc_parser->I_term;
306 new_msg->D_term = dc_parser->D_term;
307 new_msg->all_terms = dc_parser->all_terms;
309 new_msg->header.frame_id = frame_id;
314 pacmod_msgs::SteeringPIDRpt3* new_msg,
315 std::string frame_id)
320 new_msg->str_angle_desired = dc_parser->str_angle_desired;
321 new_msg->str_angle_actual = dc_parser->str_angle_actual;
322 new_msg->error = dc_parser->error;
324 new_msg->header.frame_id = frame_id;
329 pacmod_msgs::ParkingBrakeStatusRpt* new_msg,
330 std::string frame_id)
336 new_msg->header.frame_id = frame_id;
341 pacmod_msgs::YawRateRpt* new_msg,
342 std::string frame_id)
344 auto dc_parser = std::dynamic_pointer_cast<
YawRateRptMsg>(parser_class);
346 new_msg->
yaw_rate = dc_parser->yaw_rate;
348 new_msg->header.frame_id = frame_id;
353 pacmod_msgs::LatLonHeadingRpt* new_msg,
354 std::string frame_id)
359 new_msg->latitude_minutes = dc_parser->latitude_minutes;
360 new_msg->latitude_seconds = dc_parser->latitude_seconds;
361 new_msg->longitude_degrees = dc_parser->longitude_degrees;
362 new_msg->longitude_minutes = dc_parser->longitude_minutes;
363 new_msg->longitude_seconds = dc_parser->longitude_seconds;
364 new_msg->heading = dc_parser->heading;
366 new_msg->header.frame_id = frame_id;
371 pacmod_msgs::DateTimeRpt* new_msg,
372 std::string frame_id)
374 auto dc_parser = std::dynamic_pointer_cast<
DateTimeRptMsg>(parser_class);
376 new_msg->
year = dc_parser->year;
377 new_msg->month = dc_parser->month;
378 new_msg->day = dc_parser->day;
379 new_msg->hour = dc_parser->hour;
380 new_msg->minute = dc_parser->minute;
381 new_msg->second = dc_parser->second;
383 new_msg->header.frame_id = frame_id;
388 pacmod_msgs::SteeringPIDRpt4* new_msg,
389 std::string frame_id)
394 new_msg->angular_acceleration = dc_parser->angular_acceleration;
396 new_msg->header.frame_id = frame_id;
401 pacmod_msgs::VinRpt* new_msg,
402 std::string frame_id)
404 auto dc_parser = std::dynamic_pointer_cast<
VinRptMsg>(parser_class);
406 new_msg->
mfg_code = dc_parser->mfg_code;
407 new_msg->mfg = dc_parser->mfg;
408 new_msg->model_year_code = dc_parser->model_year_code;
409 new_msg->model_year = dc_parser->model_year;
410 new_msg->serial = dc_parser->serial;
412 new_msg->header.frame_id = frame_id;
417 const pacmod_msgs::PacmodCmd::ConstPtr& msg)
422 encoder.
encode(msg->ui16_cmd);
428 encoder.
encode(msg->ui16_cmd);
434 encoder.
encode(msg->f64_cmd);
440 encoder.
encode(msg->enable, msg->clear, msg->ignore);
446 encoder.
encode(msg->f64_cmd);
452 encoder.
encode(msg->ui16_cmd);
458 encoder.
encode(msg->ui16_cmd);
464 encoder.
encode(msg->ui16_cmd);
470 const pacmod_msgs::PositionWithSpeed::ConstPtr& msg)
472 std::vector<uint8_t> ret_vec;
477 encoder.
encode(msg->angular_position, msg->angular_velocity_limit);
void fillWheelSpeedRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::WheelSpeedRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
void encode(uint8_t horn_cmd)
double front_left_wheel_speed
static const int64_t CAN_ID
void publish(const boost::shared_ptr< M > &message) const
void fillLatLonHeadingRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::LatLonHeadingRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillMotorRpt3(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::MotorRpt3 *new_msg, std::string frame_id)
static std::vector< uint8_t > unpackAndEncode(const int64_t &can_id, const pacmod_msgs::PacmodCmd::ConstPtr &msg)
static const int64_t CAN_ID
void fillSteeringPIDRpt1(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt1 *new_msg, std::string frame_id)
static const int64_t CAN_ID
void fillVehicleSpeedRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::VehicleSpeedRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillSteeringPIDRpt2(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt2 *new_msg, std::string frame_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
void fillMotorRpt2(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::MotorRpt2 *new_msg, std::string frame_id)
void fillMotorRpt1(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::MotorRpt1 *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
std::vector< unsigned char > _data
void encode(double accel_cmd)
std::vector< uint8_t > data
void encode(uint8_t wiper_cmd)
std::vector< unsigned char > getData() const
void fillSystemRptInt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SystemRptInt *new_msg, std::string frame_id)
void fillDateTimeRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::DateTimeRpt *new_msg, std::string frame_id)
void fillSystemRptFloat(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SystemRptFloat *new_msg, std::string frame_id)
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
static const int64_t CAN_ID
void encode(uint8_t headlight_cmd)
static const int64_t CAN_ID
bool parking_brake_engaged
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillYawRateRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::YawRateRpt *new_msg, std::string frame_id)
void fillSteeringPIDRpt4(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt4 *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
void setData(std::vector< unsigned char > new_data)
static const int64_t CAN_ID
void fillVinRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::VinRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillGlobalRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::GlobalRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
void setIsValid(bool valid)
void fillSteeringPIDRpt3(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt3 *new_msg, std::string frame_id)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillAndPublish(const int64_t &can_id, std::string frame_id, const ros::Publisher &pub, const std::shared_ptr< PacmodTxMsg > &parser_class)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void fillParkingBrakeStatusRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::ParkingBrakeStatusRpt *new_msg, std::string frame_id)
static const int64_t CAN_ID
void encode(bool enable, bool clear_override, bool ignore_overide)