M350b版本
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#include <fc_subscription/test_fc_subscription.h>
|
||||
#include "test_positioning.h"
|
||||
#include "dji_positioning.h"
|
||||
#include "dji_network_rtk.h"
|
||||
#include "dji_logger.h"
|
||||
#include "utils/util_misc.h"
|
||||
#include "dji_platform.h"
|
||||
@ -39,11 +40,11 @@
|
||||
#endif
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define POSITIONING_TASK_FREQ (1)
|
||||
#define POSITIONING_TASK_STACK_SIZE (2048)
|
||||
#define POSITIONING_TASK_FREQ (0.1)
|
||||
#define POSITIONING_TASK_STACK_SIZE (3 * 1024)
|
||||
#define TEST_RTCM_FILE_PATH_STR_MAX_SIZE (64)
|
||||
|
||||
#define DJI_TEST_POSITIONING_EVENT_COUNT (2)
|
||||
#define DJI_TEST_POSITIONING_EVENT_COUNT (1)
|
||||
#define DJI_TEST_TIME_INTERVAL_AMONG_EVENTS_US (200000)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
@ -58,8 +59,10 @@ static T_DjiReturnCode DjiTest_ReceiveRtkBaseStationRtcmDataCallback(uint8_t ind
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
static T_DjiTaskHandle s_userPositioningThread;
|
||||
static int32_t s_eventIndex = 0;
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
static char s_rtkOnAircraftRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||
static char s_rtkBaseStationRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||
#endif
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||
@ -79,7 +82,7 @@ T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||
if (osalHandler->TaskCreate("user_positioning_task", DjiTest_PositioningTask,
|
||||
POSITIONING_TASK_STACK_SIZE, NULL, &s_userPositioningThread) !=
|
||||
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("user positioning task create error.");
|
||||
USER_LOG_ERROR("user ps_extensionPortSampleIndexositioning task create error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
#else
|
||||
@ -113,6 +116,51 @@ T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void DjiTest_ReceiveNetworkRtkStateCallback(E_DjiNetworkRtkOnboardState state)
|
||||
{
|
||||
USER_LOG_INFO("Network rtk state: %d", state);
|
||||
}
|
||||
|
||||
T_DjiReturnCode DjiTest_NetworkRtkOnBoardService(E_DjiTestNetworkRtkCtrl ctrl)
|
||||
{
|
||||
T_DjiReturnCode djiStat;
|
||||
USER_LOG_INFO("Network rtk service %s..", ctrl == DJI_TEST_NETWORK_RTK_START ? "start":"stop");
|
||||
switch (ctrl)
|
||||
{
|
||||
case DJI_TEST_NETWORK_RTK_START:
|
||||
djiStat = DjiNetworkRtk_RegReceiveNetworkRtkStateCallback(DjiTest_ReceiveNetworkRtkStateCallback);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("Register receive network rtk state callback error.");
|
||||
return djiStat;
|
||||
}
|
||||
/* example account */
|
||||
T_DjiNetworkRtkServiceConfig config = {
|
||||
.account = "12345",
|
||||
.password = "12345",
|
||||
.host = "12345",
|
||||
.port = "123",
|
||||
.mountPoint = "234",
|
||||
};
|
||||
djiStat = DjiNetworkRtk_StartService(&config);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("start network rtk on aircraft error.");
|
||||
return djiStat;
|
||||
}
|
||||
break;
|
||||
case DJI_TEST_NETWORK_RTK_STOP:
|
||||
djiStat = DjiNetworkRtk_StopService();
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("stop network rtk on aircraft error.");
|
||||
return djiStat;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
#ifndef __CC_ARM
|
||||
#pragma GCC diagnostic push
|
||||
@ -168,22 +216,22 @@ static void *DjiTest_PositioningTask(void *arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
USER_LOG_DEBUG("request position of target points success.");
|
||||
USER_LOG_DEBUG("detail position information:");
|
||||
USER_LOG_INFO("request position of target points success.");
|
||||
USER_LOG_INFO("detail position information:");
|
||||
for (i = 0; i < DJI_TEST_POSITIONING_EVENT_COUNT; ++i) {
|
||||
USER_LOG_DEBUG("position solution property: %d.", positionInfo[i].positionSolutionProperty);
|
||||
USER_LOG_DEBUG("pitchAttitudeAngle: %d\trollAttitudeAngle: %d\tyawAttitudeAngle: %d",
|
||||
USER_LOG_INFO("position solution property: %d.", positionInfo[i].positionSolutionProperty);
|
||||
USER_LOG_INFO("pitchAttitudeAngle: %d\trollAttitudeAngle: %d\tyawAttitudeAngle: %d",
|
||||
positionInfo[i].uavAttitude.pitch, positionInfo[i].uavAttitude.roll,
|
||||
positionInfo[i].uavAttitude.yaw);
|
||||
USER_LOG_DEBUG("northPositionOffset: %d\tearthPositionOffset: %d\tdownPositionOffset: %d",
|
||||
USER_LOG_INFO("northPositionOffset: %d\tearthPositionOffset: %d\tdownPositionOffset: %d",
|
||||
positionInfo[i].offsetBetweenMainAntennaAndTargetPoint.x,
|
||||
positionInfo[i].offsetBetweenMainAntennaAndTargetPoint.y,
|
||||
positionInfo[i].offsetBetweenMainAntennaAndTargetPoint.z);
|
||||
USER_LOG_DEBUG("longitude: %.8f\tlatitude: %.8f\theight: %.8f",
|
||||
USER_LOG_INFO("longitude: %.8f\tlatitude: %.8f\theight: %.8f",
|
||||
positionInfo[i].targetPointPosition.longitude,
|
||||
positionInfo[i].targetPointPosition.latitude,
|
||||
positionInfo[i].targetPointPosition.height);
|
||||
USER_LOG_DEBUG(
|
||||
USER_LOG_INFO(
|
||||
"longStandardDeviation: %.8f\tlatStandardDeviation: %.8f\thgtStandardDeviation: %.8f",
|
||||
positionInfo[i].targetPointPositionStandardDeviation.longitude,
|
||||
positionInfo[i].targetPointPositionStandardDeviation.latitude,
|
||||
@ -198,9 +246,9 @@ static void *DjiTest_PositioningTask(void *arg)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
static int32_t DjiTest_SaveRtcmData(char *filePath, const uint8_t *data, uint32_t len)
|
||||
{
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
FILE *fp = NULL;
|
||||
size_t size;
|
||||
|
||||
@ -218,9 +266,9 @@ static int32_t DjiTest_SaveRtcmData(char *filePath, const uint8_t *data, uint32_
|
||||
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static T_DjiReturnCode DjiTest_ReceiveRtkOnAircraftRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||
uint16_t dataLen)
|
||||
|
||||
@ -36,12 +36,18 @@ extern "C" {
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
typedef enum {
|
||||
DJI_TEST_NETWORK_RTK_START = 0,
|
||||
DJI_TEST_NETWORK_RTK_STOP = 1,
|
||||
} E_DjiTestNetworkRtkCtrl;
|
||||
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_PositioningStartService(void);
|
||||
T_DjiReturnCode DjiTest_NetworkRtkOnBoardService(E_DjiTestNetworkRtkCtrl ctrl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user