Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 6, 2024
1 parent 40b591d commit b0b2523
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ DummyGearCmdPublisher::DummyGearCmdPublisher(const rclcpp::NodeOptions & node_op
// Subscriber

// Publisher
pub_gear_cmd_ = create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>(
"~/output/gear_cmd", 10);
pub_gear_cmd_ =
create_publisher<autoware_auto_vehicle_msgs::msg::GearCommand>("~/output/gear_cmd", 10);

// Service

// Client

// Timer
using namespace std::literals::chrono_literals;
timer_ = rclcpp::create_timer(
this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this));
timer_ =
rclcpp::create_timer(this, get_clock(), 1s, std::bind(&DummyGearCmdPublisher::onTimer, this));

// State

// Diagnostics

}

void DummyGearCmdPublisher::onTimer()
Expand Down
10 changes: 5 additions & 5 deletions dummy/dummy_gear_cmd_publisher/src/dummy_gear_cmd_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
#define DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
#ifndef DUMMY_GEAR_CMD_PUBLISHER_HPP_
#define DUMMY_GEAR_CMD_PUBLISHER_HPP_

// include
#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>
#include <rclcpp/rclcpp.hpp>

#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>

namespace dummy_gear_cmd_publisher
{

Expand Down Expand Up @@ -48,8 +49,7 @@ class DummyGearCmdPublisher : public rclcpp::Node
// State

// Diagnostics

};
} // namespace dummy_gear_cmd_publisher

#endif // DUMMY_GEAR_CMD_PUBLISHER__DUMMY_GEAR_CMD_PUBLISHER_HPP_
#endif // DUMMY_GEAR_CMD_PUBLISHER_HPP_
12 changes: 7 additions & 5 deletions launch/tier4_control_launch/launch/control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
from launch_ros.substitutions import FindPackageShare
import yaml


def get_control_cmd_topic(context):
is_redundant = LaunchConfiguration('launch_redundancy_system_components').perform(context)
system_run_mode = LaunchConfiguration('system_run_mode').perform(context)
is_redundant = LaunchConfiguration("launch_redundancy_system_components").perform(context)
system_run_mode = LaunchConfiguration("system_run_mode").perform(context)

if is_redundant.lower() == "true" and system_run_mode.lower() == "planning_simulation":
return "/main/control/command/control_cmd"
return "/control/command/control_cmd"

if is_redundant.lower() == 'true' and system_run_mode.lower() == 'planning_simulation':
return '/main/control/command/control_cmd'
return '/control/command/control_cmd'

