27: jointValueTarget_(jointValueTarget)
39 moveit::planning_interface::MoveGroupInterface move_group(
40 getNode(), moveit::planning_interface::MoveGroupInterface::Options(*(this->
group_)));
50 moveit::planning_interface::MoveGroupInterface & moveGroupInterface,
51 std::map<std::string, double> & targetJoints)
53 auto state = moveGroupInterface.getCurrentState();
55 if (state ==
nullptr)
return std::string();
57 auto vnames = state->getVariableNames();
61 for (
auto & tgj : targetJoints)
63 auto it = std::find(vnames.begin(), vnames.end(), tgj.first);
64 auto index = std::distance(vnames.begin(), it);
66 ss << tgj.first <<
":" << state->getVariablePosition(index) << std::endl;
77 moveit::planning_interface::MoveGroupInterface::Plan computedMotionPlan;
82 getLogger(),
"[CbMoveJoints] No joint was value specified. Skipping planning call.");
90 (moveGroupInterface.plan(computedMotionPlan) ==
91 moveit::planning_interface::MoveItErrorCode::SUCCESS);
92 RCLCPP_INFO(
getLogger(),
"Success Visualizing plan 1 (pose goal) %s", success ?
"" :
"FAILED");
97 auto executionResult = moveGroupInterface.execute(computedMotionPlan);
101 if (executionResult == moveit_msgs::msg::MoveItErrorCodes::SUCCESS)
105 <<
"] motion execution succeeded. Throwing success event. " << std::endl
113 getLogger(),
"[" << this->
getName() <<
"] motion execution failed. Throwing fail event."
124 getLogger(),
"[" << this->
getName() <<
"] motion execution failed. Throwing fail event."
std::optional< std::string > group_
virtual void onEntry() override
std::optional< double > scalingFactor_
std::map< std::string, double > jointValueTarget_
ClMoveGroup * movegroupClient_
void moveJoints(moveit::planning_interface::MoveGroupInterface &moveGroupInterface)
virtual void onExit() override
std::shared_ptr< moveit::planning_interface::MoveGroupInterface > moveGroupClientInterface
void postEventMotionExecutionFailed()
void postEventMotionExecutionSucceded()
std::string getName() const
virtual rclcpp::Logger getLogger()
virtual rclcpp::Node::SharedPtr getNode()
void requiresClient(SmaccClientType *&storage)
std::string currentJointStatesToString(moveit::planning_interface::MoveGroupInterface &moveGroupInterface, std::map< std::string, double > &targetJoints)