mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 05:29:32 +00:00
Make camera markers node retrieve frame id from camera info
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
<!-- camera visualization markers -->
|
||||
<node pkg="clever" type="camera_markers" ns="main_camera" name="main_camera_markers">
|
||||
<param name="frame_id" value="main_camera_optical"/>
|
||||
<param name="scale" value="3.0"/>
|
||||
</node>
|
||||
</launch>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <ros/ros.h>
|
||||
#include <sensor_msgs/CameraInfo.h>
|
||||
#include <visualization_msgs/Marker.h>
|
||||
#include <visualization_msgs/MarkerArray.h>
|
||||
|
||||
@@ -81,12 +82,15 @@ MarkerArray createMarkers() {
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ros::init(argc, argv, "camera_markers");
|
||||
ros::init(argc, argv, "camera_markers", ros::init_options::AnonymousName);
|
||||
ros::NodeHandle nh, nh_priv("~");
|
||||
|
||||
nh_priv.param<std::string>("frame_id", camera_frame, "main_camera_optical");
|
||||
nh_priv.param("scale", markers_scale, 1.0);
|
||||
|
||||
// wait for camera info
|
||||
auto camera_info = ros::topic::waitForMessage<sensor_msgs::CameraInfo>("camera_info", nh);
|
||||
camera_frame = camera_info->header.frame_id;
|
||||
|
||||
ros::Publisher markers_pub = nh.advertise<visualization_msgs::MarkerArray>("camera_markers", 1, true);
|
||||
markers_pub.publish(createMarkers());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user