SMACC
Loading...
Searching...
No Matches
smacc_client_library
move_group_interface_client
src
move_group_interface_client
client_behaviors
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
7
#include <
move_group_interface_client/client_behaviors/cb_move_last_trajectory_initial_state.h
>
8
#include <
move_group_interface_client/components/cp_trajectory_history.h
>
9
10
namespace
cl_move_group_interface
11
{
12
CbMoveLastTrajectoryInitialState::CbMoveLastTrajectoryInitialState
()
13
{
14
}
15
16
CbMoveLastTrajectoryInitialState::CbMoveLastTrajectoryInitialState
(
int
backIndex)
17
: backIndex_(backIndex)
18
{
19
}
20
21
CbMoveLastTrajectoryInitialState::~CbMoveLastTrajectoryInitialState
()
22
{
23
}
24
25
void
CbMoveLastTrajectoryInitialState::onEntry
()
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"
);
52
CbMoveJoints::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
cb_move_last_trajectory_initial_state.h
cl_move_group_interface::CbMoveJoints::onEntry
virtual void onEntry() override
Definition:
cb_move_joints.cpp:20
cl_move_group_interface::CbMoveJoints::jointValueTarget_
std::map< std::string, double > jointValueTarget_
Definition:
cb_move_joints.h:20
cl_move_group_interface::CbMoveLastTrajectoryInitialState::~CbMoveLastTrajectoryInitialState
virtual ~CbMoveLastTrajectoryInitialState()
Definition:
cb_move_last_trajectory_initial_state.cpp:21
cl_move_group_interface::CbMoveLastTrajectoryInitialState::backIndex_
int backIndex_
Definition:
cb_move_last_trajectory_initial_state.h:25
cl_move_group_interface::CbMoveLastTrajectoryInitialState::onEntry
virtual void onEntry() override
Definition:
cb_move_last_trajectory_initial_state.cpp:25
cl_move_group_interface::CbMoveLastTrajectoryInitialState::CbMoveLastTrajectoryInitialState
CbMoveLastTrajectoryInitialState()
Definition:
cb_move_last_trajectory_initial_state.cpp:12
cl_move_group_interface::CpTrajectoryHistory
Definition:
cp_trajectory_history.h:24
cl_move_group_interface::CpTrajectoryHistory::getLastTrajectory
bool getLastTrajectory(int backIndex, moveit_msgs::RobotTrajectory &trajectory)
Definition:
cp_trajectory_history.cpp:12
smacc::ISmaccClientBehavior::getName
std::string getName() const
Definition:
smacc_client_behavior_base.cpp:16
smacc::ISmaccClientBehavior::requiresComponent
void requiresComponent(SmaccComponentType *&storage)
Definition:
smacc_client_behavior_impl.h:60
cp_trajectory_history.h
cl_move_group_interface
Definition:
cl_movegroup.h:19
Generated by
1.9.5