NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
op_state_plan_exec.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef EXECUTIVE_OP_STATE_PLAN_EXEC_H_
20 #define EXECUTIVE_OP_STATE_PLAN_EXEC_H_
21 
22 #include <string>
23 #include "executive/op_state.h"
25 #include "ff_msgs/AckCompletedStatus.h"
26 
27 namespace executive {
28 class OpStatePlanExec : public OpState {
29  public:
31 
32  OpState* StartupState(std::string const& cmd_id);
33  OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
34 
36  std::string const& result_response,
37  std::string const& cmd_id,
38  Action const& action);
39 
41 
42  OpState* HandleGuestScienceAck(ff_msgs::AckStampedConstPtr const& ack);
43 
44  void AckCmd(std::string const& cmd_id,
45  uint8_t completed_status = ff_msgs::AckCompletedStatus::OK,
46  std::string const& message = "",
47  uint8_t status = ff_msgs::AckStatus::COMPLETED);
48 
49  void AckPlanCmdFailed(uint8_t completed_status, std::string const& message);
50 
51  bool PausePlan(ff_msgs::CommandStampedPtr const& cmd);
52 
53  protected:
54  explicit OpStatePlanExec(std::string const& name, unsigned char id) :
55  OpState(name, id), waiting_(false) {}
56 
57  private:
58  // allow creation only by repo
59  friend class OpStateRepo;
60 
61  OpState* HandleActionComplete(
63  Action const& action,
64  std::string const& result);
65  OpState* AckStartPlanItem();
66  OpState* StartNextPlanItem();
67 
68  bool waiting_;
69 
70  // TODO(Katie) Remove before flight
71  bool first_segment_;
72 };
73 } // namespace executive
74 #endif // EXECUTIVE_OP_STATE_PLAN_EXEC_H_
executive::OpStatePlanExec::StartupState
OpState * StartupState(std::string const &cmd_id)
Definition: op_state_plan_exec.cc:24
executive::OpStatePlanExec::HandleCmd
OpState * HandleCmd(ff_msgs::CommandStampedPtr const &cmd)
Definition: op_state_plan_exec.cc:62
executive::Action
Action
Definition: executive_action_client.h:29
executive::OpStatePlanExec::HandleGuestScienceAck
OpState * HandleGuestScienceAck(ff_msgs::AckStampedConstPtr const &ack)
Definition: op_state_plan_exec.cc:290
sequencer.h
executive::OpStateRepo
Definition: op_state_repo.h:43
executive::OpStatePlanExec
Definition: op_state_plan_exec.h:28
executive::OpStatePlanExec::OpStatePlanExec
OpStatePlanExec(std::string const &name, unsigned char id)
Definition: op_state_plan_exec.h:54
executive::OpStatePlanExec::PausePlan
bool PausePlan(ff_msgs::CommandStampedPtr const &cmd)
Definition: op_state_plan_exec.cc:341
executive::OpStatePlanExec::AckPlanCmdFailed
void AckPlanCmdFailed(uint8_t completed_status, std::string const &message)
Definition: op_state_plan_exec.cc:332
executive::OpStatePlanExec::HandleResult
OpState * HandleResult(ff_util::FreeFlyerActionState::Enum const &state, std::string const &result_response, std::string const &cmd_id, Action const &action)
Definition: op_state_plan_exec.cc:276
executive::OpStatePlanExec::~OpStatePlanExec
~OpStatePlanExec()
Definition: op_state_plan_exec.h:30
ff_util::FreeFlyerActionState::Enum
Enum
Definition: ff_action.h:41
executive::OpStatePlanExec::HandleWaitCallback
OpState * HandleWaitCallback()
Definition: op_state_plan_exec.cc:284
executive::OpStatePlanExec::AckCmd
void AckCmd(std::string const &cmd_id, uint8_t completed_status=ff_msgs::AckCompletedStatus::OK, std::string const &message="", uint8_t status=ff_msgs::AckStatus::COMPLETED)
Definition: op_state_plan_exec.cc:311
op_state.h
state
uint8_t state
Definition: signal_lights.h:90
executive::OpState::id
unsigned char const & id() const
Definition: op_state.h:82
executive::OpState::name
std::string const & name() const
Definition: op_state.h:81
executive
Definition: executive.h:87
executive::OpState
Definition: op_state.h:45