def launch_setup(context, *args, **kwargs):
with open(LaunchConfiguration("vehicle_param_file").perform(context), "r") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ ControlCmdSwitcher::ControlCmdSwitcher(const rclcpp::NodeOptions & node_options)
: Node("control_cmd_switcher", node_options)
{
// Subscriber
sub_main_control_cmd_ =
create_subscription<autoware_control_msgs::msg::Control>(
"~/input/main/control_cmd", rclcpp::QoS{10},
std::bind(&ControlCmdSwitcher::onMainControlCmd, this, std::placeholders::_1));
sub_main_control_cmd_ = create_subscription<autoware_control_msgs::msg::Control>(
"~/input/main/control_cmd", rclcpp::QoS{10},
std::bind(&ControlCmdSwitcher::onMainControlCmd, this, std::placeholders::_1));

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

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

// Publisher
pub_control_cmd_ = create_publisher<autoware_control_msgs::msg::Control>(
"~/output/control_cmd", rclcpp::QoS{1});
pub_control_cmd_ =
create_publisher<autoware_control_msgs::msg::Control>("~/output/control_cmd", rclcpp::QoS{1});

// Initialize
use_main_control_cmd_ = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,16 @@ class ControlCmdSwitcher : public rclcpp::Node

private:
// Subscribers
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr
sub_main_control_cmd_;
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr
sub_sub_control_cmd_;
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr sub_main_control_cmd_;
rclcpp::Subscription<autoware_control_msgs::msg::Control>::SharedPtr sub_sub_control_cmd_;
rclcpp::Subscription<tier4_system_msgs::msg::ElectionStatus>::SharedPtr sub_election_status_main_;
rclcpp::Subscription<tier4_system_msgs::msg::ElectionStatus>::SharedPtr sub_election_status_sub_;
void onMainControlCmd(
const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
void onSubControlCmd(
const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
void onMainControlCmd(const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
void onSubControlCmd(const autoware_control_msgs::msg::Control::ConstSharedPtr msg);
void onElectionStatus(const tier4_system_msgs::msg::ElectionStatus::ConstSharedPtr msg);

// Publisher
rclcpp::Publisher<autoware_control_msgs::msg::Control>::SharedPtr
pub_control_cmd_;
rclcpp::Publisher<autoware_control_msgs::msg::Control>::SharedPtr pub_control_cmd_;

std::atomic<bool> use_main_control_cmd_;
};
Expand Down
5 changes: 3 additions & 2 deletions system/mrm_stop_operator/src/mrm_stop_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ MrmStopOperator::MrmStopOperator(const rclcpp::NodeOptions & node_options)
sub_velocity_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive, false);
rclcpp::SubscriptionOptions velocity_options = rclcpp::SubscriptionOptions();
velocity_options.callback_group = sub_velocity_group_;
auto not_executed_callback = []([[maybe_unused]] const typename autoware_vehicle_msgs::msg::
VelocityReport::ConstSharedPtr msg) {};
auto not_executed_callback =
[]([[maybe_unused]] const typename autoware_vehicle_msgs::msg::VelocityReport::ConstSharedPtr
msg) {};
sub_velocity_ = create_subscription<autoware_vehicle_msgs::msg::VelocityReport>(
"~/input/velocity", 10, not_executed_callback, velocity_options);

Expand Down
12 changes: 6 additions & 6 deletions system/redundancy_switcher_interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ The availability converter subscribes `/system/operation_mode/availability` and

### Interface

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

## mrm converter

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

## Parameters
Expand Down
8 changes: 6 additions & 2 deletions system/redundancy_switcher_interface/script/relay_to_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ def operation_mode_state_callback(self, msg):
if msg.mode == 2:
self.operation_mode_autonomous_state = True
if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state:
self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}")
self.get_logger().info(
f"Operation mode changed: {self.operation_mode_autonomous_state}"
)
else:
self.operation_mode_autonomous_state = False
if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state:
self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}")
self.get_logger().info(
f"Operation mode changed: {self.operation_mode_autonomous_state}"
)

def trajectory_callback(self, msg):
if self.autonomous_mode or self.operation_mode_autonomous_state == False:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ void AvailabilityConverter::setSubscriber()
node_->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive, false);
rclcpp::SubscriptionOptions control_mode_options = rclcpp::SubscriptionOptions();
control_mode_options.callback_group = control_mode_callback_group_;
auto not_executed_callback = []([[maybe_unused]] const typename autoware_vehicle_msgs::msg::
ControlModeReport::ConstSharedPtr msg) {};
auto not_executed_callback =
[]([[maybe_unused]] const typename autoware_vehicle_msgs::msg::ControlModeReport::ConstSharedPtr
msg) {};

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

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

void AvailabilityConverter::convertToUdp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class AvailabilityConverter
std::unique_ptr<UdpSender<Availability>> udp_availability_sender_;
rclcpp::CallbackGroup::SharedPtr availability_callback_group_;
rclcpp::CallbackGroup::SharedPtr control_mode_callback_group_;
rclcpp::Subscription<autoware_vehicle_msgs::msg::ControlModeReport>::SharedPtr
sub_control_mode_;
rclcpp::Subscription<autoware_vehicle_msgs::msg::ControlModeReport>::SharedPtr sub_control_mode_;
rclcpp::Subscription<tier4_system_msgs::msg::OperationModeAvailability>::SharedPtr
sub_operation_mode_availability_;
};
Expand Down

0 comments on commit b0b2523

Please sign in to comment.