trajectory_monitor.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Ioan Sucan */
36 
37 #ifndef MOVEIT_PLANNING_SCENE_MONITOR_TRAJECTORY_MONITOR_
38 #define MOVEIT_PLANNING_SCENE_MONITOR_TRAJECTORY_MONITOR_
39 
43 #include <boost/thread.hpp>
44 #include <memory>
45 
46 namespace planning_scene_monitor
47 {
48 typedef boost::function<void(const robot_state::RobotStateConstPtr& state, const ros::Time& stamp)>
50 
52 
56 {
57 public:
60  TrajectoryMonitor(const CurrentStateMonitorConstPtr& state_monitor, double sampling_frequency = 5.0);
61 
63 
65 
66  void stopTrajectoryMonitor();
67 
68  void clearTrajectory();
69 
70  bool isActive() const;
71 
72  double getSamplingFrequency() const
73  {
74  return sampling_frequency_;
75  }
76 
77  void setSamplingFrequency(double sampling_frequency);
78 
82  {
83  return trajectory_;
84  }
85 
87  {
88  trajectory_.swap(other);
89  }
90 
92  {
93  state_add_callback_ = callback;
94  }
95 
96 private:
97  void recordStates();
98 
99  CurrentStateMonitorConstPtr current_state_monitor_;
101 
105 
106  std::unique_ptr<boost::thread> record_states_thread_;
108 };
109 }
110 
111 #endif
void swap(robot_trajectory::RobotTrajectory &other)
void setOnStateAddCallback(const TrajectoryStateAddedCallback &callback)
std::unique_ptr< boost::thread > record_states_thread_
robot_trajectory::RobotTrajectory trajectory_
TrajectoryStateAddedCallback state_add_callback_
const robot_trajectory::RobotTrajectory & getTrajectory()
CurrentStateMonitorConstPtr current_state_monitor_
TrajectoryMonitor(const CurrentStateMonitorConstPtr &state_monitor, double sampling_frequency=5.0)
Constructor.
MOVEIT_CLASS_FORWARD(CurrentStateMonitor)
Monitors the joint_states topic and tf to record the trajectory of the robot.
void setSamplingFrequency(double sampling_frequency)
boost::function< void(const robot_state::RobotStateConstPtr &state, const ros::Time &stamp)> TrajectoryStateAddedCallback
void swapTrajectory(robot_trajectory::RobotTrajectory &other)


planning
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Wed Jul 10 2019 04:03:32