Skip to content

Commit

Permalink
Hotfix release: Updated movement control services + flight status enu…
Browse files Browse the repository at this point in the history
…ms updated for M100
  • Loading branch information
Rohit Sant committed Apr 19, 2017
1 parent dd15f3a commit bfb6634
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 513 deletions.
31 changes: 5 additions & 26 deletions dji_sdk/src/modules/dji_sdk_node_services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ bool DJISDKNode::activation_callback(dji_sdk::Activation::Request& request, dji_

bool DJISDKNode::attitude_control_callback(dji_sdk::AttitudeControl::Request& request, dji_sdk::AttitudeControl::Response& response)
{
DJI::onboardSDK::FlightData flight_ctrl_data;
flight_ctrl_data.flag = request.flag;
flight_ctrl_data.x = request.x;
flight_ctrl_data.y = request.y;
flight_ctrl_data.z = request.z;
flight_ctrl_data.yaw = request.yaw;

rosAdapter->flight->setFlight(&flight_ctrl_data);

rosAdapter->flight->setMovementControl(request.flag, request.x, request.y, request.z, request.yaw);
response.result = true;
return true;
}
Expand Down Expand Up @@ -133,15 +125,8 @@ bool DJISDKNode::global_position_control_callback(dji_sdk::GlobalPositionControl
request.longitude, request.latitude,
global_position.longitude, global_position.latitude);

DJI::onboardSDK::FlightData flight_ctrl_data;
flight_ctrl_data.flag = 0x90;
flight_ctrl_data.x = dst_x - local_position.x;
flight_ctrl_data.y = dst_y - local_position.y;
flight_ctrl_data.z = dst_z;
flight_ctrl_data.yaw = request.yaw;

rosAdapter->flight->setFlight(&flight_ctrl_data);

uint8_t flag = 0x90;
rosAdapter->flight->setMovementControl(flag, dst_x - local_position.x, dst_y - local_position.y, dst_z, request.yaw);
response.result = true;
return true;
}
Expand All @@ -161,14 +146,8 @@ bool DJISDKNode::local_position_control_callback(dji_sdk::LocalPositionControl::
}

DJI::onboardSDK::FlightData flight_ctrl_data;
flight_ctrl_data.flag = 0x90;
flight_ctrl_data.x = dst_x - local_position.x;
flight_ctrl_data.y = dst_y - local_position.y;
flight_ctrl_data.z = dst_z;
flight_ctrl_data.yaw = request.yaw;

rosAdapter->flight->setFlight(&flight_ctrl_data);

uint8_t flag = 0x90;
rosAdapter->flight->setMovementControl(flag, dst_x - local_position.x, dst_y - local_position.y, dst_z, request.yaw);
response.result = true;
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions dji_sdk_lib/include/dji_sdk_lib/DJI_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
#define BUFFER_SIZE 1024
#define ACK_SIZE 10

//! @note The static memory flag means DJI onboardSDK library will not alloc memory from heap.
//! @note The static memory flag means DJI onboardSDK library will not alloc
//! memory from heap.
//! @todo Not supported in this release.

//#define STATIC_MEMORY

//! Uncomment these macros to access various messages from the API.
//! Uncomment these macros to access various messages from the API.

//#define API_MISSION_DATA
//#define API_TRACE_DATA
Expand Down
18 changes: 10 additions & 8 deletions dji_sdk_lib/include/dji_sdk_lib/DJI_Flight.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ class Flight
{
STATUS_MOTOR_OFF = 0,
STATUS_GROUND_STANDBY = 1,
STATUS_TAKE_OFF = 2,
STATUS_SKY_STANDBY = 3,
STATUS_LANDING = 4,
STATUS_FINISHING_LANDING = 5,
STATUS_SKY_STANDBY = 2,

STATUS_TAKE_OFF_M100ONLY = 2,
STATUS_SKY_STANDBY_M100ONLY = 3,
STATUS_LANDING_M100ONLY = 4,
STATUS_FINISHING_LANDING_M100ONLY = 5
};


Expand Down Expand Up @@ -142,9 +144,9 @@ class Flight
unsigned short task(TASK taskname, int timer);
void setArm(bool enable, CallBack ArmCallback = 0, UserData userData = 0);
unsigned short setArm(bool enable, int timer);
void control(uint8_t flag, float32_t x, float32_t y, float32_t z, float32_t yaw); //! @deprecated This function will be deprecated, please use setMovementControl instead.
void control(uint8_t flag, float32_t x, float32_t y, float32_t z, float32_t yaw); //! @deprecated This function will be deprecated, please use setMovementControl instead.
void setMovementControl(uint8_t flag, float32_t x, float32_t y, float32_t z, float32_t yaw);
void setFlight(FlightData *data); //! @deprecated old interface. PLease use setMovementControl instead.
void setFlight(FlightData *data); //! @deprecated old interface. PLease use setMovementControl instead.

QuaternionData getQuaternion() const;

Expand All @@ -156,7 +158,7 @@ class Flight
CommonData getAcceleration() const;
CommonData getYawRate() const;

//! @warning old interface. Will be replaced by MagData getMagData() in the next release.
//! @warning old interface. Will be replaced by MagData getMagData() in the next release.
MagnetData getMagnet() const;

Device getControlDevice() const;
Expand All @@ -173,7 +175,7 @@ class Flight

public: //! @note mathematical method

//! @deprecated old interface. Please use toEulerAngle instead.
//! @deprecated old interface. Please use toEulerAngle instead.
static EulerianAngle toEulerianAngle(QuaternionData data);
static EulerAngle toEulerAngle(QuaternionData quaternionData);
static QuaternionData toQuaternion(EulerianAngle eulerAngleData);
Expand Down
Loading

0 comments on commit bfb6634

Please sign in to comment.