SMACC
Loading...
Searching...
No Matches
cp_trajectory_history.cpp
Go to the documentation of this file.
1/*****************************************************************************************************************
2 * ReelRobotix Inc. - Software License Agreement Copyright (c) 2018-2020
3 * Authors: Pablo Inigo Blasco, Brett Aldrich
4 *
5 ******************************************************************************************************************/
6
8
10{
11
12 bool CpTrajectoryHistory::getLastTrajectory(int backIndex, moveit_msgs::RobotTrajectory &trajectory)
13 {
14 if (trajectoryHistory_.size() == 0 )
15 {
16 return false;
17 }
18
19 if (backIndex < 0)
20 {
21 backIndex = 0;
22 }
23 else if(backIndex >= this->trajectoryHistory_.size())
24 {
25 return false;
26 }
27
28 trajectory = this->trajectoryHistory_[this->trajectoryHistory_.size() - 1 - backIndex].trajectory;
29 return true;
30 }
31
32 bool CpTrajectoryHistory::getLastTrajectory(moveit_msgs::RobotTrajectory &trajectory)
33 {
34 return getLastTrajectory(-1, trajectory);
35 }
36
37 void CpTrajectoryHistory::pushTrajectory(std::string name, const moveit_msgs::RobotTrajectory &trajectory, moveit_msgs::MoveItErrorCodes result)
38 {
40 this->trajectoryHistory_.push_back(entry);
41
42 auto &last = this->trajectoryHistory_.back();
43 last.trajectory = trajectory;
44 last.result = result;
45 last.name = name;
46 }
47
48} // namespace cl_move_group_interface
std::vector< TrajectoryHistoryEntry > trajectoryHistory_
bool getLastTrajectory(int backIndex, moveit_msgs::RobotTrajectory &trajectory)
void pushTrajectory(std::string name, const moveit_msgs::RobotTrajectory &trajectory, moveit_msgs::MoveItErrorCodes result)