Skip to content

Commit b0b2523

Browse files
style(pre-commit): autofix
1 parent 40b591d commit b0b2523

File tree

10 files changed

+50
-52
lines changed

10 files changed

+50
-52
lines changed

dummy/dummy_gear_cmd_publisher/src/dummy_gear_cmd_publisher.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,21 @@ DummyGearCmdPublisher::DummyGearCmdPublisher(const rclcpp::NodeOptions & node_op
2525
// Subscriber
2626

2727
// Publisher
28-
pub_gear_cmd_ = create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>(
29-
"~/output/gear_cmd", 10);
28+
pub_gear_cmd_ =
29+
create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>("~/output/gear_cmd", 10);
3030

3131
// Service
3232

3333
// Client
3434

3535
// Timer
3636
using namespace std::literals::chrono_literals;
37-
timer_ = rclcpp::create_timer(
38-
this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this));
37+
timer_ =
38+
rclcpp::create_timer(this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this));
3939

4040
// State
4141

4242
// Diagnostics
43-
4443
}
4544

4645
void DummyGearCmdPublisher::onTimer()

dummy/dummy_gear_cmd_publisher/src/dummy_gear_cmd_publisher.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
16-
#define DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
15+
#ifndef DUMMY_GEAR_CMD_PUBLISHER_HPP_
16+
#define DUMMY_GEAR_CMD_PUBLISHER_HPP_
1717

1818
// include
19-
#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>
2019
#include <rclcpp/rclcpp.hpp>
2120

21+
#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>
22+
2223
namespace dummy_gear_cmd_publisher
2324
{
2425

@@ -48,8 +49,7 @@ class DummyGearCmdPublisher : public rclcpp::Node
4849
// State
4950

5051
// Diagnostics
51-
5252
};
5353
} // namespace dummy_gear_cmd_publisher
5454

55-
#endif // DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
55+
#endif // DUMMY_GEAR_CMD_PUBLISHER_HPP_

launch/tier4_control_launch/launch/control.launch.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
from launch_ros.substitutions import FindPackageShare
3131
import yaml
3232

33+
3334
def get_control_cmd_topic(context):
34-
is_redundant = LaunchConfiguration('launch_redundancy_system_components').perform(context)
35-
system_run_mode = LaunchConfiguration('system_run_mode').perform(context)
35+
is_redundant = LaunchConfiguration("launch_redundancy_system_components").perform(context)
36+
system_run_mode = LaunchConfiguration("system_run_mode").perform(context)
37+
38+
if is_redundant.lower() == "true" and system_run_mode.lower() == "planning_simulation":
39+
return "/main/control/command/control_cmd"
40+
return "/control/command/control_cmd"
3641

37-
if is_redundant.lower() == 'true' and system_run_mode.lower() == 'planning_simulation':
38-
return '/main/control/command/control_cmd'
39-
return '/control/command/control_cmd'
4042

4143
def launch_setup(context, *args, **kwargs):
4244
with open(LaunchConfiguration("vehicle_param_file").perform(context), "r") as f:

