AutoCar  v1.0.0
armor_detect_node.h
1 #ifndef __THREAD_OPERATION_H__
2 #define __THREAD_OPERATION_H__
3 //
4 #include <ros/ros.h>
5 #include<tf/tf.h>
6 #include <boost/thread.hpp>
7 #include <boost/atomic.hpp>
8 #include <opencv2/opencv.hpp>
9 #include "armor_detect.h"
10 #include <logical_core/SetGoal.h>
11 #include <vision_unit/armor_msg.h>
12 #include <geometry_msgs/PoseStamped.h>
13 #include <geometry_msgs/PoseWithCovarianceStamped.h>
14 #include <move_base_msgs/MoveBaseAction.h>
15 #include <serial_comm/car_speed.h>
16 #include "armor_detect.h"
17 #include <cmath>
18 
19 namespace autocar
20 {
21 namespace vision_mul
22 {
24 {
25 public:
26  armor_detect_node(void);
27  ~armor_detect_node(void);
28 
32  void running(void);
37  bool if_detected_armor();
38  void pan_info_callback(const serial_comm::car_speed::ConstPtr &pan_data);
43  bool get_camera_num();
49 
50 private:
51  void set_image_points(std::vector<cv::Point2f> armor_points);
52 
53 private:
54  //vision_param *param;
55  bool detected_armor;
56  armor_info *armor_;
57  float pan_yaw;
58 
59  cv::Mat m_img_buff[2];
60  bool forward_back;
61  bool debug_on;
62  ros::Subscriber sub_yaw;
63  ros::Publisher pub_armor_pos, pub_goal;
64  vision_unit::armor_msg armor_pos;
65  move_base_msgs::MoveBaseGoal goal;
66  move_base_msgs::MoveBaseGoal goal_pose;
67 
68  cv::Mat camera_matrix;
69  cv::Mat dist_coeffs;
70  cv::Mat obj_points;
71  cv::Mat img_points;
72  std::vector<cv::Point3f> obj_p;
73  std::vector<cv::Point2f> img_p;
74  cv::Mat rvec;
75  cv::Mat tvec;
76  double ang_lim = 3.0/180*3.14;
77  double cam[9] = {839.923052, 0.0, 340.780730,
78  0.0, 837.671081, 261.766523,
79  0.0, 0.0, 1.0 };
80 
81  double dist_c[5] = {0.082613, 0.043275, 0.002486, -0.000823, 0.0};
82 };
83 }
84 }
85 
86 #endif // !__THREAD_OPERATION_H__
87 
Definition: armor_detect.h:15
armor_info * get_armor()
Obtaining the armor information including the width and hight of the armor.
bool get_camera_num()
Maybe we have more than one camera, so we can use this function to get the camera No...
Definition: vel2odom.h:5
bool if_detected_armor()
If the program can detect an armor.
void running(void)
running the program of armor detect
Definition: armor_detect_node.h:23