Decision Module  1.0
ICRA2020 AI Challenge Northwestern Polytechnical University Aoxiang Team Strategy Code
gimbal_control.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2019 RoboMaster.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  ***************************************************************************/
17 #ifndef ROBORTS_DETECTION_GIMBAL_CONTROL_H
18 #define ROBORTS_DETECTION_GIMBAL_CONTROL_H
19 
20 #include <iostream>
21 //#include <opencv-3.3.1-dev/opencv2/opencv.hpp>
22 #include <geometry_msgs/Point32.h>
23 
24 namespace roborts_decision {
25 
26 const double PI = 3.1415926535;
27 const float GRAVITY = 9.78;
28 
35 class GimbalContrl {
36 private:
44  float BulletModel(float x, float v, float angle);
45 
53  float GetPitch(float x, float y, float v);
54 
55 public:
65  void Init(float x, float y, float z, float pitch, float yaw, float init_v,
66  float init_k);
67 
74  void Transform(geometry_msgs::Point32 &postion,float &pitch,float &yaw);
75 
76 private:
79  geometry_msgs::Point32 offset_;
81  float offset_pitch_;
82  float offset_yaw_;
83 
85  float init_v_;
86  float init_k_;
87 
88 };
89 
90 } //namespace roborts_detection
91 
92 #endif //ROBORTS_DETECTION_GIMBAL_CONTROL_H
roborts_decision::GimbalContrl::GetPitch
float GetPitch(float x, float y, float v)
Get the gimbal control angle.
Definition: gimbal_control.cpp:61
roborts_decision::GimbalContrl::Init
void Init(float x, float y, float z, float pitch, float yaw, float init_v, float init_k)
Init the Transformation matrix from camera to gimbal //TODO: write in ros tf.
Definition: gimbal_control.cpp:41
roborts_decision::GimbalContrl::init_k_
float init_k_
Definition: gimbal_control.h:101
roborts_decision::PI
const double PI
Definition: gimbal_control.h:41
roborts_decision::GimbalContrl::offset_pitch_
float offset_pitch_
Rotation matrix unit: degree.
Definition: gimbal_control.h:96
roborts_decision::GimbalContrl::init_v_
float init_v_
Initial value.
Definition: gimbal_control.h:100
roborts_decision::GimbalContrl::offset_yaw_
float offset_yaw_
Definition: gimbal_control.h:97
roborts_decision
Definition: behavior_test_node.h:14
roborts_decision::GimbalContrl::BulletModel
float BulletModel(float x, float v, float angle)
Calculate the actual y value with air resistance.
Definition: gimbal_control.cpp:53
roborts_decision::GRAVITY
const float GRAVITY
Definition: gimbal_control.h:42
roborts_decision::GimbalContrl::offset_
geometry_msgs::Point32 offset_
Definition: gimbal_control.h:94
roborts_decision::GimbalContrl::Transform
void Transform(geometry_msgs::Point32 &postion, float &pitch, float &yaw)
Get the gimbal control info.
Definition: gimbal_control.cpp:80