Skip to content

Commit

Permalink
Added takeoff/land with average velocity commands to public API of th…
Browse files Browse the repository at this point in the history
…e HL commander (#651)
  • Loading branch information
ntamas authored Nov 19, 2020
1 parent e6db718 commit 3b949b2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/modules/interface/crtp_commander_high_level.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ bool crtpCommanderHighLevelIsStopped();
*/
void crtpCommanderHighLevelTakeoff(const float absoluteHeight_m, const float duration_s);

/**
* @brief vertical takeoff from current x-y position to given absolute or relative
* height with given velocity
*
* @param height_m absolute or relative target height (m)
* @param velocity_m_s takeoff velocity (m/s)
* @param relative whether the height is relative to the current position
*/
void crtpCommanderHighLevelTakeoffWithVelocity(const float height_m, const float velocity_m_s, bool relative);


/**
* @brief vertical takeoff from current x-y position to given height
*
Expand All @@ -98,6 +109,16 @@ void crtpCommanderHighLevelTakeoffYaw(const float absoluteHeight_m, const float
*/
void crtpCommanderHighLevelLand(const float absoluteHeight_m, const float duration_s);

/**
* @brief vertical land from current x-y position to given absolute or relative
* height with given velocity
*
* @param height_m absolute or relative target height (m)
* @param velocity_m_s landing velocity (m/s)
* @param relative whether the height is relative to the current position
*/
void crtpCommanderHighLevelLandWithVelocity(const float height_m, const float velocity_m_s, bool relative);

/**
* @brief vertical land from current x-y position to given height
*
Expand Down
28 changes: 28 additions & 0 deletions src/modules/src/crtp_commander_high_level.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,20 @@ void crtpCommanderHighLevelTakeoffYaw(const float absoluteHeight_m, const float
handleCommand(COMMAND_TAKEOFF_2, (const uint8_t*)&data);
}

void crtpCommanderHighLevelTakeoffWithVelocity(const float height_m, const float velocity_m_s, bool relative)
{
struct data_takeoff_with_velocity data =
{
.height = height_m,
.heightIsRelative = relative,
.velocity = velocity_m_s,
.useCurrentYaw = true,
.groupMask = ALL_GROUPS,
};

handleCommand(COMMAND_TAKEOFF_WITH_VELOCITY, (const uint8_t*)&data);
}

void crtpCommanderHighLevelLand(const float absoluteHeight_m, const float duration_s)
{
struct data_land_2 data =
Expand All @@ -678,6 +692,20 @@ void crtpCommanderHighLevelLand(const float absoluteHeight_m, const float durati
handleCommand(COMMAND_LAND_2, (const uint8_t*)&data);
}

void crtpCommanderHighLevelLandWithVelocity(const float height_m, const float velocity_m_s, bool relative)
{
struct data_land_with_velocity data =
{
.height = height_m,
.heightIsRelative = relative,
.velocity = velocity_m_s,
.useCurrentYaw = true,
.groupMask = ALL_GROUPS,
};

handleCommand(COMMAND_LAND_WITH_VELOCITY, (const uint8_t*)&data);
}

void crtpCommanderHighLevelLandYaw(const float absoluteHeight_m, const float duration_s, const float yaw)
{
struct data_land_2 data =
Expand Down

0 comments on commit 3b949b2

Please sign in to comment.