总算是调了出来,先粗略记下,随时补充。
打开摄像头:
roslaunch camera ...
(三个待改进,一是包名话题名能否统一;二是终端界面不刷新;三是多余的话题不发布)
一、包名camera,话题名/image_rect&/camera_info,程序名什么的都是usb_cam,过了一遍发现这些不用变。
二、
三、这个...还没怎么解决,但是发现一个新的小问题。
launch文件中 :
这个是发布新话题的,名字是image_view,可能是作者之前需要的用途,我这里并不需要,就删除了,但是可以作为发布新话题的一个途径,故记录。
调用Tag程序:
roslaunch Apriltag2_ROS c...
(6个待改进:一是显示图像,无需在RVIZ里才能显示;二是位姿类型能否更改,参考之前函数;三是存储图像和位姿;四是测精度;五是通信飞控;六通讯地面站)
位姿数据发布话题是第一个
一、https://blog.csdn.net/qq_27050183/article/details/51141998
coutinues_detection.cpp中,
#include "apriltags2_ros/continuous_detector.h"
using namespace cv;//显示图像
static const std::string OPENCV_WINDOW = "Image window";//显示图像
namespace apriltags2_ros
{
...
if (draw_tag_detections_image_)
{
tag_detections_image_publisher_ = it_.advertise("tag_detections_image", 30);
}
cv::namedWindow(OPENCV_WINDOW);//显示图像
}
// Publish the camera image overlaid by outlines of the detected tags and
// their payload values
if (draw_tag_detections_image_)
{
tag_detector_.drawDetections(cv_image_);
tag_detections_image_publisher_.publish(cv_image_->toImageMsg());
cv::imshow(OPENCV_WINDOW, cv_image_->image);//显示图像
cv::waitKey(5);//显示图像
}
}
} // namespace apriltags2_ros
二、更改为x y z roll yaw pitch
Rolldeno = 1 - 2*( pose.pose.pose.orientation.x*pose.pose.pose.orientation.x + pose.pose.pose.orientation.y*pose.pose.pose.orientation.y );
Rollnum = 2*( pose.pose.pose.orientation.w*pose.pose.pose.orientation.x + pose.pose.pose.orientation.y*pose.pose.pose.orientation.z );
dPitch = 2*( pose.pose.pose.orientation.w*pose.pose.pose.orientation.y - pose.pose.pose.orientation.z*pose.pose.pose.orientation.x );
Yawdeno = 1 - 2*( pose.pose.pose.orientation.z*pose.pose.pose.orientation.z + pose.pose.pose.orientation.y*pose.pose.pose.orientation.y );
Yawnum = 2*( pose.pose.pose.orientation.w*pose.pose.pose.orientation.z + pose.pose.pose.orientation.y*pose.pose.pose.orientation.x );
Roll = atan2(Rollnum, Rolldeno)*180/PI;//求角度
Pitch = asin(dPitch)*180/PI;//求角度
Yaw = atan2(Yawnum, Yawdeno)*180/PI;//求角度
三、存储图像和位姿
程序里很清楚。
四是测精度;
五是通信飞控;
串口,程序清楚
六通讯地面站