GX40 Done

This commit is contained in:
AiYangSky 2023-11-22 18:59:55 +08:00
parent 169f4ba55b
commit e46c02cdf7
4 changed files with 23 additions and 22 deletions

View File

@ -163,12 +163,13 @@ void GX40GimbalDriver::convert(void *buf)
this->state.workMode = (amovGimbal::AMOV_GIMBAL_SERVO_MODE_T)primary->workMode;
this->state.cameraFlag = (amovGimbal::AMOV_GIMBAL_CAMERA_FLAG_T)primary->state;
// 应该需要再解算一下,才能出具体的框架角度
this->state.rel.yaw = 360.0f - (primary->motorYaw * XF_ANGLE_DPI);
this->state.rel.yaw = -(primary->motorYaw * XF_ANGLE_DPI);
this->state.rel.yaw = this->state.rel.yaw < -180.0f ? this->state.rel.yaw + 360.0f : this->state.rel.yaw;
this->state.rel.pitch = -(primary->motorPitch * XF_ANGLE_DPI);
this->state.rel.roll = -(primary->motorRoll * XF_ANGLE_DPI);
this->state.abs.yaw = (primary->yaw * XF_ANGLE_DPI);
this->state.abs.yaw = this->state.abs.yaw > 180.0f ? this->state.abs.yaw - 360.0f : this->state.abs.yaw;
this->state.abs.yaw = -(primary->yaw * XF_ANGLE_DPI);
this->state.abs.yaw = this->state.abs.yaw < -180.0f ? this->state.abs.yaw + 360.0f : this->state.abs.yaw;
this->state.abs.pitch = -(primary->pitch * XF_ANGLE_DPI);
this->state.abs.roll = -(primary->roll * XF_ANGLE_DPI);

View File

@ -94,7 +94,6 @@ int main(int argc, char *argv[])
// 读取一帧图像到img
cap.read(img);
cv::resize(img, img, cv::Size(cod.image_width, cod.image_height));
cv::imshow(RGB_WINDOW, img);
// 执行通用目标检测
cod.detect(img, tgts);
@ -201,7 +200,7 @@ int main(int argc, char *argv[])
}
} // end of tracking
// 显示检测结果img
// cv::imshow(RGB_WINDOW, img);
cv::imshow(RGB_WINDOW, img);
cv::waitKey(10);
}
return 0;

View File

@ -7,21 +7,21 @@ using namespace std;
// yaw roll pitch
double gimbalEulerAngle[3];
void gimableCallback(double &imu_ang_r, double &imu_ang_p, double &imu_ang_y,
double &frame_ang_r, double &frame_ang_p, double &frame_ang_y,
void gimableCallback(double &frame_ang_r, double &frame_ang_p, double &frame_ang_y,
double &imu_ang_r, double &imu_ang_p, double &imu_ang_y,
double &fov_x, double &fov_y)
{
static int count = 0;
if (count == 25)
{
std::cout << "GIMBAL_CMD_RCV_POS" << std::endl;
std::cout << "=============================================" << std::endl;
std::cout << "HALL_yaw:" << frame_ang_y << " " << std::endl;
std::cout << "HALL_roll:" << frame_ang_r << " " << std::endl;
std::cout << "HALL_pitch:" << frame_ang_p << " " << std::endl;
std::cout << "GYRO_yaw:" << imu_ang_y << " " << std::endl;
std::cout << "GYRO_roll:" << imu_ang_r << " " << std::endl;
std::cout << "GYRO_pitch:" << imu_ang_p << " " << std::endl;
// std::cout << "GIMBAL_CMD_RCV_POS" << std::endl;
// std::cout << "=============================================" << std::endl;
// std::cout << "HALL_yaw:" << frame_ang_y << " " << std::endl;
// std::cout << "HALL_roll:" << frame_ang_r << " " << std::endl;
// std::cout << "HALL_pitch:" << frame_ang_p << " " << std::endl;
// std::cout << "GYRO_yaw:" << imu_ang_y << " " << std::endl;
// std::cout << "GYRO_roll:" << imu_ang_r << " " << std::endl;
// std::cout << "GYRO_pitch:" << imu_ang_p << " " << std::endl;
count = 0;
}

View File

@ -88,19 +88,20 @@ namespace sv
#ifdef PLATFORM_X86_CUDA
camera_url << "rtspsrc location = rtsp://user:0000@" << this->_ip << ":" << this->_port
<< "/cam/realmonitor?channel=1&subtype=0 latency=100 ! application/x-rtp,media=video ! \
rtph265depay ! parsebin ! avdec_h265 ! \
rtph265depay ! parsebin ! avdec_h265 ! videoscale ! video/x-raw,width=(int)" << this->_width
<< ",height=(int)" << this->_height << " ! videoflip video-direction=4 ! videoconvert ! video/x-raw,format=(string)BGR ! \
appsink sync=false";
std::cout << camera_url.str()<<std::endl;
this->_cap.open(camera_url.str(),cv::CAP_GSTREAMER);
this->_cap.open(camera_url.str(), cv::CAP_GSTREAMER);
#endif
#ifdef PLATFORM_JETSON
camera_url << "rtspsrc location = rtsp://user:0000@" << this->_ip << ":" << this->_port
<< "/cam/realmonitor?channel=1&subtype=0 latency=100 ! \
application/x-rtp,media=video ! rtph265depay ! parsebin ! \
nvv4l2decoder ! nvvidconv flip-method=4 ! \
video/x-raw,format=(string)BGRx,width=" << this->_width << ",height=" << this->_height << " ! videoconvert ! \
video/x-raw,format=(string)BGRx,width=(int)"
<< this->_width << ",height=(int)" << this->_height << " ! videoconvert ! video/x-raw,format=(string)BGR ! \
appsink sync=false";
this->_cap.open(camera_url.str(),cv::CAP_GSTREAMER);
this->_cap.open(camera_url.str(), cv::CAP_GSTREAMER);
#endif
}
else if (this->_type == CameraType::MIPI)