18
18
#include < string>
19
19
#include < utility>
20
20
21
- ControlCmdSwitcher::ControlCmdSwitcher (const rclcpp::NodeOptions & node_options) : Node(" control_cmd_switcher" , node_options)
21
+ ControlCmdSwitcher::ControlCmdSwitcher (const rclcpp::NodeOptions & node_options)
22
+ : Node(" control_cmd_switcher" , node_options)
22
23
{
23
24
// Subscriber
24
- sub_main_control_cmd_ = create_subscription<autoware_auto_control_msgs::msg::AckermannControlCommand>(
25
- " ~/input/main/control_cmd" , rclcpp::QoS{10 }, std::bind (&ControlCmdSwitcher::onMainControlCmd, this , std::placeholders::_1));
25
+ sub_main_control_cmd_ =
26
+ create_subscription<autoware_auto_control_msgs::msg::AckermannControlCommand>(
27
+ " ~/input/main/control_cmd" , rclcpp::QoS{10 },
28
+ std::bind (&ControlCmdSwitcher::onMainControlCmd, this , std::placeholders::_1));
26
29
27
- sub_sub_control_cmd_ = create_subscription<autoware_auto_control_msgs::msg::AckermannControlCommand>(
28
- " ~/input/sub/control_cmd" , rclcpp::QoS{10 }, std::bind (&ControlCmdSwitcher::onSubControlCmd, this , std::placeholders::_1));
30
+ sub_sub_control_cmd_ =
31
+ create_subscription<autoware_auto_control_msgs::msg::AckermannControlCommand>(
32
+ " ~/input/sub/control_cmd" , rclcpp::QoS{10 },
33
+ std::bind (&ControlCmdSwitcher::onSubControlCmd, this , std::placeholders::_1));
29
34
30
35
sub_election_status = create_subscription<tier4_system_msgs::msg::ElectionStatus>(
31
- " ~/input/election/status" , rclcpp::QoS{10 }, std::bind (&ControlCmdSwitcher::onElectionStatus, this , std::placeholders::_1));
36
+ " ~/input/election/status" , rclcpp::QoS{10 },
37
+ std::bind (&ControlCmdSwitcher::onElectionStatus, this , std::placeholders::_1));
32
38
// Publisher
33
39
pub_control_cmd_ = create_publisher<autoware_auto_control_msgs::msg::AckermannControlCommand>(
34
40
" ~/output/control_cmd" , rclcpp::QoS{1 });
@@ -37,21 +43,24 @@ ControlCmdSwitcher::ControlCmdSwitcher(const rclcpp::NodeOptions & node_options)
37
43
use_main_control_cmd_ = true ;
38
44
}
39
45
40
- void ControlCmdSwitcher::onMainControlCmd (const autoware_auto_control_msgs::msg::AckermannControlCommand::ConstSharedPtr msg)
46
+ void ControlCmdSwitcher::onMainControlCmd (
47
+ const autoware_auto_control_msgs::msg::AckermannControlCommand::ConstSharedPtr msg)
41
48
{
42
49
if (use_main_control_cmd_) {
43
50
pub_control_cmd_->publish (*msg);
44
51
}
45
52
}
46
53
47
- void ControlCmdSwitcher::onSubControlCmd (const autoware_auto_control_msgs::msg::AckermannControlCommand::ConstSharedPtr msg)
54
+ void ControlCmdSwitcher::onSubControlCmd (
55
+ const autoware_auto_control_msgs::msg::AckermannControlCommand::ConstSharedPtr msg)
48
56
{
49
57
if (!use_main_control_cmd_) {
50
58
pub_control_cmd_->publish (*msg);
51
59
}
52
60
}
53
61
54
- void ControlCmdSwitcher::onElectionStatus (const tier4_system_msgs::msg::ElectionStatus::ConstSharedPtr msg)
62
+ void ControlCmdSwitcher::onElectionStatus (
63
+ const tier4_system_msgs::msg::ElectionStatus::ConstSharedPtr msg)
55
64
{
56
65
if (((msg->path_info >> 3 ) & 0x01 ) == 1 ) {
57
66
use_main_control_cmd_ = true ;
@@ -62,4 +71,3 @@ void ControlCmdSwitcher::onElectionStatus(const tier4_system_msgs::msg::Election
62
71
63
72
#include < rclcpp_components/register_node_macro.hpp>
64
73
RCLCPP_COMPONENTS_REGISTER_NODE (ControlCmdSwitcher)
65
-
0 commit comments