@@ -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;
@@ -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;
@@ -629,6 +633,30 @@ 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 / 2.0 ;
641
+ const double width_half = shape.dimensions .y / 2.0 ;
642
+ const double height_half = shape.dimensions .z / 2.0 ;
643
+ const double tick_width = width_half * 0.4 ;
644
+ const double tick_length = std::min (tick_width * 1.4 , length_half);
645
+ geometry_msgs::msg::Point point;
646
+
647
+ // triangle-shaped direction indicator
648
+ const double point_list[3 ][3 ] = {
649
+ {length_half, 0 , height_half},
650
+ {length_half - tick_length, tick_width, height_half},
651
+ {length_half - tick_length, -tick_width, height_half},
652
+ };
653
+ const int point_pairs[2 ][2 ] = {
654
+ {0 , 1 },
655
+ {0 , 2 },
656
+ };
657
+ calc_line_list_from_points (point_list, point_pairs, 2 , points);
658
+ }
659
+
632
660
void calc_2d_bounding_box_bottom_line_list (
633
661
const autoware_auto_perception_msgs::msg::Shape & shape,
634
662
std::vector<geometry_msgs::msg::Point > & points)
@@ -662,7 +690,7 @@ void calc_2d_bounding_box_bottom_direction_line_list(
662
690
const double length_half = shape.dimensions .x / 2.0 ;
663
691
const double width_half = shape.dimensions .y / 2.0 ;
664
692
const double height_half = shape.dimensions .z / 2.0 ;
665
- const double triangle_size_half = shape. dimensions . y / 1.4 ;
693
+ const double triangle_size_half = std::min (width_half * 1.4 , shape. dimensions . x ) ;
666
694
geometry_msgs::msg::Point point;
667
695
668
696
// triangle-shaped direction indicator
@@ -679,6 +707,30 @@ void calc_2d_bounding_box_bottom_direction_line_list(
679
707
calc_line_list_from_points (point_list, point_pairs, 3 , points);
680
708
}
681
709
710
+ void calc_2d_bounding_box_bottom_orientation_line_list (
711
+ const autoware_auto_perception_msgs::msg::Shape & shape,
712
+ std::vector<geometry_msgs::msg::Point > & points)
713
+ {
714
+ const double length_half = shape.dimensions .x / 2.0 ;
715
+ const double width_half = shape.dimensions .y / 2.0 ;
716
+ const double height_half = shape.dimensions .z / 2.0 ;
717
+ const double tick_width = width_half * 0.4 ;
718
+ const double tick_length = std::min (tick_width * 1.4 , length_half);
719
+ geometry_msgs::msg::Point point;
720
+
721
+ // triangle-shaped direction indicator
722
+ const double point_list[3 ][3 ] = {
723
+ {length_half, 0 , -height_half},
724
+ {length_half - tick_length, tick_width, -height_half},
725
+ {length_half - tick_length, -tick_width, -height_half},
726
+ };
727
+ const int point_pairs[2 ][2 ] = {
728
+ {0 , 1 },
729
+ {0 , 2 },
730
+ };
731
+ calc_line_list_from_points (point_list, point_pairs, 2 , points);
732
+ }
733
+
682
734
void calc_cylinder_line_list (
683
735
const autoware_auto_perception_msgs::msg::Shape & shape,
684
736
std::vector<geometry_msgs::msg::Point > & points)
0 commit comments