SMACC
Loading...
Searching...
No Matches
cb_end_effector_rotate.cpp
Go to the documentation of this file.
2
4{
5 CbEndEffectorRotate::CbEndEffectorRotate(double deltaRadians, std::string tipLink)
6 : CbCircularPivotMotion(tipLink)
7 {
8 deltaRadians_ = deltaRadians;
9 }
10
12 {
13
14 }
15
17 {
18 // autocompute pivot pose
19
20 tf::TransformListener tfListener;
21 // tf::StampedTransform globalBaseLink;
22 tf::StampedTransform endEffectorInPivotFrame;
23
24 int attempts = 3;
25
26 while (attempts > 0)
27 {
28 try
29 {
31 if (!tipLink_ || *tipLink_ == "")
32 {
33 tipLink_ = this->movegroupClient_->moveGroupClientInterface.getEndEffectorLink();
34 }
35
36 auto pivotFrame = this->movegroupClient_->moveGroupClientInterface.getPlanningFrame();
37
38 tf::StampedTransform endEffectorInPivotFrame;
39
40 tfListener.waitForTransform(pivotFrame, *tipLink_, ros::Time(0), ros::Duration(10));
41 tfListener.lookupTransform(pivotFrame, *tipLink_, ros::Time(0), endEffectorInPivotFrame);
42
43 tf::poseTFToMsg(endEffectorInPivotFrame, this->planePivotPose_.pose);
44 this->planePivotPose_.header.frame_id = endEffectorInPivotFrame.frame_id_;
45 this->planePivotPose_.header.stamp = endEffectorInPivotFrame.stamp_;
46 break;
47 }
48 catch (const std::exception &e)
49 {
50 ROS_ERROR_STREAM(e.what() << ". Attempt countdown: " << attempts);
51 ros::Duration(0.5);
52 attempts--;
53 }
54 }
55
57 }
58} // namespace cl_move_group_interface
CbEndEffectorRotate(double deltaRadians, std::string tipLink="")
moveit::planning_interface::MoveGroupInterface moveGroupClientInterface
Definition: cl_movegroup.h:74
void requiresClient(SmaccClientType *&storage)