Skip to content

Commit

Permalink
Hotfix release adding 3.3 support for M600 FW 1.0.1.20. See #188. Mis…
Browse files Browse the repository at this point in the history
…c bugfixes, closes #191 and some Qt sample issues.
  • Loading branch information
Rohit Sant committed Oct 19, 2017
1 parent 6e467a5 commit 00a3afa
Show file tree
Hide file tree
Showing 20 changed files with 564 additions and 293 deletions.
13 changes: 1 addition & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,4 @@ build/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
<<<<<<< HEAD
<<<<<<< HEAD
Makefile
=======
Makefile

osdk-core/test
contrib
>>>>>>> refs/heads/3.3
=======
Makefile
>>>>>>> develop
Makefile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ A new major version of DJI Onboard SDK (v3.3) was released on 15 Jun 2017. This
| | 1.7.0.0 | 3.2.15.37 | OSDK 3.2 | |
| | | | | |
| **M600/M600 Pro** | *1.0.1.60* | *3.2.41.5* | *OSDK 3.3 (Current)* | Firmware being investigated for potential in-flight instability |
| | **1.0.1.20** | **3.2.15.62** | **OSDK 3.2** | OSDK 3.3 support for this firmware coming soon |
| | **1.0.1.20** | **3.2.15.62** | **OSDK 3.3 (Current)** | |
| | 1.0.0.80 | 3.2.15.00 | OSDK 3.2 | |
| | | | | |
| **M100** | 1.3.1.0 | 3.1.10.0 | **OSDK 3.3 (Current)** | |
Expand Down
2 changes: 1 addition & 1 deletion osdk-core/api/inc/dji_ack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class ACK
static const std::map<const uint32_t, const char*> createMFIOErrorCodeMap();
static const std::map<const uint32_t, const char*> createSetArmErrorCodeMap();
static const std::map<const uint32_t, const char*>
createM100TaskErrorCodeMap();
createLegacyTaskErrorCodeMap();
}; // class ACK

} // namespace OSDK
Expand Down
25 changes: 16 additions & 9 deletions osdk-core/api/inc/dji_broadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,23 @@ class DataBroadcast

private:
/*!
* @brief Extract broadcast data for A3/N3
* @param recvFrame: the raw data payload
* @brief Extract broadcast data for A3/N3/M600
* @param recvFrame: pointer to the raw data payload
*/
void unpackData(RecvContainer* recvFrame);

/*!
* @brief Extract broadcast data for M100
* @param recvFrame: the raw data payload
* @param recvFrame: pointer to the raw data payload
*/
void unpackM100Data(RecvContainer* pRecvFrame);

/*!
* @brief Extract broadcast data for M600 FW 3.2.41.5
* @param recvFrame: pointer to the raw data payload
*/
void unpackOldM600Data(RecvContainer* recvFrame);

inline void unpackOne(FLAG flag, void* data, uint8_t*& buf, size_t size);

public:
Expand Down Expand Up @@ -355,13 +361,14 @@ class DataBroadcast
Telemetry::Battery battery ;
Telemetry::SDKInfo info ;
/*
* @note Broadcast data for Matrice 100 that is fundamentally
* different from the A3/N3
* @note Broadcast data for Matrice 100/600 older firmware that is fundamentally
* different from the A3/N3/M600 newer firmware
*/
Telemetry::M100TimeStamp m100TimeStamp;
Telemetry::M100Velocity m100Velocity;
Telemetry::M100Status m100FlightStatus;
Telemetry::M100Battery m100Battery;
Telemetry::LegacyTimeStamp legacyTimeStamp;
Telemetry::LegacyVelocity legacyVelocity;
Telemetry::LegacyStatus legacyStatus;
Telemetry::LegacyBattery legacyBattery;
Telemetry::LegacyGPSInfo legacyGPSInfo;
// clang-format on
private:
Vehicle* vehicle;
Expand Down
10 changes: 5 additions & 5 deletions osdk-core/api/inc/dji_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class Control
/*
* @note Matrice 100 flight commands
*/
typedef struct M100CMD
typedef struct LegacyCMD
{
const static int goHome = 1;
const static int takeOff = 4;
const static int landing = 6;
} M100CMD;
} LegacyCMD;

