Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shift_decider): integrate generate_parameter_library #8871

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions control/autoware_shift_decider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ project(autoware_shift_decider)
find_package(autoware_cmake REQUIRED)
autoware_package()

generate_parameter_library(shift_decider_parameters
param/shift_decider_parameters.yaml
)

ament_auto_add_library(${PROJECT_NAME}_node SHARED
src/${PROJECT_NAME}.cpp
)

target_link_libraries(${PROJECT_NAME}_node
shift_decider_parameters
)

rclcpp_components_register_node(${PROJECT_NAME}_node
PLUGIN "autoware::shift_decider::ShiftDecider"
EXECUTABLE ${PROJECT_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define AUTOWARE__SHIFT_DECIDER__AUTOWARE_SHIFT_DECIDER_HPP_

#include "autoware/universe_utils/ros/polling_subscriber.hpp"
#include "shift_decider_parameters.hpp"

#include <rclcpp/rclcpp.hpp>

Expand Down Expand Up @@ -58,7 +59,8 @@ class ShiftDecider : public rclcpp::Node
autoware_vehicle_msgs::msg::GearReport::ConstSharedPtr current_gear_ptr_;
uint8_t prev_shift_command = autoware_vehicle_msgs::msg::GearCommand::PARK;

bool park_on_goal_;
std::shared_ptr<::shift_decider::ParamListener> param_listener_;
::shift_decider::Params param_;
};
} // namespace autoware::shift_decider

Expand Down
1 change: 1 addition & 0 deletions control/autoware_shift_decider/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<depend>autoware_system_msgs</depend>
<depend>autoware_universe_utils</depend>
<depend>autoware_vehicle_msgs</depend>
<depend>generate_parameter_library</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
shift_decider:
park_on_goal:
type: bool
description: Whether to put the gear in park when vehicle reaches the goal.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
rclcpp::QoS durable_qos(queue_size);
durable_qos.transient_local();

park_on_goal_ = declare_parameter<bool>("park_on_goal");
param_listener_ =
std::make_shared<::shift_decider::ParamListener>(this->get_node_parameters_interface());
param_ = param_listener_->get_params();

Check warning on line 36 in control/autoware_shift_decider/src/autoware_shift_decider.cpp

View check run for this annotation

Codecov / codecov/patch

control/autoware_shift_decider/src/autoware_shift_decider.cpp#L35-L36

Added lines #L35 - L36 were not covered by tests

pub_shift_cmd_ =
create_publisher<autoware_vehicle_msgs::msg::GearCommand>("output/gear_cmd", durable_qos);
Expand Down Expand Up @@ -71,7 +73,7 @@
if (
(autoware_state_->state == AutowareState::ARRIVED_GOAL ||
autoware_state_->state == AutowareState::WAITING_FOR_ROUTE) &&
park_on_goal_) {
param_.park_on_goal) {

Check warning on line 76 in control/autoware_shift_decider/src/autoware_shift_decider.cpp

View check run for this annotation

Codecov / codecov/patch

control/autoware_shift_decider/src/autoware_shift_decider.cpp#L76

Added line #L76 was not covered by tests
shift_cmd_.command = GearCommand::PARK;
} else {
shift_cmd_.command = current_gear_ptr_->report;
Expand Down
Loading