12 case READY:
return "READY";
13 case ACTIVE:
return "ACTIVE";
14 case PAUSED:
return "PAUSED";
16 case FAILED:
return "FAILED";
17 default:
return "UNKNOWN";
22 : vigir_pluginlib::Plugin(
"step_controller")
41 ROS_ERROR(
"[StepControllerPlugin] Null pointer to StepPlanMsgPlugin rejected! Fix it immediately!");
72 msgs::ExecuteStepPlanFeedback feedback;
73 feedback.last_performed_step_index = -1;
74 feedback.currently_executing_step_index = -1;
75 feedback.first_changeable_step_index = -1;
120 if (step_plan.steps.empty())
134 if (
step_queue_->updateStepPlan(step_plan, feedback.first_changeable_step_index))
142 ROS_INFO(
"[StepControllerPlugin] Updated step queue from [%i; %i]. Current queue has steps in range [%i; %i].", step_plan.steps.front().step_index, step_plan.steps.back().step_index,
step_queue_->firstStepIndex(),
step_queue_->lastStepIndex());
160 ROS_ERROR(
"[StepControllerPlugin] Step plan doesn't start with initial step (step_index = 0). Execution aborted!");
193 ROS_ERROR(
"[StepControllerPlugin] Missing step %i in queue. Execution aborted!", next_step_index);
198 ROS_ASSERT(next_step_index == step.step_index);
203 ROS_ERROR(
"[StepControllerPlugin] Error while execution request of step %i. Execution aborted!", next_step_index);
222 if (
step_queue_->firstStepIndex() <= feedback.last_performed_step_index)
223 step_queue_->removeSteps(0, feedback.last_performed_step_index);
233 ROS_INFO(
"[StepControllerPlugin] Stop requested. Resetting walk controller.");
virtual void reset()
Resets the plugin (called during construction and by stop()). The default implementation raises the R...
virtual void initWalk()=0
This method is called when new step plan has been enqueued and previously the walk controller state w...
std::string toString(const StepControllerState &state)
boost::shared_mutex plugin_mutex_
void setFeedbackState(const msgs::ExecuteStepPlanFeedback &feedback)
msgs::ExecuteStepPlanFeedback feedback_state_
virtual void preProcess(const ros::TimerEvent &event)
PreProcess Method is called before processing the walk controller, e.g. for precompute/update data or...
virtual ~StepControllerPlugin()
int getNextStepIndexNeeded() const
Returns next step index needed by the walking engine.
const msgs::ExecuteStepPlanFeedback & getFeedbackState() const
Returns current feedback information provided by the plugin.
virtual bool executeStep(const msgs::Step &step)=0
This method will be called when the next step should be added to execution pipeline. The call of this function should be triggered by the process(...) method when next_step_index_needed_ has been changed.
void updateQueueFeedback()
Updates feedback information with internal state data.
int last_step_index_sent_
vigir_footstep_planning::StepPlanMsgPlugin::Ptr step_plan_msg_plugin_
virtual bool updateStepPlan(const msgs::StepPlan &step_plan)
Merges given step plan to the current step queue of steps. Hereby, two cases have to considered: ...
StepControllerState getState() const
Get current state of execution.
virtual void process(const ros::TimerEvent &event)
Overwrite to handle robot specific behavior. The default behavior behaves as followed: ...
int getLastStepIndexSent() const
Returns last step index which has been sent to walking engine.
boost::unique_lock< Mutex > UniqueLock
StepQueue::Ptr step_queue_
virtual void setStepPlanMsgPlugin(vigir_footstep_planning::StepPlanMsgPlugin::Ptr plugin)
Sets the StepPlanMsgPlugin to be used.
void setLastStepIndexSent(int index)
void setState(StepControllerState state)
boost::shared_lock< Mutex > SharedLock
StepControllerState state_
int next_step_index_needed_
virtual void postProcess(const ros::TimerEvent &event)
PostProcess Method is called after processing step, in order to sum up the current status and cleanup...
void setNextStepIndexNeeded(int index)
virtual void stop()
Will be called when (soft) stop is requested and resets plugin.