SMACC
Loading...
Searching...
No Matches
cb_move_last_trajectory_initial_state.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
9
11{
13 {
14 }
15
17 : backIndex_(backIndex)
18 {
19 }
20
22 {
23 }
24
26 {
27 CpTrajectoryHistory *trajectoryHistory;
28 this->requiresComponent(trajectoryHistory);
29
30 if (trajectoryHistory != nullptr)
31 {
32 moveit_msgs::RobotTrajectory trajectory;
33
34 bool trajectoryFound = trajectoryHistory->getLastTrajectory(backIndex_, trajectory);
35
36 if (trajectoryFound)
37 {
38 trajectory_msgs::JointTrajectoryPoint &initialPoint = trajectory.joint_trajectory.points.front();
39
40 std::stringstream ss;
41 for (int i = 0; i < trajectory.joint_trajectory.joint_names.size(); i++)
42 {
43 auto &name = trajectory.joint_trajectory.joint_names[i];
44
45 jointValueTarget_[name] = initialPoint.positions[i];
46 ss << name << ": " << jointValueTarget_[name] << std::endl;
47 }
48 ROS_INFO_STREAM("[" << this->getName() << "]" << std::endl
49 << ss.str());
50
51 ROS_INFO_STREAM("[" << this->getName() << "] move joint onEntry");
53 ROS_INFO_STREAM("[" << this->getName() << "] move joint onEntry finished");
54 }
55 }
56
57 //call base OnEntry
58 }
59} // namespace cl_move_group_interface
std::map< std::string, double > jointValueTarget_
bool getLastTrajectory(int backIndex, moveit_msgs::RobotTrajectory &trajectory)
void requiresComponent(SmaccComponentType *&storage)