Skip to content

Commit 51c460f

Browse files
committed
feat: add predicted path for the PredictedObject and add publish_only_pointcloud_with_object
Signed-off-by: Berkay Karaman <brkay54@gmail.com>
1 parent 557fe02 commit 51c460f

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

tools/reaction_analyzer/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ vehicle should be same.**
138138
| `topic_publisher.path_bag_with_object` | string | Path to the ROS bag file with objects. Only valid `perception_planning` mode. |
139139
| `topic_publisher.pointcloud_publisher.pointcloud_publisher_type` | string | Defines how the PointCloud2 messages are going to be published. Modes explained above. |
140140
| `topic_publisher.pointcloud_publisher.pointcloud_publisher_period` | double | [s] Publishing period of the PointCloud2 messages. |
141+
| `topic_publisher.pointcloud_publisher.publish_only_pointcloud_with_object` | bool | Default false. Publish only the point cloud messages with the object. |
141142
| `reaction_params.first_brake_params.debug_control_commands` | bool | Debug publish flag. |
142143
| `reaction_params.first_brake_params.control_cmd_buffer_time_interval` | double | [s] Time interval for buffering control commands. |
143144
| `reaction_params.first_brake_params.min_number_descending_order_control_cmd` | int | Minimum number of control commands in descending order for triggering brake. |

