SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
cl_moveit2z::CpTrajectoryHistory Class Reference

#include <cp_trajectory_history.hpp>

Inheritance diagram for cl_moveit2z::CpTrajectoryHistory:
Inheritance graph
Collaboration diagram for cl_moveit2z::CpTrajectoryHistory:
Collaboration graph

Public Member Functions

bool getLastTrajectory (int backIndex, moveit_msgs::msg::RobotTrajectory &trajectory)
 
bool getLastTrajectory (moveit_msgs::msg::RobotTrajectory &trajectory)
 
void pushTrajectory (std::string name, const moveit_msgs::msg::RobotTrajectory &trajectory, moveit_msgs::msg::MoveItErrorCodes result)
 
- Public Member Functions inherited from smacc2::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Private Attributes

std::vector< TrajectoryHistoryEntrytrajectoryHistory_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccComponent
virtual void onInitialize ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentTypecreateSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentTypecreateSiblingNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger () const
 
ISmaccStateMachinegetStateMachine ()
 
- Protected Attributes inherited from smacc2::ISmaccComponent
ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Detailed Description

Definition at line 37 of file cp_trajectory_history.hpp.

Member Function Documentation

◆ getLastTrajectory() [1/2]

bool cl_moveit2z::CpTrajectoryHistory::getLastTrajectory ( int  backIndex,
moveit_msgs::msg::RobotTrajectory &  trajectory 
)

Definition at line 25 of file cp_trajectory_history.cpp.

27{
28 if (trajectoryHistory_.size() == 0)
29 {
30 RCLCPP_WARN_STREAM(
31 getLogger(), "[" << getName() << "] requested index: " << backIndex
32 << ", history size: " << trajectoryHistory_.size());
33 return false;
34 }
35
36 if (backIndex < 0)
37
38 {
39 backIndex = 0;
40 }
41 else if ((size_t)backIndex >= this->trajectoryHistory_.size())
42 {
43 RCLCPP_WARN_STREAM(
44 getLogger(), "[" << getName() << "] requested index: " << backIndex
45 << ", history size: " << trajectoryHistory_.size());
46 return false;
47 }
48
49 trajectory = this->trajectoryHistory_[this->trajectoryHistory_.size() - 1 - backIndex].trajectory;
50 return true;
51}
std::vector< TrajectoryHistoryEntry > trajectoryHistory_
virtual std::string getName() const
rclcpp::Logger getLogger() const

References smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getName(), and trajectoryHistory_.

Referenced by getLastTrajectory(), cl_moveit2z::CbExecuteLastTrajectory::onEntry(), cl_moveit2z::CbMoveLastTrajectoryInitialState::onEntry(), and cl_moveit2z::CbUndoLastTrajectory::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLastTrajectory() [2/2]

bool cl_moveit2z::CpTrajectoryHistory::getLastTrajectory ( moveit_msgs::msg::RobotTrajectory &  trajectory)

Definition at line 53 of file cp_trajectory_history.cpp.

54{
55 return getLastTrajectory(-1, trajectory);
56}
bool getLastTrajectory(int backIndex, moveit_msgs::msg::RobotTrajectory &trajectory)

References getLastTrajectory().

Here is the call graph for this function:

◆ pushTrajectory()

void cl_moveit2z::CpTrajectoryHistory::pushTrajectory ( std::string  name,
const moveit_msgs::msg::RobotTrajectory &  trajectory,
moveit_msgs::msg::MoveItErrorCodes  result 
)

Definition at line 58 of file cp_trajectory_history.cpp.

61{
62 RCLCPP_INFO_STREAM(
63 getLogger(), "[" << getName() << "] adding a new trajectory to the history ( "
64 << trajectory.joint_trajectory.points.size() << " poses)");
65
66 TrajectoryHistoryEntry entry;
67 this->trajectoryHistory_.push_back(entry);
68
69 auto & last = this->trajectoryHistory_.back();
70 last.trajectory = trajectory;
71 last.result = result;
72 last.name = name;
73}

References smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getName(), cl_moveit2z::TrajectoryHistoryEntry::trajectory, and trajectoryHistory_.

Referenced by cl_moveit2z::CbMoveEndEffectorTrajectory::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ trajectoryHistory_

std::vector<TrajectoryHistoryEntry> cl_moveit2z::CpTrajectoryHistory::trajectoryHistory_
private

Definition at line 49 of file cp_trajectory_history.hpp.

Referenced by getLastTrajectory(), and pushTrajectory().


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