Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ ExternalVelocityLimitSelectorNode::ExternalVelocityLimitSelectorNode(
"input/velocity_limit_clear_command_from_internal", rclcpp::QoS{10}.transient_local(),
std::bind(&ExternalVelocityLimitSelectorNode::onVelocityLimitClearCommand, this, _1));

// Output
pub_external_velocity_limit_ =
this->create_publisher<VelocityLimit>("output/external_velocity_limit", 1);
// Output. transient_local so a subscriber that starts later still receives max_vel.
pub_external_velocity_limit_ = this->create_publisher<VelocityLimit>(
"output/external_velocity_limit", rclcpp::QoS{1}.transient_local());

pub_debug_string_ = this->create_publisher<StringStamped>("output/debug", 1);

// Params
param_listener_ = std::make_shared<::external_velocity_limit_selector::ParamListener>(
this->get_node_parameters_interface());
updateVelocityLimit();
publishVelocityLimit(getCurrentVelocityLimit());
}

void ExternalVelocityLimitSelectorNode::onVelocityLimitFromAPI(
Expand Down Expand Up @@ -228,6 +230,7 @@ void ExternalVelocityLimitSelectorNode::clearVelocityLimit(const std::string & s
{
if (velocity_limit_table_.empty()) {
RCLCPP_WARN(get_logger(), "no velocity limit has been set from internal.");
updateVelocityLimit();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def setUp(self):
)

def wait_for_output(self):
self.msg_buffer_ = None
while not self.msg_buffer_:
rclpy.spin_once(self.test_node, timeout_sec=0.1)
self.velocity_limit_output_ = self.msg_buffer_
Expand Down Expand Up @@ -136,8 +137,8 @@ def test_external_velocity_limit_selector_node(self):
clear_cmd = VelocityLimitClearCommand(command=True)
self.pub_clear_limit_.publish(clear_cmd)
self.wait_for_output()
# velocity limit is 0 before any limit is set
self.assertEqual(self.velocity_limit_output_.max_velocity, 0.0)
# no sender has published a limit, so the output is the configured max_vel
self.assertEqual(self.velocity_limit_output_.max_velocity, 15.0)

# Send velocity limits
# new API velocity limit: higher than the node param -> limit is set to the param value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ struct TrajectoryModifierContext
: vehicle_info(autoware::vehicle_info_utils::VehicleInfoUtils(*node).getVehicleInfo()),
tf_buffer{node->get_clock()},
tf_listener{tf_buffer},
external_limit_sub{node, "~/input/external_velocity_limit_mps", rclcpp::QoS{1}},
external_limit_sub{
node, "~/input/external_velocity_limit_mps", rclcpp::QoS{1}.transient_local()},
external_limit_clear_sub{
node, "~/input/velocity_limit_clear_command", rclcpp::QoS{10}.transient_local()}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void TrajectoryVelocityOptimizer::initialize(

sub_planning_velocity_ =
std::make_shared<autoware_utils_rclcpp::InterProcessPollingSubscriber<VelocityLimit>>(
node_ptr, "~/input/external_velocity_limit_mps", rclcpp::QoS{1});
node_ptr, "~/input/external_velocity_limit_mps", rclcpp::QoS{1}.transient_local());

pub_velocity_limit_ = node_ptr->create_publisher<VelocityLimit>(
"~/output/current_velocity_limit_mps", rclcpp::QoS{1}.transient_local());
Expand Down