-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(autoware_multi_object_tracker): define a new internal object…
… class (#9706) * feat: Add dynamic_object.hpp to object_model directory Signed-off-by: Taekjin LEE <[email protected]> * chore: Update autoware_perception_msgs include statements in association.hpp and dynamic_object.hpp Signed-off-by: Taekjin LEE <[email protected]> * fix: replace object message type to the DynamicObject type Signed-off-by: Taekjin LEE <[email protected]> * chore: Update autoware_perception_msgs include statements in association.hpp and dynamic_object.hpp Signed-off-by: Taekjin LEE <[email protected]> * chore: add channel index to the DynamicObjects Signed-off-by: Taekjin LEE <[email protected]> * Revert "chore: add channel index to the DynamicObjects" This reverts commit c7e73f0. Signed-off-by: Taekjin LEE <[email protected]> * fix: replace trackedobject in the process Signed-off-by: Taekjin LEE <[email protected]> * fix: Replace transformObjects with shapes::transformObjects for object transformation Signed-off-by: Taekjin LEE <[email protected]> * chore: add channel index to the DynamicObjects Signed-off-by: Taekjin LEE <[email protected]> * feat: separate shape related functions Signed-off-by: Taekjin LEE <[email protected]> * chore: clean up utils.hpp Signed-off-by: Taekjin LEE <[email protected]> * chore: Update function signatures to use DynamicObjectList instead of DynamicObjects Signed-off-by: Taekjin LEE <[email protected]> * chore: Add channel index to DynamicObject and DynamicObjectList Signed-off-by: Taekjin LEE <[email protected]> * chore: Refactor processor and debugger classes to remove channel_index parameter Signed-off-by: Taekjin LEE <[email protected]> * chore: Refactor multiple_vehicle_tracker.cpp and debugger.cpp Signed-off-by: Taekjin LEE <[email protected]> * Refactor object tracker classes to remove self_transform parameter Signed-off-by: Taekjin LEE <[email protected]> * Refactor object tracker classes to use shapes namespace for shape-related functions Signed-off-by: Taekjin LEE <[email protected]> * Refactor object tracker classes to use types.hpp for object model types Signed-off-by: Taekjin LEE <[email protected]> * Refactor object tracker classes to remove unused utils.hpp Signed-off-by: Taekjin LEE <[email protected]> * Refactor object tracker classes to use types.hpp for object model types Signed-off-by: Taekjin LEE <[email protected]> * chore: rename to types.cpp Signed-off-by: Taekjin LEE <[email protected]> * rename getDynamicObject to toDynamicObject Signed-off-by: Taekjin LEE <[email protected]> * Update perception/autoware_multi_object_tracker/lib/object_model/shapes.cpp Co-authored-by: Yukihiro Saito <[email protected]> --------- Signed-off-by: Taekjin LEE <[email protected]> Co-authored-by: Yukihiro Saito <[email protected]>
- Loading branch information
1 parent
4045fb3
commit 308eefb
Showing
38 changed files
with
723 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...toware_multi_object_tracker/include/autoware/multi_object_tracker/object_model/shapes.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// Author: v1.0 Taekjin Lee | ||
|
||
#ifndef AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__SHAPES_HPP_ | ||
#define AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__SHAPES_HPP_ | ||
|
||
#include "autoware/multi_object_tracker/object_model/types.hpp" | ||
|
||
#include <Eigen/Core> | ||
|
||
#include <tf2_ros/buffer.h> | ||
|
||
#include <string> | ||
|
||
namespace autoware::multi_object_tracker | ||
{ | ||
namespace shapes | ||
{ | ||
bool transformObjects( | ||
const types::DynamicObjectList & input_msg, const std::string & target_frame_id, | ||
const tf2_ros::Buffer & tf_buffer, types::DynamicObjectList & output_msg); | ||
|
||
double get2dIoU( | ||
const types::DynamicObject & source_object, const types::DynamicObject & target_object, | ||
const double min_union_area = 0.01); | ||
|
||
bool convertConvexHullToBoundingBox( | ||
const types::DynamicObject & input_object, types::DynamicObject & output_object); | ||
|
||
bool getMeasurementYaw( | ||
const types::DynamicObject & object, const double & predicted_yaw, double & measurement_yaw); | ||
|
||
int getNearestCornerOrSurface( | ||
const double x, const double y, const double yaw, const double width, const double length, | ||
const geometry_msgs::msg::Transform & self_transform); | ||
|
||
void calcAnchorPointOffset( | ||
const double w, const double l, const int indx, const types::DynamicObject & input_object, | ||
const double & yaw, types::DynamicObject & offset_object, Eigen::Vector2d & tracking_offset); | ||
} // namespace shapes | ||
} // namespace autoware::multi_object_tracker | ||
|
||
#endif // AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__SHAPES_HPP_ |
88 changes: 88 additions & 0 deletions
88
...utoware_multi_object_tracker/include/autoware/multi_object_tracker/object_model/types.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// Author: v1.0 Taekjin Lee | ||
|
||
#ifndef AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__TYPES_HPP_ | ||
#define AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__TYPES_HPP_ | ||
|
||
#include <autoware_perception_msgs/msg/detected_object.hpp> | ||
#include <autoware_perception_msgs/msg/detected_object_kinematics.hpp> | ||
#include <autoware_perception_msgs/msg/detected_objects.hpp> | ||
#include <autoware_perception_msgs/msg/object_classification.hpp> | ||
#include <autoware_perception_msgs/msg/shape.hpp> | ||
#include <autoware_perception_msgs/msg/tracked_object.hpp> | ||
#include <autoware_perception_msgs/msg/tracked_object_kinematics.hpp> | ||
#include <geometry_msgs/msg/polygon.hpp> | ||
#include <geometry_msgs/msg/pose_with_covariance.hpp> | ||
#include <geometry_msgs/msg/twist_with_covariance.hpp> | ||
#include <geometry_msgs/msg/vector3.hpp> | ||
#include <std_msgs/msg/header.hpp> | ||
#include <unique_identifier_msgs/msg/uuid.hpp> | ||
|
||
#include <boost/optional.hpp> | ||
|
||
#include <vector> | ||
|
||
namespace autoware::multi_object_tracker | ||
{ | ||
namespace types | ||
{ | ||
enum OrientationAvailability : uint8_t { | ||
UNAVAILABLE = 0, | ||
SIGN_UNKNOWN = 1, | ||
AVAILABLE = 2, | ||
}; | ||
|
||
struct ObjectKinematics | ||
{ | ||
geometry_msgs::msg::PoseWithCovariance pose_with_covariance; | ||
geometry_msgs::msg::TwistWithCovariance twist_with_covariance; | ||
bool has_position_covariance = false; | ||
OrientationAvailability orientation_availability; | ||
bool has_twist = false; | ||
bool has_twist_covariance = false; | ||
}; | ||
|
||
struct DynamicObject | ||
{ | ||
unique_identifier_msgs::msg::UUID object_id = unique_identifier_msgs::msg::UUID(); | ||
uint channel_index; | ||
float existence_probability; | ||
std::vector<autoware_perception_msgs::msg::ObjectClassification> classification; | ||
ObjectKinematics kinematics; | ||
autoware_perception_msgs::msg::Shape shape; | ||
}; | ||
|
||
struct DynamicObjectList | ||
{ | ||
std_msgs::msg::Header header; | ||
uint channel_index; | ||
std::vector<DynamicObject> objects; | ||
}; | ||
|
||
DynamicObject toDynamicObject( | ||
const autoware_perception_msgs::msg::DetectedObject & det_object, const uint channel_index = 0); | ||
|
||
DynamicObjectList toDynamicObjectList( | ||
const autoware_perception_msgs::msg::DetectedObjects & det_objects, const uint channel_index = 0); | ||
|
||
autoware_perception_msgs::msg::TrackedObject toTrackedObjectMsg(const DynamicObject & dyn_object); | ||
|
||
} // namespace types | ||
|
||
} // namespace autoware::multi_object_tracker | ||
|
||
#endif // AUTOWARE__MULTI_OBJECT_TRACKER__OBJECT_MODEL__TYPES_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.