system/control_cmd_switcher/src/control_cmd_switcher/control_cmd_switcher.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ ControlCmdSwitcher::ControlCmdSwitcher(const rclcpp::NodeOptions & node_options)
2222
: Node("control_cmd_switcher", node_options)
2323
{
2424
// Subscriber
25-
sub_main_control_cmd_ =
26-
create_subscription<autoware_control_msgs::msg::Control>(
27-
"~/input/main/control_cmd", rclcpp::QoS{10},
28-
std::bind(&ControlCmdSwitcher::onMainControlCmd, this, std::placeholders::_1));
25+
sub_main_control_cmd_ = create_subscription<autoware_control_msgs::msg::Control>(
26+
"~/input/main/control_cmd", rclcpp::QoS{10},
27+
std::bind(&ControlCmdSwitcher::onMainControlCmd, this, std::placeholders::_1));
2928

30-
sub_sub_control_cmd_ =
31-
create_subscription<autoware_control_msgs::msg::Control>(
32-
"~/input/sub/control_cmd", rclcpp::QoS{10},
33-
std::bind(&ControlCmdSwitcher::onSubControlCmd, this, std::placeholders::_1));
29+
sub_sub_control_cmd_ = create_subscription<autoware_control_msgs::msg::Control>(
30+
"~/input/sub/control_cmd", rclcpp::QoS{10},
31+
std::bind(&ControlCmdSwitcher::onSubControlCmd, this, std::placeholders::_1));
3432

3533
sub_election_status_main_ = create_subscription<tier4_system_msgs::msg::ElectionStatus>(
3634
"~/input/election/status/main", rclcpp::QoS{10},
@@ -41,8 +39,8 @@ ControlCmdSwitcher::ControlCmdSwitcher(const rclcpp::NodeOptions & node_options)
4139
std::bind(&ControlCmdSwitcher::onElectionStatus, this, std::placeholders::_1));
4240

4341
// Publisher
44-
pub_control_cmd_ = create_publisher<autoware_control_msgs::msg::Control>(
45-
"~/output/control_cmd", rclcpp::QoS{1});
42+
pub_control_cmd_ =
43+
create_publisher<autoware_control_msgs::msg::Control>("~/output/control_cmd", rclcpp::QoS{1});
4644

4745
// Initialize
4846
use_main_control_cmd_ = true;

system/control_cmd_switcher/src/control_cmd_switcher/control_cmd_switcher.hpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,16 @@ class ControlCmdSwitcher : public rclcpp::Node
3434

3535
private:
3636
// Subscribers
37-
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr
38-
sub_main_control_cmd_;
39-
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr
40-
sub_sub_control_cmd_;
37+
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr sub_main_control_cmd_;
38+
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr sub_sub_control_cmd_;
4139
rclcpp::Subscription<tier4_system_msgs::msg::ElectionStatus>::SharedPtr sub_election_status_main_;
4240
rclcpp::Subscription<tier4_system_msgs::msg::ElectionStatus>::SharedPtr sub_election_status_sub_;
43-
void onMainControlCmd(
44-
const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
45-
void onSubControlCmd(
46-
const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
41+
void onMainControlCmd(const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
42+
void onSubControlCmd(const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
4743
void onElectionStatus(const tier4_system_msgs::msg::ElectionStatus::ConstSharedPtr msg);
4844

4945
// Publisher
50-
rclcpp::Publisher<autoware_control_msgs::msg::Control>::SharedPtr
51-
pub_control_cmd_;
46+
rclcpp::Publisher<autoware_control_msgs::msg::Control>::SharedPtr pub_control_cmd_;
5247

5348
std::atomic<bool> use_main_control_cmd_;
5449
};

system/mrm_stop_operator/src/mrm_stop_operator.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ MrmStopOperator::MrmStopOperator(const rclcpp::NodeOptions & node_options)
3333
sub_velocity_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive, false);
3434
rclcpp::SubscriptionOptions velocity_options = rclcpp::SubscriptionOptions();
3535
velocity_options.callback_group = sub_velocity_group_;
36-
auto not_executed_callback = []([[maybe_unused]] const typename autoware_vehicle_msgs::msg::
37-
VelocityReport::ConstSharedPtr msg) {};
36+
auto not_executed_callback =
37+
[]([[maybe_unused]] const typename autoware_vehicle_msgs::msg::VelocityReport::ConstSharedPtr
38+
msg) {};
3839
sub_velocity_ = create_subscription<autoware_vehicle_msgs::msg::VelocityReport>(
3940
"~/input/velocity", 10, not_executed_callback, velocity_options);
4041

system/redundancy_switcher_interface/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ The availability converter subscribes `/system/operation_mode/availability` and
1010

1111
### Interface
1212

13-
| Interface Type | Interface Name | Data Type | Description |
14-
| -------------- | ------------------------------------- | -------------------------------------------------- | ----------------------------- |
15-
| subscriber | `/system/operation_mode/availability` | `tier4_system_msgs/msg/OperationModeAvailability` | Usable behavior of the ego. |
16-
| subscriber | `/vehicle/status/mrm_state` | `autoware_vehicle_msgs/msg/ControlModeReport` | Ego control mode. |
17-
| udp sender | none | `struct Availability` | Combination of the above two. |
13+
| Interface Type | Interface Name | Data Type | Description |
14+
| -------------- | ------------------------------------- | ------------------------------------------------- | ----------------------------- |
15+
| subscriber | `/system/operation_mode/availability` | `tier4_system_msgs/msg/OperationModeAvailability` | Usable behavior of the ego. |
16+
| subscriber | `/vehicle/status/mrm_state` | `autoware_vehicle_msgs/msg/ControlModeReport` | Ego control mode. |
17+
| udp sender | none | `struct Availability` | Combination of the above two. |
1818

1919
## mrm converter
2020

@@ -42,7 +42,7 @@ The log converter receive udp packets into a structure called `ElectionCommuni
4242
| udp receiver | none | `struct ElectionCommunication` | messages among election nodes. |
4343
| udp receiver | none | `struct ElectionStatus` | Leader Election status. |
4444
| publisher | `/system/election/communication` | `tier4_system_msgs/msg/ElectionCommunication` | messages among election nodes. |
45-
| publisher | `/system/election/status` | `autoware_adapi_v1_msgs/msg/MrmState` | Leader Election status. |
45+
| publisher | `/system/election/status` | `autoware_adapi_v1_msgs/msg/MrmState` | Leader Election status. |
4646
| publisher | `/system/fail_safe/over_all/mrm_state` | `autoware_adapi_v1_msgs/msg/mrm_state` | System-wide MRM status. |
4747

4848
## Parameters

system/redundancy_switcher_interface/script/relay_to_sub.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ def operation_mode_state_callback(self, msg):
5555
if msg.mode == 2:
5656
self.operation_mode_autonomous_state = True
5757
if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state:
58-
self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}")
58+
self.get_logger().info(
59+
f"Operation mode changed: {self.operation_mode_autonomous_state}"
60+
)
5961
else:
6062
self.operation_mode_autonomous_state = False
6163
if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state:
62-
self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}")
64+
self.get_logger().info(
65+
f"Operation mode changed: {self.operation_mode_autonomous_state}"
66+
)
6367

6468
def trajectory_callback(self, msg):
6569
if self.autonomous_mode or self.operation_mode_autonomous_state == False:

system/redundancy_switcher_interface/src/common/converter/availability_converter.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ void AvailabilityConverter::setSubscriber()
4343
node_->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive, false);
4444
rclcpp::SubscriptionOptions control_mode_options = rclcpp::SubscriptionOptions();
4545
control_mode_options.callback_group = control_mode_callback_group_;
46-
auto not_executed_callback = []([[maybe_unused]] const typename autoware_vehicle_msgs::msg::
47-
ControlModeReport::ConstSharedPtr msg) {};
46+
auto not_executed_callback =
47+
[]([[maybe_unused]] const typename autoware_vehicle_msgs::msg::ControlModeReport::ConstSharedPtr
48+
msg) {};
4849

4950
sub_operation_mode_availability_ =
5051
node_->create_subscription<tier4_system_msgs::msg::OperationModeAvailability>(
5152
"~/input/operation_mode_availability", qos,
5253
std::bind(&AvailabilityConverter::convertToUdp, this, std::placeholders::_1),
5354
availability_options);
5455

55-
sub_control_mode_ =
56-
node_->create_subscription<autoware_vehicle_msgs::msg::ControlModeReport>(
57-
"~/input/control_mode", qos, not_executed_callback, control_mode_options);
56+
sub_control_mode_ = node_->create_subscription<autoware_vehicle_msgs::msg::ControlModeReport>(
57+
"~/input/control_mode", qos, not_executed_callback, control_mode_options);
5858
}
5959

6060
void AvailabilityConverter::convertToUdp(

system/redundancy_switcher_interface/src/common/converter/availability_converter.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ class AvailabilityConverter
5656
std::unique_ptr<UdpSender<Availability>> udp_availability_sender_;
5757
rclcpp::CallbackGroup::SharedPtr availability_callback_group_;
5858
rclcpp::CallbackGroup::SharedPtr control_mode_callback_group_;
59-
rclcpp::Subscription<autoware_vehicle_msgs::msg::ControlModeReport>::SharedPtr
60-
sub_control_mode_;
59+
rclcpp::Subscription<autoware_vehicle_msgs::msg::ControlModeReport>::SharedPtr sub_control_mode_;
6160
rclcpp::Subscription<tier4_system_msgs::msg::OperationModeAvailability>::SharedPtr
6261
sub_operation_mode_availability_;
6362
};

0 commit comments

Comments
 (0)