MCPcopy Create free account
hub / github.com/RoboMaster/RoboRTS / Update

Method Update

roborts_decision/executor/chassis_executor.cpp:45–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45BehaviorState ChassisExecutor::Update(){
46 actionlib::SimpleClientGoalState state = actionlib::SimpleClientGoalState::LOST;
47 switch (execution_mode_){
48 case ExcutionMode::IDLE_MODE:
49 execution_state_ = BehaviorState::IDLE;
50 break;
51
52 case ExcutionMode::GOAL_MODE:
53 state = global_planner_client_.getState();
54 if (state == actionlib::SimpleClientGoalState::ACTIVE){
55 ROS_INFO("%s : ACTIVE", __FUNCTION__);
56 execution_state_ = BehaviorState::RUNNING;
57
58 } else if (state == actionlib::SimpleClientGoalState::PENDING) {
59 ROS_INFO("%s : PENDING", __FUNCTION__);
60 execution_state_ = BehaviorState::RUNNING;
61
62 } else if (state == actionlib::SimpleClientGoalState::SUCCEEDED) {
63 ROS_INFO("%s : SUCCEEDED", __FUNCTION__);
64 execution_state_ = BehaviorState::SUCCESS;
65
66 } else if (state == actionlib::SimpleClientGoalState::ABORTED) {
67 ROS_INFO("%s : ABORTED", __FUNCTION__);
68 execution_state_ = BehaviorState::FAILURE;
69
70 } else {
71 ROS_ERROR("Error: %s", state.toString().c_str());
72 execution_state_ = BehaviorState::FAILURE;
73 }
74 break;
75
76 case ExcutionMode::SPEED_MODE:
77 execution_state_ = BehaviorState::RUNNING;
78 break;
79
80 case ExcutionMode::SPEED_WITH_ACCEL_MODE:
81 execution_state_ = BehaviorState::RUNNING;
82 break;
83
84 default:
85 ROS_ERROR("Wrong Execution Mode");
86 }
87 return execution_state_;
88
89};
90
91void ChassisExecutor::Cancel(){
92 switch (execution_mode_){

Callers

nothing calls this directly

Calls 1

getStateMethod · 0.80

Tested by

no test coverage detected