Skip to content

Commit

Permalink
configurize the speed_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
t4-adc committed Mar 5, 2025
1 parent 355d053 commit 815dd9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions external/concealer/include/concealer/publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ struct NormalDistribution<nav_msgs::msg::Odometry>

std::mt19937_64 engine;

double speed_threshold;

struct Error
{
std::normal_distribution<double> additive, multiplicative;
Expand Down
5 changes: 3 additions & 2 deletions external/concealer/src/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NormalDistribution<nav_msgs::msg::Odometry>::NormalDistribution(
}
}()),
engine(seed ? seed : device()),
speed_threshold(getParameter<double>(node, topic + ".nav_msgs::msg::Odometry.speed_threshold")),
position_local_x_error(node, topic + ".nav_msgs::msg::Odometry.pose.pose.position.local_x.error"),
position_local_y_error(node, topic + ".nav_msgs::msg::Odometry.pose.pose.position.local_y.error"),
position_local_z_error(node, topic + ".nav_msgs::msg::Odometry.pose.pose.position.local_z.error"),
Expand All @@ -54,10 +55,10 @@ auto NormalDistribution<nav_msgs::msg::Odometry>::operator()(nav_msgs::msg::Odom
const Eigen::Quaterniond orientation = Eigen::Quaterniond(
odometry.pose.pose.orientation.w, odometry.pose.pose.orientation.x,
odometry.pose.pose.orientation.y, odometry.pose.pose.orientation.z);
// calculate the speed

const double speed = std::hypot(
odometry.twist.twist.linear.x, odometry.twist.twist.linear.y, odometry.twist.twist.linear.z);
if (speed < 0.1) {
if (speed < speed_threshold) {
return odometry;
}

Expand Down
1 change: 1 addition & 0 deletions test_runner/scenario_test_runner/config/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
version: 20240605 # architecture_type suffix (mandatory)
seed: 0 # If 0 is specified, a random seed value will be generated for each run.
nav_msgs::msg::Odometry:
speed_threshold: 0.1
pose:
pose:
position:
Expand Down

0 comments on commit 815dd9e

Please sign in to comment.