Skip to content

Commit

Permalink
added crtpCommanderHighLevelIsTrajectoryDefined() (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas authored Nov 17, 2020
1 parent 1a4cc9a commit 7ace123
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/interface/crtp_commander_high_level.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ void crtpCommanderHighLevelStop();
*/
void crtpCommanderHighLevelGoTo(const float x, const float y, const float z, const float yaw, const float duration_s, const bool relative);

/**
* @brief Returns whether the trajectory with the given ID is defined
*
* @param trajectoryId The id of the trajectory
*/
bool crtpCommanderHighLevelIsTrajectoryDefined(uint8_t trajectoryId);

/**
* @brief starts executing a specified trajectory
*
Expand Down
8 changes: 8 additions & 0 deletions src/modules/src/crtp_commander_high_level.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,14 @@ void crtpCommanderHighLevelGoTo(const float x, const float y, const float z, con
handleCommand(COMMAND_GO_TO, (const uint8_t*)&data);
}

bool crtpCommanderHighLevelIsTrajectoryDefined(uint8_t trajectoryId)
{
return (
trajectoryId < NUM_TRAJECTORY_DEFINITIONS &&
trajectory_descriptions[trajectoryId].trajectoryLocation != TRAJECTORY_LOCATION_INVALID
);
}

void crtpCommanderHighLevelStartTrajectory(const uint8_t trajectoryId, const float timeScale, const bool relative, const bool reversed)
{
struct data_start_trajectory data =
Expand Down

0 comments on commit 7ace123

Please sign in to comment.