@@ -57,7 +57,7 @@ visualization_msgs::msg::Marker::SharedPtr get_path_confidence_marker_ptr(
57
57
marker_ptr->type = visualization_msgs::msg::Marker::TEXT_VIEW_FACING;
58
58
marker_ptr->ns = std::string (" path confidence" );
59
59
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
60
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
60
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
61
61
marker_ptr->scale .x = 0.5 ;
62
62
marker_ptr->scale .y = 0.5 ;
63
63
marker_ptr->scale .z = 0.5 ;
@@ -78,14 +78,14 @@ visualization_msgs::msg::Marker::SharedPtr get_predicted_path_marker_ptr(
78
78
marker_ptr->type = visualization_msgs::msg::Marker::LINE_LIST;
79
79
marker_ptr->ns = std::string (" path" );
80
80
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
81
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
81
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
82
82
marker_ptr->pose = initPose ();
83
83
marker_ptr->color = predicted_path_color;
84
84
marker_ptr->color .a = 0.6 ;
85
85
marker_ptr->scale .x = 0.015 ;
86
86
calc_path_line_list (predicted_path, marker_ptr->points , is_simple);
87
87
for (size_t k = 0 ; k < marker_ptr->points .size (); ++k) {
88
- marker_ptr->points .at (k).z -= shape.dimensions .z / 2.0 ;
88
+ marker_ptr->points .at (k).z -= shape.dimensions .z * 0.5 ;
89
89
}
90
90
return marker_ptr;
91
91
}
@@ -112,7 +112,7 @@ visualization_msgs::msg::Marker::SharedPtr get_twist_marker_ptr(
112
112
point.z = twist_with_covariance.twist .linear .z ;
113
113
marker_ptr->points .push_back (point);
114
114
115
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
115
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
116
116
marker_ptr->color .a = 0.999 ;
117
117
marker_ptr->color .r = 1.0 ;
118
118
marker_ptr->color .g = 0.0 ;
@@ -160,19 +160,19 @@ visualization_msgs::msg::Marker::SharedPtr get_twist_covariance_marker_ptr(
160
160
// ellipse orientation
161
161
marker_ptr->pose .orientation .x = 0.0 ;
162
162
marker_ptr->pose .orientation .y = 0.0 ;
163
- marker_ptr->pose .orientation .z = std::sin (phi / 2.0 );
164
- marker_ptr->pose .orientation .w = std::cos (phi / 2.0 );
163
+ marker_ptr->pose .orientation .z = std::sin (phi * 0.5 );
164
+ marker_ptr->pose .orientation .w = std::cos (phi * 0.5 );
165
165
166
166
// ellipse size
167
167
marker_ptr->scale .x = sigma1 * confidence_interval_coefficient;
168
168
marker_ptr->scale .y = sigma2 * confidence_interval_coefficient;
169
169
marker_ptr->scale .z = 0.05 ;
170
170
171
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
171
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
172
172
marker_ptr->color .a = alpha;
173
- marker_ptr->color .r = 1.0 ;
174
- marker_ptr->color .g = 0.2 ;
175
- marker_ptr->color .b = 0.4 ;
173
+ marker_ptr->color .r = 0.2 ;
174
+ marker_ptr->color .g = 0.4 ;
175
+ marker_ptr->color .b = 0.9 ;
176
176
177
177
return marker_ptr;
178
178
}
@@ -213,7 +213,7 @@ visualization_msgs::msg::Marker::SharedPtr get_yaw_rate_marker_ptr(
213
213
point.z = 0 ;
214
214
marker_ptr->points .push_back (point);
215
215
216
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
216
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
217
217
marker_ptr->color .a = 0.9 ;
218
218
marker_ptr->color .r = 1.0 ;
219
219
marker_ptr->color .g = 0.0 ;
@@ -274,7 +274,7 @@ visualization_msgs::msg::Marker::SharedPtr get_yaw_rate_covariance_marker_ptr(
274
274
};
275
275
calc_line_list_from_points (point_list, point_pairs, 4 , marker_ptr->points );
276
276
277
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
277
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
278
278
marker_ptr->color .a = 0.9 ;
279
279
marker_ptr->color .r = 1.0 ;
280
280
marker_ptr->color .g = 0.2 ;
@@ -299,7 +299,7 @@ visualization_msgs::msg::Marker::SharedPtr get_velocity_text_marker_ptr(
299
299
marker_ptr->text = std::to_string (static_cast <int >(vel * 3.6 )) + std::string (" [km/h]" );
300
300
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
301
301
marker_ptr->pose .position = vis_pos;
302
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
302
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
303
303
marker_ptr->color = color_rgba;
304
304
return marker_ptr;
305
305
}
@@ -320,7 +320,7 @@ visualization_msgs::msg::Marker::SharedPtr get_acceleration_text_marker_ptr(
320
320
marker_ptr->text = getRoundedDoubleString (acc) + std::string (" [m/s^2]" );
321
321
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
322
322
marker_ptr->pose .position = vis_pos;
323
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
323
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
324
324
marker_ptr->color = color_rgba;
325
325
return marker_ptr;
326
326
}
@@ -378,8 +378,8 @@ visualization_msgs::msg::Marker::SharedPtr get_pose_covariance_marker_ptr(
378
378
// ellipse orientation
379
379
marker_ptr->pose .orientation .x = 0.0 ;
380
380
marker_ptr->pose .orientation .y = 0.0 ;
381
- marker_ptr->pose .orientation .z = std::sin (yaw / 2.0 );
382
- marker_ptr->pose .orientation .w = std::cos (yaw / 2.0 );
381
+ marker_ptr->pose .orientation .z = std::sin (yaw * 0.5 );
382
+ marker_ptr->pose .orientation .w = std::cos (yaw * 0.5 );
383
383
384
384
// ellipse size
385
385
marker_ptr->scale .x = sigma1 * confidence_interval_coefficient;
@@ -392,11 +392,11 @@ visualization_msgs::msg::Marker::SharedPtr get_pose_covariance_marker_ptr(
392
392
alpha = std::max (0.1 , alpha);
393
393
394
394
// marker configuration
395
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
395
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
396
396
marker_ptr->color .a = alpha;
397
- marker_ptr->color .r = 1.0 ;
398
- marker_ptr->color .g = 1.0 ;
399
- marker_ptr->color .b = 1.0 ;
397
+ marker_ptr->color .r = 0.8 ;
398
+ marker_ptr->color .g = 0.8 ;
399
+ marker_ptr->color .b = 0.8 ;
400
400
return marker_ptr;
401
401
}
402
402
@@ -434,7 +434,7 @@ visualization_msgs::msg::Marker::SharedPtr get_yaw_covariance_marker_ptr(
434
434
marker_ptr->points .push_back (point);
435
435
436
436
// marker configuration
437
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
437
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
438
438
marker_ptr->color .a = 0.9 ;
439
439
marker_ptr->color .r = 1.0 ;
440
440
marker_ptr->color .g = 1.0 ;
@@ -469,7 +469,7 @@ visualization_msgs::msg::Marker::SharedPtr get_label_marker_ptr(
469
469
marker_ptr->text = label;
470
470
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
471
471
marker_ptr->pose = marker_ptr->pose = to_pose (centroid, orientation);
472
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
472
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
473
473
marker_ptr->color = color_rgba;
474
474
return marker_ptr;
475
475
}
@@ -486,7 +486,7 @@ visualization_msgs::msg::Marker::SharedPtr get_existence_probability_marker_ptr(
486
486
marker_ptr->text = std::to_string (existence_probability);
487
487
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
488
488
marker_ptr->pose = marker_ptr->pose = to_pose (centroid, orientation);
489
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.2 );
489
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
490
490
marker_ptr->color = color_rgba;
491
491
return marker_ptr;
492
492
}
@@ -506,6 +506,8 @@ visualization_msgs::msg::Marker::SharedPtr get_shape_marker_ptr(
506
506
calc_bounding_box_line_list (shape_msg, marker_ptr->points );
507
507
if (is_orientation_available) {
508
508
calc_bounding_box_direction_line_list (shape_msg, marker_ptr->points );
509
+ } else {
510
+ calc_bounding_box_orientation_line_list (shape_msg, marker_ptr->points );
509
511
}
510
512
} else if (shape_msg.type == Shape::CYLINDER) {
511
513
marker_ptr->type = visualization_msgs::msg::Marker::LINE_LIST;
@@ -520,7 +522,7 @@ visualization_msgs::msg::Marker::SharedPtr get_shape_marker_ptr(
520
522
521
523
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
522
524
marker_ptr->pose = to_pose (centroid, orientation);
523
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
525
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
524
526
marker_ptr->scale .x = line_width;
525
527
marker_ptr->color = color_rgba;
526
528
@@ -542,6 +544,8 @@ visualization_msgs::msg::Marker::SharedPtr get_2d_shape_marker_ptr(
542
544
calc_2d_bounding_box_bottom_line_list (shape_msg, marker_ptr->points );
543
545
if (is_orientation_available) {
544
546
calc_2d_bounding_box_bottom_direction_line_list (shape_msg, marker_ptr->points );
547
+ } else {
548
+ calc_2d_bounding_box_bottom_orientation_line_list (shape_msg, marker_ptr->points );
545
549
}
546
550
} else if (shape_msg.type == Shape::CYLINDER) {
547
551
marker_ptr->type = visualization_msgs::msg::Marker::LINE_LIST;
@@ -556,7 +560,7 @@ visualization_msgs::msg::Marker::SharedPtr get_2d_shape_marker_ptr(
556
560
557
561
marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
558
562
marker_ptr->pose = to_pose (centroid, orientation);
559
- marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.5 );
563
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds (0.15 );
560
564
marker_ptr->scale .x = line_width;
561
565
marker_ptr->color = color_rgba;
562
566
@@ -584,9 +588,9 @@ void calc_bounding_box_line_list(
584
588
const autoware_auto_perception_msgs::msg::Shape & shape,
585
589
std::vector<geometry_msgs::msg::Point > & points)
586
590
{
587
- const double length_half = shape.dimensions .x / 2.0 ;
588
- const double width_half = shape.dimensions .y / 2.0 ;
589
- const double height_half = shape.dimensions .z / 2.0 ;
591
+ const double length_half = shape.dimensions .x * 0.5 ;
592
+ const double width_half = shape.dimensions .y * 0.5 ;
593
+ const double height_half = shape.dimensions .z * 0.5 ;
590
594
geometry_msgs::msg::Point point;
591
595
592
596
// bounding box corner points
@@ -608,10 +612,10 @@ void calc_bounding_box_direction_line_list(
608
612
std::vector<geometry_msgs::msg::Point > & points)
609
613
{
610
614
// direction triangle
611
- const double length_half = shape.dimensions .x / 2.0 ;
612
- const double width_half = shape.dimensions .y / 2.0 ;
613
- const double height_half = shape.dimensions .z / 2.0 ;
614
- const double triangle_size_half = shape. dimensions . y / 1.4 ;
615
+ const double length_half = shape.dimensions .x * 0.5 ;
616
+ const double width_half = shape.dimensions .y * 0.5 ;
617
+ const double height_half = shape.dimensions .z * 0.5 ;
618
+ const double triangle_size_half = std::min (width_half * 1.4 , shape. dimensions . x ) ;
615
619
geometry_msgs::msg::Point point;
616
620
617
621
// triangle-shaped direction indicator
@@ -629,13 +633,38 @@ void calc_bounding_box_direction_line_list(
629
633
calc_line_list_from_points (point_list, point_pairs, 5 , points);
630
634
}
631
635
636
+ void calc_bounding_box_orientation_line_list (
637
+ const autoware_auto_perception_msgs::msg::Shape & shape,
638
+ std::vector<geometry_msgs::msg::Point > & points)
639
+ {
640
+ const double length_half = shape.dimensions .x * 0.5 ;
641
+ const double width_half = shape.dimensions .y * 0.5 ;
642
+ const double height_half = shape.dimensions .z * 0.5 ;
643
+ const double tick_width = width_half * 0.5 ;
644
+ const double tick_length = std::min (tick_width, length_half);
645
+ geometry_msgs::msg::Point point;
646
+
647
+ // front corner cuts for orientation
648
+ const double point_list[4 ][3 ] = {
649
+ {length_half, width_half - tick_width, height_half},
650
+ {length_half - tick_length, width_half, height_half},
651
+ {length_half, -width_half + tick_width, height_half},
652
+ {length_half - tick_length, -width_half, height_half},
653
+ };
654
+ const int point_pairs[2 ][2 ] = {
655
+ {0 , 1 },
656
+ {2 , 3 },
657
+ };
658
+ calc_line_list_from_points (point_list, point_pairs, 2 , points);
659
+ }
660
+
632
661
void calc_2d_bounding_box_bottom_line_list (
633
662
const autoware_auto_perception_msgs::msg::Shape & shape,
634
663
std::vector<geometry_msgs::msg::Point > & points)
635
664
{
636
- const double length_half = shape.dimensions .x / 2.0 ;
637
- const double width_half = shape.dimensions .y / 2.0 ;
638
- const double height_half = shape.dimensions .z / 2.0 ;
665
+ const double length_half = shape.dimensions .x * 0.5 ;
666
+ const double width_half = shape.dimensions .y * 0.5 ;
667
+ const double height_half = shape.dimensions .z * 0.5 ;
639
668
geometry_msgs::msg::Point point;
640
669
641
670
// bounding box corner points
@@ -659,10 +688,10 @@ void calc_2d_bounding_box_bottom_direction_line_list(
659
688
const autoware_auto_perception_msgs::msg::Shape & shape,
660
689
std::vector<geometry_msgs::msg::Point > & points)
661
690
{
662
- const double length_half = shape.dimensions .x / 2.0 ;
663
- const double width_half = shape.dimensions .y / 2.0 ;
664
- const double height_half = shape.dimensions .z / 2.0 ;
665
- const double triangle_size_half = shape. dimensions . y / 1.4 ;
691
+ const double length_half = shape.dimensions .x * 0.5 ;
692
+ const double width_half = shape.dimensions .y * 0.5 ;
693
+ const double height_half = shape.dimensions .z * 0.5 ;
694
+ const double triangle_size_half = std::min (width_half * 1.4 , shape. dimensions . x ) ;
666
695
geometry_msgs::msg::Point point;
667
696
668
697
// triangle-shaped direction indicator
@@ -679,6 +708,31 @@ void calc_2d_bounding_box_bottom_direction_line_list(
679
708
calc_line_list_from_points (point_list, point_pairs, 3 , points);
680
709
}
681
710
711
+ void calc_2d_bounding_box_bottom_orientation_line_list (
712
+ const autoware_auto_perception_msgs::msg::Shape & shape,
713
+ std::vector<geometry_msgs::msg::Point > & points)
714
+ {
715
+ const double length_half = shape.dimensions .x * 0.5 ;
716
+ const double width_half = shape.dimensions .y * 0.5 ;
717
+ const double height_half = shape.dimensions .z * 0.5 ;
718
+ const double tick_width = width_half * 0.5 ;
719
+ const double tick_length = std::min (tick_width, length_half);
720
+ geometry_msgs::msg::Point point;
721
+
722
+ // front corner cuts for orientation
723
+ const double point_list[4 ][3 ] = {
724
+ {length_half, width_half - tick_width, height_half},
725
+ {length_half - tick_length, width_half, height_half},
726
+ {length_half, -width_half + tick_width, height_half},
727
+ {length_half - tick_length, -width_half, height_half},
728
+ };
729
+ const int point_pairs[2 ][2 ] = {
730
+ {0 , 1 },
731
+ {2 , 3 },
732
+ };
733
+ calc_line_list_from_points (point_list, point_pairs, 2 , points);
734
+ }
735
+
682
736
void calc_cylinder_line_list (
683
737
const autoware_auto_perception_msgs::msg::Shape & shape,
684
738
std::vector<geometry_msgs::msg::Point > & points)
@@ -784,41 +838,41 @@ void calc_polygon_line_list(
784
838
geometry_msgs::msg::Point point;
785
839
point.x = shape.footprint .points .at (i).x ;
786
840
point.y = shape.footprint .points .at (i).y ;
787
- point.z = shape.dimensions .z / 2.0 ;
841
+ point.z = shape.dimensions .z * 0.5 ;
788
842
points.push_back (point);
789
843
point.x = shape.footprint .points
790
844
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
791
845
.x ;
792
846
point.y = shape.footprint .points
793
847
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
794
848
.y ;
795
- point.z = shape.dimensions .z / 2.0 ;
849
+ point.z = shape.dimensions .z * 0.5 ;
796
850
points.push_back (point);
797
851
}
798
852
for (size_t i = 0 ; i < shape.footprint .points .size (); ++i) {
799
853
geometry_msgs::msg::Point point;
800
854
point.x = shape.footprint .points .at (i).x ;
801
855
point.y = shape.footprint .points .at (i).y ;
802
- point.z = -shape.dimensions .z / 2.0 ;
856
+ point.z = -shape.dimensions .z * 0.5 ;
803
857
points.push_back (point);
804
858
point.x = shape.footprint .points
805
859
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
806
860
.x ;
807
861
point.y = shape.footprint .points
808
862
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
809
863
.y ;
810
- point.z = -shape.dimensions .z / 2.0 ;
864
+ point.z = -shape.dimensions .z * 0.5 ;
811
865
points.push_back (point);
812
866
}
813
867
for (size_t i = 0 ; i < shape.footprint .points .size (); ++i) {
814
868
geometry_msgs::msg::Point point;
815
869
point.x = shape.footprint .points .at (i).x ;
816
870
point.y = shape.footprint .points .at (i).y ;
817
- point.z = shape.dimensions .z / 2.0 ;
871
+ point.z = shape.dimensions .z * 0.5 ;
818
872
points.push_back (point);
819
873
point.x = shape.footprint .points .at (i).x ;
820
874
point.y = shape.footprint .points .at (i).y ;
821
- point.z = -shape.dimensions .z / 2.0 ;
875
+ point.z = -shape.dimensions .z * 0.5 ;
822
876
points.push_back (point);
823
877
}
824
878
}
@@ -837,15 +891,15 @@ void calc_2d_polygon_bottom_line_list(
837
891
geometry_msgs::msg::Point point;
838
892
point.x = shape.footprint .points .at (i).x ;
839
893
point.y = shape.footprint .points .at (i).y ;
840
- point.z = -shape.dimensions .z / 2.0 ;
894
+ point.z = -shape.dimensions .z * 0.5 ;
841
895
points.push_back (point);
842
896
point.x = shape.footprint .points
843
897
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
844
898
.x ;
845
899
point.y = shape.footprint .points
846
900
.at (static_cast <int >(i + 1 ) % static_cast <int >(shape.footprint .points .size ()))
847
901
.y ;
848
- point.z = -shape.dimensions .z / 2.0 ;
902
+ point.z = -shape.dimensions .z * 0.5 ;
849
903
points.push_back (point);
850
904
}
851
905
}
0 commit comments