SMACC
Loading...
Searching...
No Matches
cb_undo_last_trajectory.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 ******************************************************************************************************************/
8
10{
11
13 {
14 }
15
17 : backIndex_(backIndex)
18 {
19 }
20
22 {
23 }
24
26 {
27 CpTrajectoryHistory *trajectoryHistory;
28 this->requiresComponent(trajectoryHistory);
30
31 if (trajectoryHistory->getLastTrajectory(backIndex_, trajectory))
32 {
33 auto initialTime = trajectory.joint_trajectory.points.back().time_from_start;
34
36
37 std::reverse(reversed.joint_trajectory.points.begin(), reversed.joint_trajectory.points.end());
38
39 for (auto &jp : reversed.joint_trajectory.points)
40 {
41 jp.time_from_start = ros::Duration(fabs(jp.time_from_start.toSec() - initialTime.toSec())); //ros::Duration(t);
42 }
43
45 }
46 }
47
48} // namespace cl_move_group_interface
void executeJointSpaceTrajectory(const moveit_msgs::RobotTrajectory &computedJointTrajectory)
bool getLastTrajectory(int backIndex, moveit_msgs::RobotTrajectory &trajectory)
void requiresComponent(SmaccComponentType *&storage)
void requiresClient(SmaccClientType *&storage)