35 msgs::StepPlanRequestService step_plan_request_srv;
36 step_plan_request_srv.request.plan_request = step_plan_request;
40 return ErrorStatusError(msgs::ErrorStatus::ERR_UNKNOWN,
"[PatternGenerator]",
"Can't call footstep planner!");
43 if (step_plan_request_srv.response.status.error == msgs::ErrorStatus::NO_ERROR)
44 step_plan = step_plan_request_srv.response.step_plan;
46 return step_plan_request_srv.response.status;
105 return params_.simulation_mode;
169 if (first_changeable_step_index < 0)
171 ROS_ERROR(
"[PatternGenerator] updateFirstChangeableStepIndex: Stopping due to invalid step index %i", first_changeable_step_index);
184 ROS_ERROR(
"[PatternGenerator] updateFirstChangeableStepIndex: Internal error; step %i isn't in step plan.", first_changeable_step_index);
193 ROS_ERROR(
"[PatternGenerator] updateFirstChangeableStepIndex: Internal error; step %i isn't in step plan.", first_changeable_step_index);
210 if (foot.foot_index == msgs::Foot::LEFT)
215 if (foot.foot_index == msgs::Foot::RIGHT)
235 if (step.foot.foot_index == msgs::Foot::LEFT)
237 if (step.foot.foot_index == msgs::Foot::RIGHT)
243 msgs::StepPlanRequestService step_plan_request_srv;
244 msgs::StepPlanRequest& req = step_plan_request_srv.request.plan_request;
248 std_msgs::Header header;
251 msgs::Feet start_feet;
259 if (cmd.linear.x > 0.0)
268 unsigned int next_moving_foot_index = msgs::Foot::LEFT;
271 if (cmd.linear.y < 0.0 || (cmd.linear.y == 0.0 && cmd.angular.z < 0.0))
272 next_moving_foot_index = msgs::Foot::RIGHT;
274 next_moving_foot_index = msgs::Foot::LEFT;
279 next_moving_foot_index = msgs::Foot::RIGHT;
281 next_moving_foot_index = msgs::Foot::LEFT;
287 switch (next_moving_foot_index)
289 case msgs::Foot::LEFT:
291 req.start_foot_selection = msgs::StepPlanRequest::LEFT;
293 case msgs::Foot::RIGHT:
295 req.start_foot_selection = msgs::StepPlanRequest::RIGHT;
298 ROS_ERROR(
"[PatternGenerator] Unknown foot index '%u'", next_moving_foot_index);
305 if (next_moving_foot_index == msgs::Foot::LEFT)
306 req.pattern_parameters.mode = msgs::PatternParameters::FEET_REALIGN_ON_RIGHT;
308 req.pattern_parameters.mode = msgs::PatternParameters::FEET_REALIGN_ON_LEFT;
312 req.pattern_parameters.steps = n;
313 req.pattern_parameters.step_distance_forward = cmd.linear.x;
314 req.pattern_parameters.step_distance_sideward = cmd.linear.y;
315 req.pattern_parameters.turn_angle = cmd.angular.z;
316 req.pattern_parameters.close_step =
true;
317 req.pattern_parameters.extra_seperation =
false;
318 req.pattern_parameters.override =
false;
319 req.pattern_parameters.roll = 0.0;
320 req.pattern_parameters.pitch = 0.0;
321 req.pattern_parameters.mode = msgs::PatternParameters::SAMPLING;
326 req.planning_mode = msgs::StepPlanRequest::PLANNING_MODE_PATTERN;
327 req.parameter_set_name =
params_.parameter_set_name;
332 ROS_ERROR(
"[PatternGenerator] Can't call footstep planner!");
337 if (!step_plan_request_srv.response.step_plan.steps.size())
339 ROS_ERROR(
"[PatternGenerator] Received empty plan!");
346 if (
params_.ignore_invalid_steps)
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
bool call(MReq &req, MRes &res)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)