Skip to content

Commit 1f65733

Browse files
committed
Add arrow markers
1 parent 3bfd7c5 commit 1f65733

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

radar_conti_ars408/src/src/radar_conti_ars408_component.cpp

+33-3
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ namespace FHAC
702702

703703
mobject.header.stamp = rclcpp_lifecycle::LifecycleNode::now();
704704
mobject.header.frame_id = radar_link_names_[sensor_id];
705-
mobject.ns = "";
705+
mobject.ns = "track";
706706
mobject.id = itr->first;
707707
mobject.type = 1; // Cube
708708
mobject.action = 0; // add/modify
@@ -712,7 +712,6 @@ namespace FHAC
712712
double yaw = itr->second.object_extended.obj_orientationangle.data * 3.1416 / 180.0;
713713

714714
myQuaternion.setRPY(0, 0, yaw);
715-
716715
mobject.pose.orientation.w = myQuaternion.getW();
717716
mobject.pose.orientation.x = myQuaternion.getX();
718717
mobject.pose.orientation.y = myQuaternion.getY();
@@ -732,7 +731,6 @@ namespace FHAC
732731

733732
radar_track.velocity.x = itr->second.object_general.obj_vrellong.data;
734733
radar_track.velocity.y = itr->second.object_general.obj_vrellat.data;
735-
;
736734
radar_track.velocity.z = 0.0;
737735

738736
radar_track.acceleration.x = 0.0;
@@ -773,7 +771,39 @@ namespace FHAC
773771
mobject.pose.position = radar_track.position;
774772
mobject.scale = radar_track.size;
775773

774+
visualization_msgs::msg::Marker arrow_vrelong = mobject;
775+
arrow_vrelong.type = 0; // Arrow
776+
arrow_vrelong.scale.x = radar_track.velocity.x;
777+
arrow_vrelong.scale.y = 0.1;
778+
arrow_vrelong.scale.z = 0.1;
779+
arrow_vrelong.ns = "vrelong_arrow";
780+
arrow_vrelong.color.r = 1.0;
781+
arrow_vrelong.color.g = 0.0;
782+
arrow_vrelong.color.b = 0.0;
783+
arrow_vrelong.color.a = 1.0;
784+
785+
visualization_msgs::msg::Marker arrow_vrelat = mobject;
786+
auto vrelat_quat = myQuaternion;
787+
vrelat_quat.setRPY(0, 0, yaw + M_PI_2);
788+
arrow_vrelat.pose.orientation.w = vrelat_quat.getW();
789+
arrow_vrelat.pose.orientation.x = vrelat_quat.getX();
790+
arrow_vrelat.pose.orientation.y = vrelat_quat.getY();
791+
arrow_vrelat.pose.orientation.z = vrelat_quat.getZ();
792+
793+
arrow_vrelat.type = 0; // Arrow
794+
arrow_vrelat.scale.x = radar_track.velocity.y;
795+
arrow_vrelat.scale.y = 0.1;
796+
arrow_vrelat.scale.z = 0.1;
797+
arrow_vrelat.ns = "vrelat_arrow";
798+
arrow_vrelat.color.r = 0.0;
799+
arrow_vrelat.color.g = 1.0;
800+
arrow_vrelat.color.b = 0.0;
801+
arrow_vrelat.color.a = 1.0;
802+
776803
marker_array.markers.push_back(mobject);
804+
marker_array.markers.push_back(arrow_vrelong);
805+
marker_array.markers.push_back(arrow_vrelat);
806+
777807
radar_tracks.tracks.push_back(radar_track);
778808
obstacle_array.obstacles.push_back(obstacle);
779809
}

0 commit comments

Comments
 (0)