56 std::lock_guard<std::mutex> lck(
_data_mut);
62 std::lock_guard<std::mutex> lck(
_data_mut);
69 const std::shared_ptr<PacmodTxMsg>& parser_class)
77 pacmod_msgs::SystemRptInt new_msg;
78 fillSystemRptInt(parser_class, &new_msg, frame_id);
87 pacmod_msgs::SystemRptFloat new_msg;
88 fillSystemRptFloat(parser_class, &new_msg, frame_id);
93 pacmod_msgs::GlobalRpt new_msg;
94 fillGlobalRpt(parser_class, &new_msg, frame_id);
99 pacmod_msgs::VehicleSpeedRpt new_msg;
100 fillVehicleSpeedRpt(parser_class, &new_msg, frame_id);
106 pacmod_msgs::MotorRpt1 new_msg;
107 fillMotorRpt1(parser_class, &new_msg, frame_id);
113 pacmod_msgs::MotorRpt2 new_msg;
114 fillMotorRpt2(parser_class, &new_msg, frame_id);
120 pacmod_msgs::MotorRpt3 new_msg;
121 fillMotorRpt3(parser_class, &new_msg, frame_id);
126 pacmod_msgs::WheelSpeedRpt new_msg;
127 fillWheelSpeedRpt(parser_class, &new_msg, frame_id);
132 pacmod_msgs::SteeringPIDRpt1 new_msg;
133 fillSteeringPIDRpt1(parser_class, &new_msg, frame_id);
138 pacmod_msgs::SteeringPIDRpt2 new_msg;
139 fillSteeringPIDRpt2(parser_class, &new_msg, frame_id);
144 pacmod_msgs::SteeringPIDRpt3 new_msg;
145 fillSteeringPIDRpt3(parser_class, &new_msg, frame_id);
150 pacmod_msgs::ParkingBrakeStatusRpt new_msg;
151 fillParkingBrakeStatusRpt(parser_class, &new_msg, frame_id);
156 pacmod_msgs::YawRateRpt new_msg;
157 fillYawRateRpt(parser_class, &new_msg, frame_id);
162 pacmod_msgs::LatLonHeadingRpt new_msg;
163 fillLatLonHeadingRpt(parser_class, &new_msg, frame_id);
168 pacmod_msgs::DateTimeRpt new_msg;
169 fillDateTimeRpt(parser_class, &new_msg, frame_id);
174 pacmod_msgs::SteeringPIDRpt4 new_msg;
175 fillSteeringPIDRpt4(parser_class, &new_msg, frame_id);
180 pacmod_msgs::VinRpt new_msg;
181 fillVinRpt(parser_class, &new_msg, frame_id);
187 pacmod_msgs::SystemRptInt* new_msg,
188 std::string frame_id)
190 auto dc_parser = std::dynamic_pointer_cast<
SystemRptIntMsg>(parser_class);
193 new_msg->command = dc_parser->command;
194 new_msg->output = dc_parser->output;
196 new_msg->header.frame_id = frame_id;
201 pacmod_msgs::SystemRptFloat* new_msg,
202 std::string frame_id)
207 new_msg->command = dc_parser->command;
208 new_msg->output = dc_parser->output;
210 new_msg->header.frame_id = frame_id;
215 pacmod_msgs::GlobalRpt* new_msg,
216 std::string frame_id)
218 auto dc_parser = std::dynamic_pointer_cast<
GlobalRptMsg>(parser_class);
220 new_msg->
enabled = dc_parser->enabled;
221 new_msg->override_active = dc_parser->override_active;
222 new_msg->user_can_timeout = dc_parser->user_can_timeout;
223 new_msg->brake_can_timeout = dc_parser->brake_can_timeout;
224 new_msg->steering_can_timeout = dc_parser->steering_can_timeout;
225 new_msg->vehicle_can_timeout = dc_parser->vehicle_can_timeout;
226 new_msg->user_can_read_errors = dc_parser->user_can_read_errors;
228 new_msg->header.frame_id = frame_id;
233 pacmod_msgs::VehicleSpeedRpt* new_msg,
234 std::string frame_id)
239 new_msg->vehicle_speed_valid = dc_parser->vehicle_speed_valid;
240 new_msg->vehicle_speed_raw[0] = dc_parser->vehicle_speed_raw[0];
241 new_msg->vehicle_speed_raw[1] = dc_parser->vehicle_speed_raw[1];
243 new_msg->header.frame_id = frame_id;
248 pacmod_msgs::MotorRpt1* new_msg,
249 std::string frame_id)
251 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt1Msg>(parser_class);
253 new_msg->
current = dc_parser->current;
254 new_msg->position = dc_parser->position;
256 new_msg->header.frame_id = frame_id;
261 pacmod_msgs::MotorRpt2* new_msg,
262 std::string frame_id)
264 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt2Msg>(parser_class);
267 new_msg->motor_temp = dc_parser->motor_temp;
268 new_msg->angular_velocity = dc_parser->velocity;
270 new_msg->header.frame_id = frame_id;
275 pacmod_msgs::MotorRpt3* new_msg,
276 std::string frame_id)
278 auto dc_parser = std::dynamic_pointer_cast<
MotorRpt3Msg>(parser_class);
281 new_msg->torque_input = dc_parser->torque_input;
283 new_msg->header.frame_id = frame_id;
288 pacmod_msgs::WheelSpeedRpt* new_msg,
289 std::string frame_id)
294 new_msg->front_right_wheel_speed = dc_parser->front_right_wheel_speed;
295 new_msg->rear_left_wheel_speed = dc_parser->rear_left_wheel_speed;
296 new_msg->rear_right_wheel_speed = dc_parser->rear_right_wheel_speed;
298 new_msg->header.frame_id = frame_id;
303 pacmod_msgs::SteeringPIDRpt1* new_msg,
304 std::string frame_id)
308 new_msg->
dt = dc_parser->dt;
309 new_msg->kp = dc_parser->kp;
310 new_msg->ki = dc_parser->ki;
311 new_msg->kd = dc_parser->kd;
313 new_msg->header.frame_id = frame_id;
318 pacmod_msgs::SteeringPIDRpt2* new_msg,
319 std::string frame_id)
323 new_msg->
p_term = dc_parser->p_term;
324 new_msg->i_term = dc_parser->i_term;
325 new_msg->d_term = dc_parser->d_term;
326 new_msg->all_terms = dc_parser->all_terms;
328 new_msg->header.frame_id = frame_id;
333 pacmod_msgs::SteeringPIDRpt3* new_msg,
334 std::string frame_id)
339 new_msg->str_angle_desired = dc_parser->str_angle_desired;
340 new_msg->str_angle_actual = dc_parser->str_angle_actual;
341 new_msg->error = dc_parser->error;
343 new_msg->header.frame_id = frame_id;
348 pacmod_msgs::ParkingBrakeStatusRpt* new_msg,
349 std::string frame_id)
355 new_msg->header.frame_id = frame_id;
360 pacmod_msgs::YawRateRpt* new_msg,
361 std::string frame_id)
363 auto dc_parser = std::dynamic_pointer_cast<
YawRateRptMsg>(parser_class);
365 new_msg->
yaw_rate = dc_parser->yaw_rate;
367 new_msg->header.frame_id = frame_id;
372 pacmod_msgs::LatLonHeadingRpt* new_msg,
373 std::string frame_id)
378 new_msg->latitude_minutes = dc_parser->latitude_minutes;
379 new_msg->latitude_seconds = dc_parser->latitude_seconds;
380 new_msg->longitude_degrees = dc_parser->longitude_degrees;
381 new_msg->longitude_minutes = dc_parser->longitude_minutes;
382 new_msg->longitude_seconds = dc_parser->longitude_seconds;
383 new_msg->heading = dc_parser->heading;
385 new_msg->header.frame_id = frame_id;
390 pacmod_msgs::DateTimeRpt* new_msg,
391 std::string frame_id)
393 auto dc_parser = std::dynamic_pointer_cast<
DateTimeRptMsg>(parser_class);
395 new_msg->
year = dc_parser->year;
396 new_msg->month = dc_parser->month;
397 new_msg->day = dc_parser->day;
398 new_msg->hour = dc_parser->hour;
399 new_msg->minute = dc_parser->minute;
400 new_msg->second = dc_parser->second;
402 new_msg->header.frame_id = frame_id;
407 pacmod_msgs::SteeringPIDRpt4* new_msg,
408 std::string frame_id)
413 new_msg->angular_acceleration = dc_parser->angular_acceleration;
415 new_msg->header.frame_id = frame_id;
420 pacmod_msgs::VinRpt* new_msg,
421 std::string frame_id)
423 auto dc_parser = std::dynamic_pointer_cast<
VinRptMsg>(parser_class);
425 new_msg->
mfg_code = dc_parser->mfg_code;
426 new_msg->mfg = dc_parser->mfg;
427 new_msg->model_year_code = dc_parser->model_year_code;
428 new_msg->model_year = dc_parser->model_year;
429 new_msg->serial = dc_parser->serial;
431 new_msg->header.frame_id = frame_id;
436 const pacmod_msgs::PacmodCmd::ConstPtr& msg)
441 encoder.
encode(msg->ui16_cmd);
447 encoder.
encode(msg->ui16_cmd);
453 encoder.
encode(msg->f64_cmd);
459 encoder.
encode(msg->enable, msg->clear, msg->ignore);
465 encoder.
encode(msg->f64_cmd);
471 encoder.
encode(msg->ui16_cmd);
477 encoder.
encode(msg->ui16_cmd);
483 encoder.
encode(msg->ui16_cmd);
489 const pacmod_msgs::PositionWithSpeed::ConstPtr& msg)
491 std::vector<uint8_t> ret_vec;
496 encoder.
encode(msg->angular_position, msg->angular_velocity_limit);
void fillSteeringPIDRpt3(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt3 *new_msg, std::string frame_id)
static const int64_t CAN_ID
void fillSteeringPIDRpt1(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt1 *new_msg, std::string frame_id)
double front_left_wheel_speed
void fillSystemRptInt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SystemRptInt *new_msg, std::string frame_id)
void setIsValid(bool valid)
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 encode(uint8_t turn_signal_cmd)
static const int64_t CAN_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
void encode(double steer_pos, double steer_spd)
static const int64_t CAN_ID
void fillMotorRpt1(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::MotorRpt1 *new_msg, std::string frame_id)
void fillVinRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::VinRpt *new_msg, std::string frame_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 fillWheelSpeedRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::WheelSpeedRpt *new_msg, std::string frame_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
static const int64_t CAN_ID
static const int64_t CAN_ID
void encode(double accel_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
std::vector< unsigned char > _data
std::vector< uint8_t > data
void encode(uint8_t horn_cmd)
void fillGlobalRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::GlobalRpt *new_msg, std::string frame_id)
std::vector< unsigned char > getData() const
void publish(const boost::shared_ptr< M > &message) const
static std::vector< uint8_t > unpackAndEncode(const int64_t &can_id, const pacmod_msgs::PacmodCmd::ConstPtr &msg)
static const int64_t CAN_ID
static const int64_t CAN_ID
static const int64_t CAN_ID
void encode(uint8_t shift_cmd)
static const int64_t CAN_ID
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 fillLatLonHeadingRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::LatLonHeadingRpt *new_msg, std::string frame_id)
void fillMotorRpt2(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::MotorRpt2 *new_msg, std::string frame_id)
void encode(double brake_cmd)
static const int64_t CAN_ID
void encode(bool enable, bool clear_override, bool ignore_overide)
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 fillSystemRptFloat(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SystemRptFloat *new_msg, std::string frame_id)
void encode(uint8_t wiper_cmd)
static const int64_t CAN_ID
void encode(uint8_t headlight_cmd)
void fillDateTimeRpt(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::DateTimeRpt *new_msg, std::string frame_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 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
void fillSteeringPIDRpt2(const std::shared_ptr< PacmodTxMsg > &parser_class, pacmod_msgs::SteeringPIDRpt2 *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 setData(std::vector< unsigned char > new_data)