26 moveit::planning_interface::MoveGroupInterface move_group(*(this->
group_));
35 std::string
currentJointStatesToString(moveit::planning_interface::MoveGroupInterface &moveGroupInterface, std::map<std::string, double>& targetJoints)
37 auto state = moveGroupInterface.getCurrentState();
38 auto vnames = state->getVariableNames();
42 for(
auto& tgj: targetJoints)
44 auto it = std::find(vnames.begin(),vnames.end(), tgj.first);
45 auto index = std::distance(vnames.begin(), it);
47 ss << tgj.first <<
":" << state->getVariablePosition(index) << std::endl;
59 moveit::planning_interface::MoveGroupInterface::Plan computedMotionPlan;
63 ROS_WARN(
"[CbMoveJoints] No joint was value specified. Skipping planning call.");
70 success = (moveGroupInterface.plan(computedMotionPlan) == moveit::core::MoveItErrorCode::SUCCESS);
71 ROS_INFO_NAMED(
"CbMoveJoints",
"Success Visualizing plan 1 (pose goal) %s", success ?
"" :
"FAILED");
76 auto executionResult = moveGroupInterface.execute(computedMotionPlan);
80 if (executionResult == moveit_msgs::MoveItErrorCodes::SUCCESS)
82 ROS_INFO_STREAM(
"[" << this->
getName() <<
"] motion execution succeeded. Throwing success event. " << std::endl
89 ROS_WARN_STREAM(
"[" << this->
getName() <<
"] motion execution failed. Throwing fail event." << std::endl
98 ROS_WARN_STREAM(
"[" << this->
getName() <<
"] motion execution failed. Throwing fail event." << std::endl << statestr);
virtual void onEntry() override
boost::optional< double > scalingFactor_
std::map< std::string, double > jointValueTarget_
ClMoveGroup * movegroupClient_
void moveJoints(moveit::planning_interface::MoveGroupInterface &moveGroupInterface)
boost::optional< std::string > group_
virtual void onExit() override
void postEventMotionExecutionFailed()
moveit::planning_interface::MoveGroupInterface moveGroupClientInterface
void postEventMotionExecutionSucceded()
std::string getName() const
void requiresClient(SmaccClientType *&storage)
std::string currentJointStatesToString(moveit::planning_interface::MoveGroupInterface &moveGroupInterface, std::map< std::string, double > &targetJoints)