Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skeleton layout of remaining mission ticks #130

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions include/ticks/airdrop_approach.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef INCLUDE_TICKS_AIRDROP_APPROACH_HPP_
#define INCLUDE_TICKS_AIRDROP_APPROACH_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* Fly to aidrop points and communicate with airdrop mechanism.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/airdropapproach/
*/
class AirdropApproachTick : public Tick {
public:
explicit AirdropApproachTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_AIRDROP_APPROACH_HPP_
21 changes: 21 additions & 0 deletions include/ticks/auto_landing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef INCLUDE_TICKS_AUTO_LANDING_HPP_
#define INCLUDE_TICKS_AUTO_LANDING_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/autolanding/
*/
class AutoLandingTick : public Tick {
public:
explicit AutoLandingTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_AUTO_LANDING_HPP_
24 changes: 24 additions & 0 deletions include/ticks/cv_loiter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef INCLUDE_TICKS_CV_LOITER_HPP_
#define INCLUDE_TICKS_CV_LOITER_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* Stop taking photos, loiter away from the search zone
* and wait until CV processing is done.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/cvloiter/
*/
class CVLoiterTick : public Tick {
public:
explicit CVLoiterTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_CV_LOITER_HPP_
24 changes: 24 additions & 0 deletions include/ticks/fly_search.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef INCLUDE_TICKS_FLY_SEARCH_HPP_
#define INCLUDE_TICKS_FLY_SEARCH_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* Take photos and run CV pipeline while flying over
* search region
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/flysearch/
*/
class FlySearchTick : public Tick {
public:
explicit FlySearchTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_FLY_SEARCH_HPP_
23 changes: 23 additions & 0 deletions include/ticks/fly_waypoints.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef INCLUDE_TICKS_FLY_WAYPOINTS_HPP_
#define INCLUDE_TICKS_FLY_WAYPOINTS_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* Handles logic during flight of initial waypoints
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/flywaypoints/
*/
class FlyWaypointsTick : public Tick {
public:
explicit FlyWaypointsTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_FLY_WAYPOINTS_HPP_
18 changes: 16 additions & 2 deletions include/ticks/ids.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ enum class TickID {
PathGen,
PathValidate,
MissionUpload,
MissionStart
Takeoff,
FlyWaypoints,
FlySearch,
CVLoiter,
AirdropApproach,
ManualLanding,
AutoLanding,
MissionDone
};

#define _SET_TICK_ID_MAPPING(id) \
Expand All @@ -20,7 +27,14 @@ constexpr const char* TICK_ID_TO_STR(TickID id) {
_SET_TICK_ID_MAPPING(PathGen);
_SET_TICK_ID_MAPPING(PathValidate);
_SET_TICK_ID_MAPPING(MissionUpload);
_SET_TICK_ID_MAPPING(MissionStart);
_SET_TICK_ID_MAPPING(Takeoff);
_SET_TICK_ID_MAPPING(FlyWaypoints);
_SET_TICK_ID_MAPPING(FlySearch);
_SET_TICK_ID_MAPPING(CVLoiter);
_SET_TICK_ID_MAPPING(AirdropApproach);
_SET_TICK_ID_MAPPING(ManualLanding);
_SET_TICK_ID_MAPPING(AutoLanding);
_SET_TICK_ID_MAPPING(MissionDone);
default: return "Unknown TickID";
}
}
Expand Down
21 changes: 21 additions & 0 deletions include/ticks/manual_landing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef INCLUDE_TICKS_MANUAL_LANDING_HPP_
#define INCLUDE_TICKS_MANUAL_LANDING_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/manuallanding/
*/
class ManualLandingTick : public Tick {
public:
explicit ManualLandingTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_MANUAL_LANDING_HPP_
21 changes: 21 additions & 0 deletions include/ticks/mission_done.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef INCLUDE_TICKS_MISSION_DONE_HPP_
#define INCLUDE_TICKS_MISSION_DONE_HPP_

#include <memory>
#include <chrono>

#include "ticks/tick.hpp"

/*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/missiondone/
*/
class MissionDoneTick : public Tick {
public:
explicit MissionDoneTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_MISSION_DONE_HPP_
2 changes: 2 additions & 0 deletions include/ticks/mission_prep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/*
* Checks every second whether or not a valid mission has been uploaded.
* Transitions to PathGenTick once it has been generated.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/missionprep/
*/
class MissionPrepTick : public Tick {
public:
Expand Down
4 changes: 3 additions & 1 deletion include/ticks/mission_upload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#include "ticks/tick.hpp"

/*
*
* Handles uploading waypoint mission to the Pixhawk flight
* controller over Mavlink messages.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/missionupload/
*/
class MissionUploadTick: public Tick {
public:
Expand Down
2 changes: 2 additions & 0 deletions include/ticks/path_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/*
* Generates a path, caches the path in the mission state,
* then waits for it to be validated.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/pathgen/
*/
class PathGenTick : public Tick {
public:
Expand Down
5 changes: 3 additions & 2 deletions include/ticks/path_validate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#include "core/mission_state.hpp"

/*
* Generates a path, caches the path in the mission state,
* then waits for it to be validated.
* Check validation of the generated path by the GCS.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/pathvalidate/
*/
class PathValidateTick : public Tick {
public:
Expand Down
14 changes: 7 additions & 7 deletions include/ticks/mission_start.hpp → include/ticks/takeoff.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#ifndef INCLUDE_TICKS_MISSION_START_HPP_
#define INCLUDE_TICKS_MISSION_START_HPP_
#ifndef INCLUDE_TICKS_TAKEOFF_HPP_
#define INCLUDE_TICKS_TAKEOFF_HPP_

#include <memory>
#include <chrono>
#include <string>
#include <future>

#include "ticks/tick.hpp"

/*
* Waits until the plane has been switched into autopilot mode, then switches to the
* next state. IF we ever implement autonomous takeoff, this will need to be replaced.
*
* See https://tritonuas.github.io/wiki/software/obc/tick_architecture/ticks/takeoff/
*/
class MissionStartTick: public Tick {
class TakeoffTick: public Tick {
public:
explicit MissionStartTick(std::shared_ptr<MissionState> state);
explicit TakeoffTick(std::shared_ptr<MissionState> state);

std::chrono::milliseconds getWait() const override;

Tick* tick() override;
};

#endif // INCLUDE_TICKS_MISSION_START_HPP_
#endif // INCLUDE_TICKS_TAKEOFF_HPP_
9 changes: 8 additions & 1 deletion include/utilities/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ const std::chrono::milliseconds MISSION_PREP_TICK_WAIT = std::chrono::millisecon
const std::chrono::milliseconds PATH_GEN_TICK_WAIT = std::chrono::milliseconds(1000);
const std::chrono::milliseconds PATH_VALIDATE_TICK_WAIT = std::chrono::milliseconds(1000);
const std::chrono::milliseconds MISSION_UPLOAD_TICK_WAIT = std::chrono::milliseconds(1000);
const std::chrono::milliseconds MISSION_START_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds TAKEOFF_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds FLY_WAYPOINTS_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds FLY_SEARCH_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds CV_LOITER_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds AIRDROP_APPROACH_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds MANUAL_LANDING_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds AUTO_LANDING_TICK_WAIT = std::chrono::milliseconds(100);
const std::chrono::milliseconds MISSION_DONE_TICK_WAIT = std::chrono::milliseconds(100);

const double EARTH_RADIUS_METERS = 6378137.0;

Expand Down
17 changes: 17 additions & 0 deletions src/ticks/airdrop_approach.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/airdrop_approach.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

AirdropApproachTick::AirdropApproachTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::AirdropApproach) {}

std::chrono::milliseconds AirdropApproachTick::getWait() const {
return AIRDROP_APPROACH_TICK_WAIT;
}

Tick* AirdropApproachTick::tick() {
return nullptr;
}
17 changes: 17 additions & 0 deletions src/ticks/auto_landing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/auto_landing.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

AutoLandingTick::AutoLandingTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::AutoLanding) {}

std::chrono::milliseconds AutoLandingTick::getWait() const {
return AUTO_LANDING_TICK_WAIT;
}

Tick* AutoLandingTick::tick() {
return nullptr;
}
17 changes: 17 additions & 0 deletions src/ticks/cv_loiter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/cv_loiter.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

CVLoiterTick::CVLoiterTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::CVLoiter) {}

std::chrono::milliseconds CVLoiterTick::getWait() const {
return CV_LOITER_TICK_WAIT;
}

Tick* CVLoiterTick::tick() {
return nullptr;
}
17 changes: 17 additions & 0 deletions src/ticks/fly_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/fly_search.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

FlySearchTick::FlySearchTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::FlySearch) {}

std::chrono::milliseconds FlySearchTick::getWait() const {
return FLY_SEARCH_TICK_WAIT;
}

Tick* FlySearchTick::tick() {
return nullptr;
}
17 changes: 17 additions & 0 deletions src/ticks/fly_waypoints.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/fly_waypoints.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

FlyWaypointsTick::FlyWaypointsTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::FlyWaypoints) {}

std::chrono::milliseconds FlyWaypointsTick::getWait() const {
return FLY_WAYPOINTS_TICK_WAIT;
}

Tick* FlyWaypointsTick::tick() {
return nullptr;
}
17 changes: 17 additions & 0 deletions src/ticks/manual_landing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ticks/manual_landing.hpp"

#include <memory>

#include "ticks/ids.hpp"
#include "utilities/constants.hpp"

ManualLandingTick::ManualLandingTick(std::shared_ptr<MissionState> state)
:Tick(state, TickID::ManualLanding) {}

std::chrono::milliseconds ManualLandingTick::getWait() const {
return MANUAL_LANDING_TICK_WAIT;
}

Tick* ManualLandingTick::tick() {
return nullptr;
}
Loading