/*
* @note OSDK release 3.3
Expand Down Expand Up @@ -238,11 +238,11 @@ class Control
} AdvancedCtrlData; // pack(1)

// CMD data supported in Matrice 100
typedef struct M100CMDData
typedef struct LegacyCMDData
{
uint8_t sequence;
uint8_t cmd;
} M100CMDData; // pack (1)
} LegacyCMDData; // pack (1)
#pragma pack()

/*! @note
Expand Down Expand Up @@ -439,7 +439,7 @@ class Control
/*
* Task CMD data to send to the flight controller (supported in Matrice 100)
*/
M100CMDData m100CMDData;
LegacyCMDData legacyCMDData;
}; // class Control

} // OSDK
Expand Down
4 changes: 2 additions & 2 deletions osdk-core/api/inc/dji_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ class ErrorCode
/*
* Task ACKs Supported in firmware version < 3.3
*/
typedef struct M100Task
typedef struct LegacyTask
{
const static uint16_t SUCCESS;
const static uint16_t FAIL;
} M100Task;
} LegacyTask;

/*!
* @brief CMDID: SetArm supported in products with
Expand Down
26 changes: 20 additions & 6 deletions osdk-core/api/inc/dji_telemetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,19 @@ typedef struct HardSyncData
/*!
* @brief Matrice 100 Timestamp data, available in Broadcast telemetry (only for M100)
*/
typedef struct M100TimeStamp
typedef struct LegacyTimeStamp
{
uint32_t time;
uint32_t nanoTime;
uint8_t syncFlag;
} M100TimeStamp; // pack(1)
} LegacyTimeStamp; // pack(1)

/*!
* @brief Matrice 100 Velocity struct, returned in Broadcast telemetry (only for M100)
* @note The velocity may be in body or ground frame
* based on settings in DJI Assistant 2's SDK page.
*/
typedef struct M100Velocity
typedef struct LegacyVelocity
{
float32_t x;
float32_t y;
Expand All @@ -523,18 +523,32 @@ typedef struct M100Velocity
uint8_t health : 1;
uint8_t sensorID : 4;
uint8_t reserve : 3;
} M100Velocity; // pack(1)
} LegacyVelocity; // pack(1)

typedef uint16_t EnableFlag; // pack(1)

/*!
* @brief Return type for flight status data broadcast (only for M100). Returns VehicleStatus::M100FlightStatus.
*/
typedef uint8_t M100Status; // pack(1)
typedef uint8_t LegacyStatus; // pack(1)
/*!
* @brief Return type for battery data broadcast (only for M100). Returns percentage.
*/
typedef uint8_t M100Battery; // pack(1)
typedef uint8_t LegacyBattery; // pack(1)

/*!
* @brief struct for GPSInfo of data broadcast
*
* @note only work outside of simulation
*/
typedef struct LegacyGPSInfo
{
PositionTimeStamp time;
int32_t longitude; /*!< 1/1.0e7deg */
int32_t latitude; /*!< 1/1.0e7deg */
int32_t HFSL; /*!< height above mean sea level (mm) */
Vector3f velocityNED; /*!< cm/s */
} LegacyGPSInfo; // pack(1)

#pragma pack()

Expand Down
6 changes: 5 additions & 1 deletion osdk-core/api/inc/dji_vehicle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,12 @@ class Vehicle
Version::FirmWare getFwVersion() const;
char* getHwVersion() const;
char* getHwSerialNum() const;
bool isLegacyM600();
bool isM100();

void setKey(const char* key);


