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: cherry pick to improve stability of tracker #1186

Merged
merged 3 commits into from
Mar 11, 2024
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 @@ -19,7 +19,8 @@
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/ros/debug_publisher.hpp>
#include <tier4_autoware_utils/system/stop_watch.hpp>

#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp>
#include <autoware_perception_msgs/msg/traffic_signal_array.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#define OBSTACLE_POINTCLOUD_BASED_VALIDATOR__DEBUGGER_HPP_

#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>

#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "detected_object_filter/object_lanelet_filter.hpp"

#include <object_recognition_utils/object_recognition_utils.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/geometry/geometry.hpp>

#include <boost/geometry/algorithms/convex_hull.hpp>
#include <boost/geometry/algorithms/disjoint.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include "detected_object_filter/object_position_filter.hpp"

#include <tier4_autoware_utils/tier4_autoware_utils.hpp>

namespace object_position_filter
{
ObjectPositionFilterNode::ObjectPositionFilterNode(const rclcpp::NodeOptions & node_options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp"

#include <object_recognition_utils/object_recognition_utils.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/geometry/boost_polygon_utils.hpp>

#include <boost/geometry.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <object_recognition_utils/object_classification.hpp>
#include <object_recognition_utils/object_recognition_utils.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/geometry/boost_polygon_utils.hpp>

#include <boost/optional.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp>
#include <rclcpp/rclcpp.hpp>
#include <shape_estimation/shape_estimator.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>

#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
#include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp>
#include <rclcpp/rclcpp.hpp>
#include <shape_estimation/shape_estimator.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>

#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
#include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#include "object_recognition_utils/object_recognition_utils.hpp"

#include <tier4_autoware_utils/geometry/geometry.hpp>
#include <tier4_autoware_utils/math/unit_conversion.hpp>

#include <chrono>
#include <memory>
#include <optional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "pcl/point_types.h"
#include "pcl_conversions/pcl_conversions.h"
#include "rclcpp/logger.hpp"
#include "tier4_autoware_utils/tier4_autoware_utils.hpp"
#include "tier4_autoware_utils/geometry/boost_geometry.hpp"

#include "autoware_auto_perception_msgs/msg/detected_objects.hpp"
#include "nav_msgs/msg/odometry.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "front_vehicle_velocity_estimator/front_vehicle_velocity_estimator.hpp"

#include "tier4_autoware_utils/geometry/geometry.hpp"

#include <boost/geometry.hpp>

#include <memory>
Expand Down
3 changes: 2 additions & 1 deletion perception/heatmap_visualizer/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#include "heatmap_visualizer/utils.hpp"

#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/math/normalization.hpp>
#include <tier4_autoware_utils/math/unit_conversion.hpp>

#include <tf2/utils.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

#include "object_recognition_utils/geometry.hpp"
#include "object_recognition_utils/object_recognition_utils.hpp"
#include "tier4_autoware_utils/tier4_autoware_utils.hpp"

#include "tier4_autoware_utils/geometry/geometry.hpp"
namespace centerpoint
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ class BicycleTracker : public Tracker
private:
KalmanFilter ekf_;
rclcpp::Time last_update_time_;
enum IDX { X = 0, Y = 1, YAW = 2, VX = 3, SLIP = 4 };
enum IDX { X = 0, Y = 1, YAW = 2, VEL = 3, SLIP = 4 };
struct EkfParams
{
char dim_x = 5;
float q_cov_x;
float q_cov_y;
float q_cov_yaw;
float q_cov_slip;
float q_cov_vx;
float p0_cov_vx;
float q_stddev_acc_long;
float q_stddev_acc_lat;
float q_stddev_yaw_rate_min;
float q_stddev_yaw_rate_max;
float q_cov_slip_rate_min;
float q_cov_slip_rate_max;
float q_max_slip_angle;
float p0_cov_vel;
float p0_cov_slip;
float r_cov_x;
float r_cov_y;
Expand All @@ -51,7 +53,7 @@ class BicycleTracker : public Tracker
float p0_cov_yaw;
} ekf_params_;

double max_vx_;
double max_vel_;
double max_slip_;
double lf_;
double lr_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,28 @@ class BigVehicleTracker : public Tracker
private:
KalmanFilter ekf_;
rclcpp::Time last_update_time_;
enum IDX { X = 0, Y = 1, YAW = 2, VX = 3, SLIP = 4 };
enum IDX { X = 0, Y = 1, YAW = 2, VEL = 3, SLIP = 4 };
struct EkfParams
{
char dim_x = 5;
float q_cov_x;
float q_cov_y;
float q_cov_yaw;
float q_cov_slip;
float q_cov_vx;
float p0_cov_vx;
float q_stddev_acc_long;
float q_stddev_acc_lat;
float q_stddev_yaw_rate_min;
float q_stddev_yaw_rate_max;
float q_cov_slip_rate_min;
float q_cov_slip_rate_max;
float q_max_slip_angle;
float p0_cov_vel;
float p0_cov_slip;
float r_cov_x;
float r_cov_y;
float r_cov_yaw;
float r_cov_vx;
float r_cov_vel;
float p0_cov_x;
float p0_cov_y;
float p0_cov_yaw;
} ekf_params_;
double max_vx_;
double max_vel_;
double max_slip_;
double lf_;
double lr_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,30 @@ class NormalVehicleTracker : public Tracker
private:
KalmanFilter ekf_;
rclcpp::Time last_update_time_;
enum IDX { X = 0, Y = 1, YAW = 2, VX = 3, SLIP = 4 };
enum IDX { X = 0, Y = 1, YAW = 2, VEL = 3, SLIP = 4 };

struct EkfParams
{
char dim_x = 5;
float q_cov_x;
float q_cov_y;
float q_cov_yaw;
float q_cov_slip;
float q_cov_vx;
float p0_cov_vx;
float q_stddev_acc_long;
float q_stddev_acc_lat;
float q_stddev_yaw_rate_min;
float q_stddev_yaw_rate_max;
float q_cov_slip_rate_min;
float q_cov_slip_rate_max;
float q_max_slip_angle;
float p0_cov_vel;
float p0_cov_slip;
float r_cov_x;
float r_cov_y;
float r_cov_yaw;
float r_cov_vx;
float r_cov_vel;
float p0_cov_x;
float p0_cov_y;
float p0_cov_yaw;
} ekf_params_;

double max_vx_;
double max_vel_;
double max_slip_;
double lf_;
double lr_;
Expand Down Expand Up @@ -88,6 +90,7 @@ class NormalVehicleTracker : public Tracker
const rclcpp::Time & time,
autoware_auto_perception_msgs::msg::TrackedObject & object) const override;
void setNearestCornerOrSurfaceIndex(const geometry_msgs::msg::Transform & self_transform);
double getMeasurementYaw(const autoware_auto_perception_msgs::msg::DetectedObject & object);
virtual ~NormalVehicleTracker() {}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@

#include <Eigen/Core>
#include <Eigen/Geometry>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>

#include <autoware_auto_perception_msgs/msg/detected_object.hpp>
#include <autoware_auto_perception_msgs/msg/shape.hpp>
#include <autoware_auto_perception_msgs/msg/tracked_object.hpp>
#include <geometry_msgs/msg/polygon.hpp>
#include <geometry_msgs/msg/transform.hpp>
#include <geometry_msgs/msg/vector3.hpp>

#include <tf2/utils.h>

#include <algorithm>
#include <cmath>
#include <tuple>
Expand Down
45 changes: 27 additions & 18 deletions perception/multi_object_tracker/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

## Tracking model

### CTRV model [1]

Check warning on line 5 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (CTRV)

CTRV model is a model that assumes constant turn rate and velocity magnitude.

Check warning on line 7 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (CTRV)

- state transition equation

$$
\begin{align*}
x_{k+1} &= x_k + v_{x_k} \cos(\psi_k) \cdot dt \\
y_{k+1} &= y_k + v_{x_k} \sin(\psi_k) \cdot dt \\
\psi_{k+1} &= \psi_k + \dot{\psi}_k \cdot dt \\
v_{x_{k+1}} &= v_{x_k} \\
\dot{\psi}_{k+1} &= \dot{\psi}_k \\
\end{align*}
\begin{aligned}
x_{k+1} & = x_{k} + v_{k} \cos(\psi_k) \cdot {d t} \\
y_{k+1} & = y_{k} + v_{k} \sin(\psi_k) \cdot {d t} \\
\psi_{k+1} & = \psi_k + \dot\psi_{k} \cdot {d t} \\
v_{k+1} & = v_{k} \\
\dot\psi_{k+1} & = \dot\psi_{k} \\
\end{aligned}
$$

- jacobian

$$
A = \begin{bmatrix}
1 & 0 & -v_x \sin(\psi) \cdot dt & \cos(\psi) \cdot dt & 0 \\
0 & 1 & v_x \cos(\psi) \cdot dt & \sin(\psi) \cdot dt & 0 \\
1 & 0 & -v \sin(\psi) \cdot dt & \cos(\psi) \cdot dt & 0 \\
0 & 1 & v \cos(\psi) \cdot dt & \sin(\psi) \cdot dt & 0 \\
0 & 0 & 1 & 0 & dt \\
0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 1 \\
Expand All @@ -38,17 +38,20 @@
![kinematic_bicycle_model](image/kinematic_bicycle_model.png)

- **state variable**
- pose( $x,y$ ), velocity( $v$ ), yaw( $\psi$ ), and slip angle ( $\beta$ )
- $[x_{k} ,y_{k} , v_{k} , \psi_{k} , \beta_{k} ]^\mathrm{T}$
- pose( $x,y$ ), yaw( $\psi$ ), velocity( $v$ ), and slip angle ( $\beta$ )
- $[x_{k}, y_{k}, \psi_{k}, v_{k}, \beta_{k} ]^\mathrm{T}$
- **Prediction Equation**
- $dt$: sampling time
- $w_{k} = \dot\psi_{k} = \frac{ v_{k} \sin \left( \beta_{k} \right) }{ l_r }$ : angular velocity

$$
\begin{aligned}
x_{k+1} & =x_{k}+v_{k} \cos \left(\psi_{k}+\beta_{k}\right) d t \\
y_{k+1} & =y_{k}+v_{k} \sin \left(\psi_{k}+\beta_{k}\right) d t \\
v_{k+1} & =v_{k} \\
\psi_{k+1} & =\psi_{k}+\frac{v_{k}}{l_{r}} \sin \beta_{k} d t \\
x_{k+1} & = x_{k} + v_{k} \cos \left( \psi_{k}+\beta_{k} \right) {d t}
-\frac{1}{2} \left\lbrace w_k v_k \sin \left(\psi_{k}+\beta_{k} \right) \right\rbrace {d t}^2\\
y_{k+1} & = y_{k} + v_{k} \sin \left( \psi_{k}+\beta_{k} \right) {d t}
+\frac{1}{2} \left\lbrace w_k v_k \cos \left(\psi_{k}+\beta_{k} \right) \right\rbrace {d t}^2\\
\psi_{k+1} & =\psi_{k} + w_k {d t} \\
v_{k+1} & = v_{k} \\
\beta_{k+1} & =\beta_{k}
\end{aligned}
$$
Expand All @@ -57,9 +60,15 @@

$$
\frac{\partial f}{\partial \mathrm x}=\left[\begin{array}{ccccc}
1 & 0 & -v \sin (\psi+\beta) d t & v \cos (\psi+\beta) & -v \sin (\psi+\beta) d t \\
0 & 1 & v \cos (\psi+\beta) d t & v \sin (\psi+\beta) & v \cos (\psi+\beta) d t \\
0 & 0 & 1 & \frac{1}{l_r} \sin \beta d t & \frac{v}{l_r} \cos \beta d t \\
1 & 0
& v \cos (\psi+\beta) {d t} - \frac{1}{2} \left\lbrace w v \cos \left( \psi+\beta \right) \right\rbrace {d t}^2
& \sin (\psi+\beta) {d t} - \left\lbrace w \sin \left( \psi+\beta \right) \right\rbrace {d t}^2
& -v \sin (\psi+\beta) {d t} - \frac{v^2}{2l_r} \left\lbrace \cos(\beta)\sin(\psi+\beta)+\sin(\beta)\cos(\psi+\beta) \right\rbrace {d t}^2 \\
0 & 1
& v \sin (\psi+\beta) {d t} - \frac{1}{2} \left\lbrace w v \sin \left( \psi+\beta \right) \right\rbrace {d t}^2
& \cos (\psi+\beta) {d t} + \left\lbrace w \cos \left( \psi+\beta \right) \right\rbrace {d t}^2
& v \cos (\psi+\beta) {d t} + \frac{v^2}{2l_r} \left\lbrace \cos(\beta)\cos(\psi+\beta)-\sin(\beta)\sin(\psi+\beta) \right\rbrace {d t}^2 \\
0 & 0 & 1 & \frac{1}{l_r} \sin \beta {d t} & \frac{v}{l_r} \cos \beta d t \\
0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 1
\end{array}\right]
Expand Down Expand Up @@ -106,5 +115,5 @@

## References

[1] Schubert, Robin & Richter, Eric & Wanielik, Gerd. (2008). Comparison and evaluation of advanced motion models for vehicle tracking. 1 - 6. 10.1109/ICIF.2008.4632283.

Check warning on line 118 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Wanielik)

Check warning on line 118 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Gerd)

Check warning on line 118 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ICIF)
[2] Kong, Jason & Pfeiffer, Mark & Schildbach, Georg & Borrelli, Francesco. (2015). Kinematic and dynamic vehicle models for autonomous driving control design. 1094-1099. 10.1109/IVS.2015.7225830.

Check warning on line 119 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Pfeiffer)

Check warning on line 119 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Schildbach)

Check warning on line 119 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Georg)

Check warning on line 119 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Borrelli)

Check warning on line 119 in perception/multi_object_tracker/models.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (Francesco)
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Eigen::MatrixXd DataAssociation::calcScoreMatrix(
measurement_object.kinematics.pose_with_covariance.pose.position,
tracked_object.kinematics.pose_with_covariance.pose.position,
getXYCovariance(tracked_object.kinematics.pose_with_covariance));
if (2.448 /*95%*/ <= mahalanobis_dist) passed_gate = false;
if (3.035 /*99%*/ <= mahalanobis_dist) passed_gate = false;
}
// 2d iou gate
if (passed_gate) {
Expand Down
Loading
Loading