Skip to content

Commit

Permalink
[AMRSW-621] add callback for mainboard_messenger topic
Browse files Browse the repository at this point in the history
  • Loading branch information
sdswoops824 authored and MIURA Yasuyuki committed Feb 19, 2024
1 parent 8b77eb8 commit 31e782b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lexxpluss_apps/src/rosserial_board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ros_board {
nh.subscribe(sub_emergency);
nh.subscribe(sub_poweroff);
nh.subscribe(sub_lexxhard);
nh.subscribe(sub_messenger);
msg_fan.data = msg_fan_data;
msg_fan.data_length = sizeof msg_fan_data / sizeof msg_fan_data[0];
msg_bumper.data = msg_bumper_data;
Expand Down Expand Up @@ -120,6 +121,10 @@ class ros_board {
while (k_msgq_put(&can_controller::msgq_control, &ros2board, K_NO_WAIT) != 0)
k_msgq_purge(&can_controller::msgq_control);
}
void callback_messenger(const std_msgs::Bool &req) {
while (k_msgq_put(&can_controller::msgq_control, &ros2board, K_NO_WAIT) != 0)
k_msgq_purge(&can_controller::msgq_control);
}
std_msgs::UInt8MultiArray msg_fan;
std_msgs::ByteMultiArray msg_bumper;
std_msgs::Bool msg_emergency;
Expand All @@ -143,6 +148,9 @@ class ros_board {
ros::Subscriber<std_msgs::String, ros_board> sub_lexxhard{
"/lexxhard/setup", &ros_board::callback_lexxhard, this
};
ros::Subscriber<std_msgs::Bool, ros_board> sub_messenger{
"/lexxhard/mainboard_messenger_heartbeat", &ros_board::callback_messenger, this
};
};

}
Expand Down

0 comments on commit 31e782b

Please sign in to comment.