void setKey(const char* key);
void setStopCond(bool stopCond);
bool getStopCond();
CircularBuffer* circularBuffer; //! @note not used yet
Expand Down
34 changes: 23 additions & 11 deletions osdk-core/api/src/dji_ack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ ACK::createTaskErrorCodeMap()
/*
* Supported in Matrice 100
*/
const std::pair<const uint32_t, const char*> M100TaskData[] = {
std::make_pair(OpenProtocol::ErrorCode::ControlACK::M100Task::SUCCESS,
const std::pair<const uint32_t, const char*> LegacyTaskData[] = {
std::make_pair(OpenProtocol::ErrorCode::ControlACK::LegacyTask::SUCCESS,
(const char*)"CONTROLLER_SUCCESS\n"),
std::make_pair(OpenProtocol::ErrorCode::ControlACK::M100Task::FAIL,
std::make_pair(OpenProtocol::ErrorCode::ControlACK::LegacyTask::FAIL,
(const char*)"CONTROLLER_FAIL\n")
};

const std::map<const uint32_t, const char*>
ACK::createM100TaskErrorCodeMap()
ACK::createLegacyTaskErrorCodeMap()
{
const std::map<const uint32_t, const char*> errorCodeMap(
M100TaskData, M100TaskData + sizeof M100TaskData / sizeof M100TaskData[0]);
LegacyTaskData, LegacyTaskData + sizeof LegacyTaskData / sizeof LegacyTaskData[0]);
return errorCodeMap;
}

Expand Down Expand Up @@ -501,7 +501,7 @@ ACK::getError(ACK::ErrorCode ack)
else if (memcmp(cmd, OpenProtocol::CMDSet::Control::setArm, sizeof(cmd)) == 0)
{
/*
* SetArm command supported in Matrice 100
* SetArm command supported in Matrice 100/ M600 old firmware
*/
return (ack.data == OpenProtocol::ErrorCode::ControlACK::SetArm::SUCCESS)
? ACK::SUCCESS
Expand All @@ -514,7 +514,15 @@ ACK::getError(ACK::ErrorCode ack)
}
else if (memcmp(cmd, OpenProtocol::CMDSet::Control::task, sizeof(cmd)) == 0)
{
if (ack.info.version != Version::M100_31)
if (ack.info.version == Version::FW(3,2,15,62))
{
//! ACKs supported in Matrice 600 old firmware
return (ack.data ==
OpenProtocol::ErrorCode::ControlACK::LegacyTask::SUCCESS)
? ACK::SUCCESS
: ACK::FAIL;
}
else if (ack.info.version != Version::M100_31)
{
return (ack.data == OpenProtocol::ErrorCode::ControlACK::Task::SUCCESS)
? ACK::SUCCESS
Expand All @@ -524,7 +532,7 @@ ACK::getError(ACK::ErrorCode ack)
{
//! ACKs supported in Matrice 100
return (ack.data ==
OpenProtocol::ErrorCode::ControlACK::M100Task::SUCCESS)
OpenProtocol::ErrorCode::ControlACK::LegacyTask::SUCCESS)
? ACK::SUCCESS
: ACK::FAIL;
}
Expand Down Expand Up @@ -746,13 +754,17 @@ ACK::getCMDIDTaskMSG(ACK::ErrorCode ack)
{
std::map<const uint32_t, const char*> taskErrorCodeMap;

if (ack.info.version != Version::M100_31)
if (ack.info.version == Version::FW(3,2,15,62))
{
taskErrorCodeMap = static_cast<std::map<const uint32_t, const char*>>(ACK::createLegacyTaskErrorCodeMap());
}
else if (ack.info.version == Version::M100_31)
{
taskErrorCodeMap = ACK::createTaskErrorCodeMap();
taskErrorCodeMap = static_cast<std::map<const uint32_t, const char*>>(ACK::createLegacyTaskErrorCodeMap());
}
else
{
taskErrorCodeMap = ACK::createM100TaskErrorCodeMap();
taskErrorCodeMap = static_cast<std::map<const uint32_t, const char*>>(ACK::createTaskErrorCodeMap());
}

auto msg = taskErrorCodeMap.find(ack.data);
Expand Down
Loading

0 comments on commit 00a3afa

Please sign in to comment.