NEW: release DJI Payload-SDK version 3.8.0
This commit is contained in:
@ -444,63 +444,63 @@ static void DjiUser_ShowFlightStatusByOpenCV(void)
|
||||
}
|
||||
|
||||
// Display latest flight status
|
||||
cv::putText(img, "Status: ", cvPoint(30, 20), FONT_HERSHEY_SIMPLEX, 0.6,
|
||||
cv::putText(img, "Status: ", cv::Point(30, 20), FONT_HERSHEY_SIMPLEX, 0.6,
|
||||
cv::Scalar(255, 0, 0));
|
||||
|
||||
cv::putText(img, "Roll: " + cv::format("%.4f", aircraftAngles.y), cvPoint(50, 50), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::putText(img, "Roll: " + cv::format("%.4f", aircraftAngles.y), cv::Point(50, 50), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Pitch: " + cv::format("%.4f", aircraftAngles.x), cvPoint(50, 80), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::putText(img, "Pitch: " + cv::format("%.4f", aircraftAngles.x), cv::Point(50, 80), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Yaw: " + cv::format("%.4f", aircraftAngles.z), cvPoint(50, 110), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::putText(img, "Yaw: " + cv::format("%.4f", aircraftAngles.z), cv::Point(50, 110), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "WorldX: " + cv::format("%.4f", positionVo.x), cvPoint(50, 140), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::putText(img, "WorldX: " + cv::format("%.4f", positionVo.x), cv::Point(50, 140), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "WorldY: " + cv::format("%.4f", positionVo.y), cvPoint(50, 170), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::putText(img, "WorldY: " + cv::format("%.4f", positionVo.y), cv::Point(50, 170), FONT_HERSHEY_SIMPLEX, 0.5,
|
||||
cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "WorldZ: " + cv::format("%.4f", altitudeOfHomePoint), cvPoint(50, 200), FONT_HERSHEY_SIMPLEX,
|
||||
cv::putText(img, "WorldZ: " + cv::format("%.4f", altitudeOfHomePoint), cv::Point(50, 200), FONT_HERSHEY_SIMPLEX,
|
||||
0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Latitude: " + cv::format("%.4f", (dji_f64_t) s_gpsPosition.y / 10000000), cvPoint(50, 230),
|
||||
cv::putText(img, "Latitude: " + cv::format("%.4f", (dji_f64_t) s_gpsPosition.y / 10000000), cv::Point(50, 230),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Longitude: " + cv::format("%.4f", (dji_f64_t) s_gpsPosition.x / 10000000), cvPoint(50, 260),
|
||||
cv::putText(img, "Longitude: " + cv::format("%.4f", (dji_f64_t) s_gpsPosition.x / 10000000), cv::Point(50, 260),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Battery1: " + cv::format("%d%%", singleBatteryInfo1.batteryCapacityPercent), cvPoint(50, 290),
|
||||
cv::putText(img, "Battery1: " + cv::format("%d%%", singleBatteryInfo1.batteryCapacityPercent), cv::Point(50, 290),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "Battery2: " + cv::format("%d%%", singleBatteryInfo2.batteryCapacityPercent), cvPoint(50, 320),
|
||||
cv::putText(img, "Battery2: " + cv::format("%d%%", singleBatteryInfo2.batteryCapacityPercent), cv::Point(50, 320),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
|
||||
cv::putText(img, "Config: ", cvPoint(300, 20), FONT_HERSHEY_SIMPLEX, 0.6,
|
||||
cv::putText(img, "Config: ", cv::Point(300, 20), FONT_HERSHEY_SIMPLEX, 0.6,
|
||||
cv::Scalar(255, 0, 0));
|
||||
cv::putText(img, "-> RcLostAction(Sync APP): " + cv::format("%d (0-hover 1-landing 2-gohome)", rcLostAction),
|
||||
cvPoint(320, 50),
|
||||
cv::Point(320, 50),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> GoHomeAltitude(Sync APP): " + cv::format("%d", s_goHomeAltitude), cvPoint(320, 80),
|
||||
cv::putText(img, "-> GoHomeAltitude(Sync APP): " + cv::format("%d", s_goHomeAltitude), cv::Point(320, 80),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> RTK-Enable(Sync APP): " + cv::format("%d", rtkPositionEnableStatus), cvPoint(320, 110),
|
||||
cv::putText(img, "-> RTK-Enable(Sync APP): " + cv::format("%d", rtkPositionEnableStatus), cv::Point(320, 110),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> HomePointLatitude: " + cv::format("%.4f", s_homeLocation.latitude), cvPoint(320, 140),
|
||||
cv::putText(img, "-> HomePointLatitude: " + cv::format("%.4f", s_homeLocation.latitude), cv::Point(320, 140),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> HomePointLongitude: " + cv::format("%.4f", s_homeLocation.longitude), cvPoint(320, 170),
|
||||
cv::putText(img, "-> HomePointLongitude: " + cv::format("%.4f", s_homeLocation.longitude), cv::Point(320, 170),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> FlyingSpeed: " + cv::format("%.2f", s_flyingSpeed), cvPoint(320, 200),
|
||||
cv::putText(img, "-> FlyingSpeed: " + cv::format("%.2f", s_flyingSpeed), cv::Point(320, 200),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> downwardsVisEnable(Sync APP): " + cv::format("%d", downwardsVisEnable), cvPoint(320, 230),
|
||||
cv::putText(img, "-> downwardsVisEnable(Sync APP): " + cv::format("%d", downwardsVisEnable), cv::Point(320, 230),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> upwardsVisEnable(Sync APP): " + cv::format("%d", upwardsVisEnable), cvPoint(320, 260),
|
||||
cv::putText(img, "-> upwardsVisEnable(Sync APP): " + cv::format("%d", upwardsVisEnable), cv::Point(320, 260),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> horizontalVisEnable(Sync APP): " + cv::format("%d", horizontalVisEnable), cvPoint(320, 290),
|
||||
cv::putText(img, "-> horizontalVisEnable(Sync APP): " + cv::format("%d", horizontalVisEnable), cv::Point(320, 290),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
cv::putText(img, "-> ControlDevice: " + cv::format("%d", controlDevice.deviceStatus), cvPoint(320, 320),
|
||||
cv::putText(img, "-> ControlDevice: " + cv::format("%d", controlDevice.deviceStatus), cv::Point(320, 320),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(200, 0, 0));
|
||||
|
||||
cv::putText(img,
|
||||
"[Q]-Up [W]-Front [E]-Down [R]-TakeOff [T]-CancelLanding [Y]-CancelGoHome [I]-ArrestFly [O]-CancelArrestFly [P]-EmgStopMotor",
|
||||
cvPoint(30, 400), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
cv::Point(30, 400), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
cv::putText(img,
|
||||
"[A]-Left [S]-Near [D]-Right [F]-ForceLand [G]-Landing [H]-GoHome [J]-UpdateConfig [K]-Brake [L]-CancelBrakeI",
|
||||
cvPoint(30, 430), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
cv::Point(30, 430), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
cv::putText(img,
|
||||
"[Z]-Yaw- [X]-RefreshHomePoint [C]-Yaw+ [V]-ConfirmLanding [B]-TurnOn [N]-TurnOff [M]-ObtainCtrlAuth",
|
||||
cvPoint(30, 460), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
cv::Point(30, 460), FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(128, 0, 0));
|
||||
|
||||
cv::imshow("Payload SDK Command Flying Data Observation Window", img);
|
||||
cv::waitKey(1);
|
||||
|
||||
@ -286,7 +286,8 @@ start:
|
||||
}
|
||||
USER_LOG_INFO("Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA succefully.");
|
||||
}
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3 ||
|
||||
aircraftSeries == DJI_AIRCRAFT_SERIES_M3D) {
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||
@ -401,7 +402,8 @@ start:
|
||||
threeGimbalData.anglesData[gimbalMountPosition - 1].roll,
|
||||
threeGimbalData.anglesData[gimbalMountPosition - 1].yaw);
|
||||
}
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3 ||
|
||||
aircraftSeries == DJI_AIRCRAFT_SERIES_M3D) {
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES,
|
||||
(uint8_t *) &gimbalAngles,
|
||||
sizeof(T_DjiFcSubscriptionGimbalAngles),
|
||||
|
||||
@ -42,7 +42,7 @@ LiveviewSample::LiveviewSample()
|
||||
|
||||
returnCode = DjiLiveview_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
perror("Liveview init failed");
|
||||
throw ("Liveview init failed");
|
||||
}
|
||||
|
||||
streamDecoder = {
|
||||
|
||||
@ -82,9 +82,15 @@ void DjiUser_RunCameraStreamViewSample()
|
||||
char mainName[] = "MAIN_CAM";
|
||||
char viceName[] = "VICE_CAM";
|
||||
char topName[] = "TOP_CAM";
|
||||
auto *liveviewSample = new LiveviewSample();
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
LiveviewSample *liveviewSample;
|
||||
try {
|
||||
liveviewSample = new LiveviewSample();
|
||||
} catch (...) {
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiUser_GetCurrentFileDirPath(__FILE__, DJI_FILE_PATH_SIZE_MAX, curFileDirPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||
|
||||
@ -46,7 +46,7 @@ PerceptionSample::PerceptionSample()
|
||||
USER_LOG_ERROR("Perception feature will support on later version.");
|
||||
}
|
||||
|
||||
perror("Perception init failed");
|
||||
throw ("Perception init failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,10 +103,16 @@ void DjiUser_RunStereoVisionViewSample(void)
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
char inputChar;
|
||||
char isQuit;
|
||||
auto *perceptionSample = new PerceptionSample;
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiPerceptionCameraParametersPacket cameraParametersPacket = {0};
|
||||
|
||||
PerceptionSample *perceptionSample;
|
||||
try {
|
||||
perceptionSample = new PerceptionSample;
|
||||
} catch (...) {
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = osalHandler->MutexCreate(&s_stereoImagePacket.mutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Crete mutex failed, return code:0x%08X", returnCode);
|
||||
|
||||
@ -111,11 +111,6 @@ FIND_LIBRARY(FFMPEG_z_LIBRARY z
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(FFMPEG_swresample_LIBRARY swresample
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
SET(FFMPEG_LIBRARIES)
|
||||
IF(FFMPEG_INCLUDE_DIR)
|
||||
IF(FFMPEG_avformat_LIBRARY)
|
||||
@ -125,8 +120,7 @@ IF(FFMPEG_INCLUDE_DIR)
|
||||
SET( FFMPEG_BASIC_LIBRARIES
|
||||
${FFMPEG_avcodec_LIBRARY}
|
||||
${FFMPEG_avformat_LIBRARY}
|
||||
${FFMPEG_avutil_LIBRARY}
|
||||
${FFMPEG_swresample_LIBRARY}
|
||||
${FFMPEG_avutil_LIBRARY}
|
||||
)
|
||||
|
||||
# swscale is always a part of newer ffmpeg distros
|
||||
@ -184,5 +178,4 @@ MARK_AS_ADVANCED(
|
||||
FFMPEG_gsm_LIBRARY
|
||||
FFMPEG_swscale_LIBRARY
|
||||
FFMPEG_z_LIBRARY
|
||||
FFMPEG_swresample_LIBRARY
|
||||
)
|
||||
|
||||
@ -71,8 +71,7 @@ if (OpenCV_FOUND)
|
||||
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
||||
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
||||
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
|
||||
add_definitions(-DOPEN_CV_VERSION_3)
|
||||
|
||||
else ()
|
||||
|
||||
@ -54,8 +54,7 @@ if (OpenCV_FOUND)
|
||||
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
||||
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
||||
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
|
||||
add_definitions(-DOPEN_CV_VERSION_3)
|
||||
|
||||
else ()
|
||||
|
||||
Reference in New Issue
Block a user