SMACC
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
cl_move_group_interface::CbMoveCartesianRelative2 Class Reference

#include <cb_move_cartesian_relative2.h>

Inheritance diagram for cl_move_group_interface::CbMoveCartesianRelative2:
Inheritance graph
Collaboration diagram for cl_move_group_interface::CbMoveCartesianRelative2:
Collaboration graph

Public Member Functions

 CbMoveCartesianRelative2 (std::string referenceFrame, std::string tipLink)
 
 CbMoveCartesianRelative2 (std::string referenceFrame, std::string tipLink, geometry_msgs::Vector3 offset)
 
virtual void generateTrajectory () override
 
- Public Member Functions inherited from cl_move_group_interface::CbMoveEndEffectorTrajectory
 CbMoveEndEffectorTrajectory (std::string tipLink="")
 
 CbMoveEndEffectorTrajectory (const std::vector< geometry_msgs::PoseStamped > &endEffectorTrajectory, std::string tipLink="")
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
virtual void onEntry () override
 
virtual void onExit () override
 
virtual void update () override
 
- Public Member Functions inherited from smacc::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
virtual ~SmaccAsyncClientBehavior ()
 
template<typename TCallback , typename T >
boost::signals2::connection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFailure (TCallback callback, T *object)
 
- Public Member Functions inherited from smacc::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 
ros::NodeHandle getNode ()
 
- Public Member Functions inherited from smacc::ISmaccUpdatable
 ISmaccUpdatable ()
 
 ISmaccUpdatable (ros::Duration duration)
 
void executeUpdate ()
 
void setUpdatePeriod (ros::Duration duration)
 

Public Attributes

geometry_msgs::Vector3 offset_
 
boost::optional< double > linearSpeed_m_s_
 
- Public Attributes inherited from cl_move_group_interface::CbMoveEndEffectorTrajectory
boost::optional< std::string > group_
 
boost::optional< std::string > tipLink_
 
boost::optional< boolallowInitialTrajectoryStateJointDiscontinuity_
 

Private Attributes

std::string globalFrame_
 

Additional Inherited Members

- Protected Member Functions inherited from cl_move_group_interface::CbMoveEndEffectorTrajectory
ComputeJointTrajectoryErrorCode computeJointSpaceTrajectory (moveit_msgs::RobotTrajectory &computedJointTrajectory)
 
void executeJointSpaceTrajectory (const moveit_msgs::RobotTrajectory &computedJointTrajectory)
 
virtual void generateTrajectory ()
 
virtual void createMarkers ()
 
void getCurrentEndEffectorPose (std::string globalFrame, tf::StampedTransform &currentEndEffectorTransform)
 
- Protected Member Functions inherited from smacc::SmaccAsyncClientBehavior
virtual void executeOnEntry () override
 
virtual void executeOnExit () override
 
void postSuccessEvent ()
 
void postFailureEvent ()
 
virtual void dispose () override
 
- Protected Member Functions inherited from smacc::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 
virtual void dispose ()
 
virtual void update ()=0
 
- Protected Attributes inherited from cl_move_group_interface::CbMoveEndEffectorTrajectory
std::vector< geometry_msgs::PoseStamped > endEffectorTrajectory_
 
ClMoveGroupmovegroupClient_ = nullptr
 
visualization_msgs::MarkerArray beahiorMarkers_
 

Detailed Description

Definition at line 15 of file cb_move_cartesian_relative2.h.

Constructor & Destructor Documentation

◆ CbMoveCartesianRelative2() [1/2]

cl_move_group_interface::CbMoveCartesianRelative2::CbMoveCartesianRelative2 ( std::string  referenceFrame,
std::string  tipLink 
)
inline

◆ CbMoveCartesianRelative2() [2/2]

cl_move_group_interface::CbMoveCartesianRelative2::CbMoveCartesianRelative2 ( std::string  referenceFrame,
std::string  tipLink,
geometry_msgs::Vector3  offset 
)
inline

Definition at line 28 of file cb_move_cartesian_relative2.h.