tools/reaction_analyzer/include/topic_publisher.hpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ enum class PublisherMessageType {
7070

7171
struct TopicPublisherParams
7272
{
73-
std::string path_bag_without_object; // Path to the bag file without object
74-
std::string path_bag_with_object; // Path to the bag file with object
75-
std::string pointcloud_publisher_type; // Type of the pointcloud publisher
76-
double pointcloud_publisher_period; // Period of the pointcloud publisher
73+
std::string path_bag_without_object; // Path to the bag file without object
74+
std::string path_bag_with_object; // Path to the bag file with object
75+
std::string pointcloud_publisher_type; // Type of the pointcloud publisher
76+
double pointcloud_publisher_period; // Period of the pointcloud publisher
77+
bool publish_only_pointcloud_with_object; // Publish only pointcloud with object for only
78+
// perception pipeline debug purpose make it true.
7779
};
7880

7981
enum class PointcloudPublisherType {

tools/reaction_analyzer/param/reaction_analyzer.param.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@
2626
y_dimension: 1.7809072588403219
2727
z_dimension: 0.8328610206872963
2828
goal_pose:
29-
x: 81462.78125
30-
y: 49978.484375
29+
x: 81824.90625
30+
y: 50069.34375
3131
z: 0.0
3232
roll: 0.0
3333
pitch: 0.0
34-
yaw: 35.0
34+
yaw: 8.9305903
3535
topic_publisher:
3636
path_bag_without_object: /home/berkay/projects/bags/awsim-bag/bag/lexus_bag_without_car/rosbag2_2024_01_30-13_50_45_0.db3
3737
path_bag_with_object: /home/berkay/projects/bags/awsim-bag/bag/lexus_bag_with_car/rosbag2_2024_01_30-13_50_17_0.db3
3838
pointcloud_publisher:
3939
pointcloud_publisher_type: "sync_header_sync_publish" # "async_header_sync_publish", "sync_header_sync_publish" or "async_publish"
4040
pointcloud_publisher_period: 0.1 # s
41+
publish_only_pointcloud_with_object: false # use it only for debug purposes. If true, only pointclouds with object will be published
4142
subscriber:
4243
reaction_params:
4344
first_brake_params:

tools/reaction_analyzer/src/reaction_analyzer_node.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,18 @@ void ReactionAnalyzerNode::initPredictedObjects()
417417
obj.shape.type = autoware_auto_perception_msgs::msg::Shape::BOUNDING_BOX;
418418
obj.existence_probability = 1.0;
419419
obj.kinematics.initial_pose_with_covariance.pose = entity_pose_;
420+
421+
autoware_auto_perception_msgs::msg::PredictedPath path;
422+
path.confidence = 1.0;
423+
path.path.emplace_back(entity_pose_);
424+
obj.kinematics.predicted_paths.emplace_back(path);
425+
420426
autoware_auto_perception_msgs::msg::ObjectClassification classification;
421427
classification.label = autoware_auto_perception_msgs::msg::ObjectClassification::CAR;
422428
classification.probability = 1.0;
423429
obj.classification.emplace_back(classification);
424430
obj.set__object_id(generateUUIDMsg("test_obstacle"));
431+
425432
PredictedObjects pred_objects;
426433
pred_objects.objects.emplace_back(obj);
427434
predicted_objects_ptr_ = std::make_shared<PredictedObjects>(pred_objects);

tools/reaction_analyzer/src/topic_publisher.cpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ TopicPublisher::TopicPublisher(
3737
topic_publisher_params_.pointcloud_publisher_period =
3838
node_->get_parameter("topic_publisher.pointcloud_publisher.pointcloud_publisher_period")
3939
.as_double();
40+
topic_publisher_params_.publish_only_pointcloud_with_object =
41+
node_->get_parameter("topic_publisher.pointcloud_publisher.publish_only_pointcloud_with_object")
42+
.as_bool();
4043

4144
// set pointcloud publisher type
4245
if (topic_publisher_params_.pointcloud_publisher_type == "sync_header_sync_publish") {
@@ -64,9 +67,11 @@ void TopicPublisher::pointcloudMessagesSyncPublisher(const PointcloudPublisherTy
6467
PublisherVarAccessor accessor;
6568
for (const auto & publisher_var_pair : lidar_pub_variable_pair_map_) {
6669
accessor.publishWithCurrentTime(
67-
*publisher_var_pair.second.first, current_time, is_object_spawned);
70+
*publisher_var_pair.second.first, current_time,
71+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
6872
accessor.publishWithCurrentTime(
69-
*publisher_var_pair.second.second, current_time, is_object_spawned);
73+
*publisher_var_pair.second.second, current_time,
74+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
7075
}
7176
if (is_object_spawned && !is_object_spawned_message_published) {
7277
is_object_spawned_message_published = true;
@@ -87,9 +92,11 @@ void TopicPublisher::pointcloudMessagesSyncPublisher(const PointcloudPublisherTy
8792
const auto header_time =
8893
current_time - std::chrono::nanoseconds(counter * phase_dif.count());
8994
accessor.publishWithCurrentTime(
90-
*publisher_var_pair.second.first, header_time, is_object_spawned);
95+
*publisher_var_pair.second.first, header_time,
96+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
9197
accessor.publishWithCurrentTime(
92-
*publisher_var_pair.second.second, header_time, is_object_spawned);
98+
*publisher_var_pair.second.second, header_time,
99+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
93100
counter++;
94101
}
95102
if (is_object_spawned && !is_object_spawned_message_published) {
@@ -113,8 +120,12 @@ void TopicPublisher::pointcloudMessagesAsyncPublisher(
113120
PublisherVarAccessor accessor;
114121
const auto current_time = node_->now();
115122
const bool is_object_spawned = spawn_object_cmd_;
116-
accessor.publishWithCurrentTime(*lidar_output_pair_.first, current_time, is_object_spawned);
117-
accessor.publishWithCurrentTime(*lidar_output_pair_.second, current_time, is_object_spawned);
123+
accessor.publishWithCurrentTime(
124+
*lidar_output_pair_.first, current_time,
125+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
126+
accessor.publishWithCurrentTime(
127+
*lidar_output_pair_.second, current_time,
128+
topic_publisher_params_.publish_only_pointcloud_with_object || is_object_spawned);
118129

119130
if (is_object_spawned && !is_object_spawned_message_published) {
120131
is_object_spawned_message_published = true;
@@ -207,9 +218,6 @@ void TopicPublisher::initRosbagPublishers()
207218

208219
const auto message_type = getMessageTypeForTopic(current_topic);
209220
if (message_type == PublisherMessageType::UNKNOWN) {
210-
RCLCPP_WARN(
211-
node_->get_logger(), "Unknown message type for topic name: %s, skipping..",
212-
current_topic.c_str());
213221
continue;
214222
}
215223

@@ -427,9 +435,6 @@ void TopicPublisher::initRosbagPublishers()
427435
break;
428436
}
429437
default:
430-
RCLCPP_WARN(
431-
node_->get_logger(), "Unknown message type for topic name: %s, skipping..",
432-
current_topic.c_str());
433438
break;
434439
}
435440
}
@@ -498,9 +503,6 @@ void TopicPublisher::initRosbagPublishers()
498503

499504
const auto message_type = getMessageTypeForTopic(current_topic);
500505
if (message_type == PublisherMessageType::UNKNOWN) {
501-
RCLCPP_WARN(
502-
node_->get_logger(), "Unknown message type for topic name: %s, skipping..",
503-
current_topic.c_str());
504506
continue;
505507
}
506508
switch (message_type) {
@@ -740,9 +742,6 @@ void TopicPublisher::initRosbagPublishers()
740742
break;
741743
}
742744
default:
743-
RCLCPP_WARN(
744-
node_->get_logger(), "Unknown message type for topic name: %s, skipping..",
745-
current_topic.c_str());
746745
break;
747746
}
748747
}

0 commit comments

Comments
 (0)