step_controller_test_plugin.cpp
Go to the documentation of this file.
2 
3 
4 
5 namespace vigir_step_control
6 {
9 {
10 }
11 
13 {
14 }
15 
17 {
18  // init feedback states
19  msgs::ExecuteStepPlanFeedback feedback;
20  feedback.header.stamp = ros::Time::now();
21  feedback.last_performed_step_index = -2;
22  feedback.currently_executing_step_index =-1;
23  feedback.first_changeable_step_index = 0;
24  setFeedbackState(feedback);
25 
27 
29 
30  ROS_INFO("[StepControllerTestPlugin] Start fake execution.");
31 }
32 
34 {
36 
37  if (getState() != ACTIVE)
38  return;
39 
40  // fake succesful execution of single step
42  {
43  msgs::ExecuteStepPlanFeedback feedback = getFeedbackState();
44 
45  feedback.header.stamp = ros::Time::now();
46  feedback.last_performed_step_index++;
47 
48  // check for successful execution of queue
49  if (step_queue_->lastStepIndex() == feedback.last_performed_step_index)
50  {
51  ROS_INFO("[StepControllerTestPlugin] Fake execution finished.");
52 
53  feedback.currently_executing_step_index = -1;
54  feedback.first_changeable_step_index = -1;
55  setFeedbackState(feedback);
56 
57  step_queue_->reset();
59 
61  }
62  // otherwise trigger fake execution of next step
63  else
64  {
65  feedback.currently_executing_step_index++;
66  feedback.first_changeable_step_index++;
67  setFeedbackState(feedback);
68 
69  setNextStepIndexNeeded(feedback.currently_executing_step_index);
70  }
71  }
72 }
73 
74 bool StepControllerTestPlugin::executeStep(const msgs::Step& step)
75 {
76  next_step_needed_time_ = ros::Time::now() + ros::Duration(1.0 + step.step_duration);
77  ROS_INFO("[StepControllerTestPlugin] Fake execution of step %i", step.step_index);
78  return true;
79 }
80 } // namespace
81 
82 #include <pluginlib/class_list_macros.h>
void preProcess(const ros::TimerEvent &event) override
Simulates handling of walking engine and triggers in regular interval a succesful execution of a step...
void setFeedbackState(const msgs::ExecuteStepPlanFeedback &feedback)
virtual void preProcess(const ros::TimerEvent &event)
PreProcess Method is called before processing the walk controller, e.g. for precompute/update data or...
The StepControllerPlugin class provides the basic interface in order to handle robot-specific behavio...
const msgs::ExecuteStepPlanFeedback & getFeedbackState() const
Returns current feedback information provided by the plugin.
void updateQueueFeedback()
Updates feedback information with internal state data.
StepControllerState getState() const
Get current state of execution.
#define ROS_INFO(...)
void initWalk() override
We have to initialize all variables at beginning of new step plan execution here. ...
bool executeStep(const msgs::Step &step) override
Handles fake execution of step. In fact it does nothing as accepting the step.
static Time now()


vigir_step_control
Author(s): Alexander Stumpf
autogenerated on Mon Jun 10 2019 15:44:47