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

fix(vehicle_velocity_converter): simpify parameter inputs #1727

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
9 changes: 5 additions & 4 deletions sensing/vehicle_velocity_converter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ This package converts autoware_auto_vehicle_msgs::msg::VehicleReport message to

## Parameters

| Name | Type | Description |
| ------------ | ------ | ----------------------------------------- |
| `frame_id` | string | frame id for output message |
| `covariance` | double | set covariance value to the twist message |
| Name | Type | Description |
| ---------------------------- | ------ | ------------------------------- |
| `frame_id` | string | frame id for output message |
| `velocity_stddev_xx` | double | standard deviation for vx |
| `angular_velocity_stddev_zz` | double | standard deviation for yaw rate |
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/**:
ros__parameters:
velocity_stddev_xx: 0.2 # [m/s]
angular_velocity_stddev_zz: 0.1 # [rad/s]
frame_id: base_link
twist_covariance:
[
0.04, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 10000.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 10000.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 10000.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 10000.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.01,
]
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class VehicleVelocityConverter : public rclcpp::Node
twist_with_covariance_pub_;

std::string frame_id_;
double stddev_vx_;
double stddev_wz_;
std::array<double, 36> twist_covariance_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
VehicleVelocityConverter::VehicleVelocityConverter() : Node("vehicle_velocity_converter")
{
// set covariance value for twist with covariance msg
std::vector<double> covariance = declare_parameter<std::vector<double>>("twist_covariance");
for (std::size_t i = 0; i < covariance.size(); ++i) {
twist_covariance_[i] = covariance[i];
}
stddev_vx_ = declare_parameter("velocity_stddev_xx", 0.2);
stddev_wz_ = declare_parameter("angular_velocity_stddev_zz", 0.1);
frame_id_ = declare_parameter("frame_id", "base_link");

vehicle_report_sub_ = create_subscription<autoware_auto_vehicle_msgs::msg::VelocityReport>(
Expand All @@ -44,7 +42,12 @@ void VehicleVelocityConverter::callbackVelocityReport(
twist_with_covariance_msg.twist.twist.linear.x = msg->longitudinal_velocity;
twist_with_covariance_msg.twist.twist.linear.y = msg->lateral_velocity;
twist_with_covariance_msg.twist.twist.angular.z = msg->heading_rate;
twist_with_covariance_msg.twist.covariance = twist_covariance_;
twist_with_covariance_msg.twist.covariance[0 + 0 * 6] = stddev_vx_ * stddev_vx_;
twist_with_covariance_msg.twist.covariance[1 + 1 * 6] = 10000.0;
twist_with_covariance_msg.twist.covariance[2 + 2 * 6] = 10000.0;
twist_with_covariance_msg.twist.covariance[3 + 3 * 6] = 10000.0;
twist_with_covariance_msg.twist.covariance[4 + 4 * 6] = 10000.0;
twist_with_covariance_msg.twist.covariance[5 + 5 * 6] = stddev_wz_ * stddev_wz_;

twist_with_covariance_pub_->publish(twist_with_covariance_msg);
}