30 {
31 globalFrame_ = referenceFrame;
32 offset_ = offset;
33 }

References globalFrame_, and offset_.

Member Function Documentation

◆ generateTrajectory()

virtual void cl_move_group_interface::CbMoveCartesianRelative2::generateTrajectory ( )
inlineoverridevirtual

Reimplemented from cl_move_group_interface::CbMoveEndEffectorTrajectory.

Definition at line 35 of file cb_move_cartesian_relative2.h.

36 {
37 // at least 1 sample per centimeter (average)
38 const double METERS_PER_SAMPLE = 0.001;
39
40 float dist_meters = 0;
41 tf::Vector3 voffset;
42 tf::vector3MsgToTF(offset_, voffset);
43
44 float totallineardist = voffset.length();
45
46 int totalSamplesCount = totallineardist / METERS_PER_SAMPLE;
47 int steps = totallineardist / METERS_PER_SAMPLE;
48
49 float interpolation_factor_step = 1.0 / totalSamplesCount;
50
51 double secondsPerSample;
52
54 {
55 linearSpeed_m_s_ = 0.1;
56 }
57
58 secondsPerSample = METERS_PER_SAMPLE / (*linearSpeed_m_s_);
59
60 tf::StampedTransform currentEndEffectorTransform;
61
62 this->getCurrentEndEffectorPose(globalFrame_, currentEndEffectorTransform);
63
64 tf::Transform finalEndEffectorTransform = currentEndEffectorTransform;
65 finalEndEffectorTransform.setOrigin(finalEndEffectorTransform.getOrigin() + voffset);
66
67 float linc = totallineardist / steps; // METERS_PER_SAMPLE with sign
68 float interpolation_factor = 0;
69
70 ros::Time startTime = ros::Time::now();
71
72 for (float i = 0; i < steps; i++)
73 {
74 interpolation_factor += interpolation_factor_step;
75 dist_meters += linc;
76
77 tf::Vector3 vi = currentEndEffectorTransform.getOrigin().lerp(finalEndEffectorTransform.getOrigin(), interpolation_factor);
78
79 tf::Transform pose;
80 pose.setOrigin(vi);
81 pose.setRotation(currentEndEffectorTransform.getRotation());
82
83 geometry_msgs::PoseStamped pointerPose;
84 tf::poseTFToMsg(pose, pointerPose.pose);
85 pointerPose.header.frame_id = globalFrame_;
86 pointerPose.header.stamp = startTime + ros::Duration(i * secondsPerSample);
87
88 this->endEffectorTrajectory_.push_back(pointerPose);
89 }
90
91 ROS_INFO_STREAM("[CbMoveEndEffectorRelative2] Target End efector Pose: " << this->endEffectorTrajectory_.back());
92
93 }
void getCurrentEndEffectorPose(std::string globalFrame, tf::StampedTransform &currentEndEffectorTransform)
std::vector< geometry_msgs::PoseStamped > endEffectorTrajectory_

References cl_move_group_interface::CbMoveEndEffectorTrajectory::endEffectorTrajectory_, cl_move_group_interface::CbMoveEndEffectorTrajectory::getCurrentEndEffectorPose(), globalFrame_, linearSpeed_m_s_, and offset_.

Here is the call graph for this function:

Member Data Documentation

◆ globalFrame_

std::string cl_move_group_interface::CbMoveCartesianRelative2::globalFrame_
private

Definition at line 96 of file cb_move_cartesian_relative2.h.

Referenced by CbMoveCartesianRelative2(), and generateTrajectory().

◆ linearSpeed_m_s_

boost::optional<double> cl_move_group_interface::CbMoveCartesianRelative2::linearSpeed_m_s_

Definition at line 20 of file cb_move_cartesian_relative2.h.

Referenced by generateTrajectory().

◆ offset_

geometry_msgs::Vector3 cl_move_group_interface::CbMoveCartesianRelative2::offset_

Definition at line 18 of file cb_move_cartesian_relative2.h.

Referenced by CbMoveCartesianRelative2(), and generateTrajectory().


The documentation for this class was generated from the following file: