Skip to content

CV Loiter Tick

Projects Involved: OBC

Concepts: Ticks

Abstract:

In this tick, you will be writing CVLoiter a tick that follows the Camera. The purpose of the tick is to 'loiter' or idle while waiting for the GCS operator to query an image through the /capture HTTP Request.

Goals / Questions:

  • What kind of event should cause a 'state switch' in this tick?

Files Involved:

OBC

  • ?/cvloiter.cpp
  • ?/cvloiter.hpp
  • src/core/mission_state.hpp

(Think about where these files be in the project)


Base Steps:

1. Create the base files (cpp&hpp) for the tick

You've already done this with CVLoiter. Refer back to task 4.

2. Implement the tick() method.

  • Remember what is needed for a 'state switch'.
  • What kind of condition/state can we add to the project to trigger a switch?
  • What should be in the constructor?

3. Test the tick

Remember that at this point, the state diagram looks like this:

              / ----> Verify  --> Done
             /          |
            /           v
prep --> switch ----> Camera 
            ^           |
             \          v 
              \ ---- CVLoiter 

You should verify that this is working. Try having simple logic within the ticks, just to test out if the flow of the machine is as intended. (Review the purpose of these ticks on task 1 if needed.)

Tips:

1: Tips for `tick()`

Adding a state to mission_state

A common practice for state management is dictating what event/condition will trigger a state transition. In this tick, we want to transition given that /capture has been called. What can we add to make that happen?

We can add something like:

bool has_captured = false;

in mission_state that we can access later.