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 auto result = moveGroupInterface.plan(computedMotionPlan);
92 success = (result == moveit::core::MoveItErrorCode::SUCCESS);
95 getLogger(),
"[CbMoveJoints] Execution plan result %s (%d)", success ?
"SUCCESS" :
"FAILED",
101 auto executionResult = moveGroupInterface.execute(computedMotionPlan);
105 if (executionResult == moveit_msgs::msg::MoveItErrorCodes::SUCCESS)
109 <<
"] motion execution succeeded. Throwing success event. " << std::endl
119 "[" << this->
getName() <<
"] motion execution failed. Throwing fail event." << std::endl
131 "[" << this->
getName() <<
"] motion execution failed. Throwing fail event." << std::endl
ClMoveit2z * movegroupClient_
virtual void onEntry() override
std::map< std::string, double > jointValueTarget_
virtual void onExit() override
void moveJoints(moveit::planning_interface::MoveGroupInterface &moveGroupInterface)
std::optional< double > scalingFactor_
std::optional< std::string > group_
std::shared_ptr< moveit::planning_interface::MoveGroupInterface > moveGroupClientInterface
void postEventMotionExecutionFailed()
void postEventMotionExecutionSucceded()
std::string getName() const
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
void requiresClient(SmaccClientType *&storage)
std::string currentJointStatesToString(moveit::planning_interface::MoveGroupInterface &moveGroupInterface, std::map< std::string, double > &targetJoints)