Go to the documentation of this file.
48 #include <moveit_msgs/GetPlanningScene.h>
49 #include <boost/noncopyable.hpp>
50 #include <boost/thread/shared_mutex.hpp>
51 #include <boost/thread/recursive_mutex.hpp>
61 class PlanningSceneMonitor :
private boost::noncopyable
112 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
113 const std::string& name =
"");
121 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
122 const std::string& name =
"");
130 PlanningSceneMonitor(
const planning_scene::PlanningScenePtr& scene,
const std::string& robot_description,
131 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
132 const std::string& name =
"");
141 const robot_model_loader::RobotModelLoaderPtr& rml,
142 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
143 const std::string& name =
"");
155 const robot_model_loader::RobotModelLoaderPtr& rml,
const ros::NodeHandle& nh,
156 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
157 const std::string& name =
"");
162 const std::string&
getName()
const
173 const moveit::core::RobotModelConstPtr&
getRobotModel()
const
209 bool updatesScene(
const planning_scene::PlanningSceneConstPtr& scene)
const;
215 bool updatesScene(
const planning_scene::PlanningScenePtr& scene)
const;
249 const std::shared_ptr<tf2_ros::Buffer>&
getTFClient()
const
364 const bool load_octomap_monitor =
true);
419 void initialize(
const planning_scene::PlanningScenePtr& scene);
465 planning_scene::PlanningScenePtr
scene_;
475 std::shared_ptr<ros::AsyncSpinner>
spinner_;
520 std::vector<std::pair<occupancy_map_monitor::ShapeHandle, std::size_t> > >
523 std::vector<std::pair<occupancy_map_monitor::ShapeHandle, std::size_t> > >;
525 std::map<std::string, std::vector<std::pair<occupancy_map_monitor::ShapeHandle, const Eigen::Isometry3d*> > >;
544 void onStateUpdate(
const sensor_msgs::JointStateConstPtr& joint_state);
554 moveit_msgs::GetPlanningScene::Response& res);
581 robot_model_loader::RobotModelLoaderPtr
rm_loader_;
628 operator bool()
const
633 operator const planning_scene::PlanningSceneConstPtr &()
const
638 const planning_scene::PlanningSceneConstPtr&
operator->()
const
714 operator const planning_scene::PlanningScenePtr &()
719 const planning_scene::PlanningScenePtr&
operator->()
void excludeWorldObjectFromOctree(const collision_detection::World::ObjectConstPtr &obj)
ros::Subscriber planning_scene_world_subscriber_
CollisionBodyShapeHandles collision_body_shape_handles_
void publishDebugInformation(bool flag)
void onStateUpdate(const sensor_msgs::JointStateConstPtr &joint_state)
void currentWorldObjectUpdateCallback(const collision_detection::World::ObjectConstPtr &object, collision_detection::World::Action action)
Callback for a change in the world maintained by the planning scene.
double getDefaultRobotScale() const
Get the default robot scaling.
double default_attached_padd_
default attached padding
std::map< std::string, double > default_robot_link_padd_
default robot link padding
void configureDefaultPadding()
Configure the default padding.
AttachedBodyShapeHandles attached_body_shape_handles_
static const std::string DEFAULT_PLANNING_SCENE_SERVICE
The name of the service used by default for requesting full planning scene state.
std::map< ShapeHandle, Eigen::Isometry3d, std::less< ShapeHandle >, Eigen::aligned_allocator< std::pair< const ShapeHandle, Eigen::Isometry3d > > > ShapeTransformCache
void triggerSceneUpdateEvent(SceneUpdateType update_type)
This function is called every time there is a change to the planning scene.
bool getShapeTransformCache(const std::string &target_frame, const ros::Time &target_time, occupancy_map_monitor::ShapeTransformCache &cache) const
void stopStateMonitor()
Stop the state monitor.
bool updatesScene(const planning_scene::PlanningSceneConstPtr &scene) const
Return true if the scene scene can be updated directly or indirectly by this monitor....
bool newPlanningSceneMessage(const moveit_msgs::PlanningScene &scene)
const CurrentStateMonitorPtr & getStateMonitor() const
Get the stored instance of the stored current state monitor.
void octomapUpdateCallback()
Callback for octomap updates.
void addUpdateCallback(const boost::function< void(SceneUpdateType)> &fn)
Add a function to be called when an update to the scene is received.
std::shared_ptr< ros::AsyncSpinner > spinner_
CurrentStateMonitorPtr & getStateMonitorNonConst()
collision_detection::CollisionPluginLoader collision_loader_
void scenePublishingThread()
double default_robot_padd_
default robot padding
ros::Subscriber attached_collision_object_subscriber_
void setStateUpdateFrequency(double hz)
Update the scene using the monitored state at a specified frequency, in Hz. This function has an effe...
void collisionObjectCallback(const moveit_msgs::CollisionObjectConstPtr &obj)
Callback for a new collision object msg.
planning_scene::PlanningSceneConstPtr scene_const_
const PlanningSceneMonitorPtr & getPlanningSceneMonitor()
boost::recursive_mutex update_lock_
lock access to update_callbacks_
ros::Subscriber collision_object_subscriber_
const planning_scene::PlanningScenePtr & getPlanningScene()
Avoid this function! Returns an unsafe pointer to the current planning scene.
LockedPlanningSceneRW(const PlanningSceneMonitorPtr &planning_scene_monitor)
void updateFrameTransforms()
Update the transforms for the frames that are not part of the kinematic model using tf....
std::map< const moveit::core::LinkModel *, std::vector< std::pair< occupancy_map_monitor::ShapeHandle, std::size_t > > > LinkShapeHandles
const std::string & getName() const
Get the name of this monitor.
void excludeWorldObjectsFromOctree()
ros::Time last_robot_motion_time_
Last time the state was updated.
robot_model_loader::RobotModelLoaderPtr rm_loader_
SceneUpdateType new_scene_update_
std::shared_ptr< tf2_ros::Buffer > tf_buffer_
ros::WallTimer state_update_timer_
timer for state updates.
double default_robot_scale_
default robot scaling
This is a convenience class for obtaining access to an instance of a locked PlanningScene.
boost::mutex state_pending_mutex_
void initialize(const planning_scene::PlanningScenePtr &scene)
Initialize the planning scene monitor.
SceneUpdateType publish_update_types_
std::unique_ptr< occupancy_map_monitor::OccupancyMapMonitor > octomap_monitor_
void updateSceneWithCurrentState()
Update the scene using the monitored state. This function is automatically called when an update to t...
const moveit::core::RobotModelConstPtr & getRobotModel() const
double getDefaultAttachedObjectPadding() const
Get the default attached padding.
ros::Time last_update_time_
mutex for stored scene
std::map< std::string, std::vector< std::pair< occupancy_map_monitor::ShapeHandle, const Eigen::Isometry3d * > > > CollisionBodyShapeHandles
boost::condition_variable_any new_scene_update_condition_
void lockSceneRead()
Lock the scene for reading (multiple threads can lock for reading at the same time)
void unlockSceneRead()
Unlock the scene from reading (multiple threads can lock for reading at the same time)
static const std::string DEFAULT_PLANNING_SCENE_WORLD_TOPIC
SingleUnlock(PlanningSceneMonitor *planning_scene_monitor, bool read_only)
const planning_scene::PlanningSceneConstPtr & operator->() const
const std::shared_ptr< tf2_ros::Buffer > & getTFClient() const
Get the instance of the TF client that was passed to the constructor of this class.
CurrentStateMonitorPtr current_state_monitor_
bool checkFrameIgnored(const std::string &frame)
void stopPublishingPlanningScene()
Stop publishing the maintained planning scene.
void excludeAttachedBodyFromOctree(const moveit::core::AttachedBody *attached_body)
@ UPDATE_STATE
The state in the monitored scene was updated.
DynamicReconfigureImpl * reconfigure_impl_
ros::CallbackQueue queue_
void stopSceneMonitor()
Stop the scene monitor.
void stopWorldGeometryMonitor()
Stop the world geometry monitor.
static const std::string DEFAULT_COLLISION_OBJECT_TOPIC
The name of the topic used by default for receiving collision objects in the world.
void startStateMonitor(const std::string &joint_states_topic=DEFAULT_JOINT_STATES_TOPIC, const std::string &attached_objects_topic=DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC)
Start the current state monitor.
PlanningSceneMonitor * planning_scene_monitor_
void excludeRobotLinksFromOctree()
bool getPlanningSceneServiceCallback(moveit_msgs::GetPlanningScene::Request &req, moveit_msgs::GetPlanningScene::Response &res)
std::unique_ptr< boost::thread > publish_planning_scene_
ros::WallTime last_robot_state_update_wall_time_
Last time the state was updated from current_state_monitor_.
ros::ServiceServer get_scene_service_
void unlockSceneWrite()
Lock the scene from writing (only one thread can lock for writing and no other thread can lock for re...
std::string robot_description_
double default_object_padd_
default object padding
moveit::core::RobotModelConstPtr robot_model_
void includeAttachedBodyInOctree(const moveit::core::AttachedBody *attached_body)
void stateUpdateTimerCallback(const ros::WallTimerEvent &event)
void setPlanningScenePublishingFrequency(double hz)
Set the maximum frequency at which planning scenes are being published.
std::map< std::string, double > default_robot_link_scale_
default robot link scale
std::string monitor_name_
The name of this scene monitor.
double publish_planning_scene_frequency_
PlanningSceneMonitor Subscribes to the topic planning_scene.
boost::recursive_mutex shape_handles_lock_
const std::string & getRobotDescription() const
Get the stored robot description.
void startWorldGeometryMonitor(const std::string &collision_objects_topic=DEFAULT_COLLISION_OBJECT_TOPIC, const std::string &planning_scene_world_topic=DEFAULT_PLANNING_SCENE_WORLD_TOPIC, const bool load_octomap_monitor=true)
Start the OccupancyMapMonitor and listening for:
std::map< const moveit::core::AttachedBody *, std::vector< std::pair< occupancy_map_monitor::ShapeHandle, std::size_t > > > AttachedBodyShapeHandles
const ros::Time & getLastUpdateTime() const
Return the time when the last update was made to the planning scene (by any monitor)
PlanningSceneMonitorPtr planning_scene_monitor_
MOVEIT_CLASS_FORWARD(CurrentStateMonitor)
planning_scene::PlanningScenePtr scene_
void newPlanningSceneWorldCallback(const moveit_msgs::PlanningSceneWorldConstPtr &world)
Callback for a new planning scene world.
LockedPlanningSceneRO(const PlanningSceneMonitorPtr &planning_scene_monitor)
ros::NodeHandle nh_
Last time the robot has moved.
static const std::string DEFAULT_JOINT_STATES_TOPIC
The name of the topic used by default for receiving joint states.
void currentStateAttachedBodyUpdateCallback(moveit::core::AttachedBody *attached_body, bool just_attached)
Callback for a change for an attached object of the current state of the planning scene.
static const std::string DEFAULT_PLANNING_SCENE_TOPIC
The name of the topic used by default for receiving full planning scenes or planning scene diffs.
MOVEIT_STRUCT_FORWARD(SingleUnlock)
static const std::string MONITORED_PLANNING_SCENE_TOPIC
void includeRobotLinksInOctree()
double getStateUpdateFrequency() const
Get the maximum frequency (Hz) at which the current state of the planning scene is updated.
bool waitForCurrentRobotState(const ros::Time &t, double wait_time=1.)
Wait for robot state to become more recent than time t.
volatile bool state_update_pending_
True when we need to update the RobotState from current_state_monitor_.
void attachObjectCallback(const moveit_msgs::AttachedCollisionObjectConstPtr &obj)
Callback for a new attached object msg.
void startSceneMonitor(const std::string &scene_topic=DEFAULT_PLANNING_SCENE_TOPIC)
Start the scene monitor (ROS topic-based)
This is a convenience class for obtaining access to an instance of a locked PlanningScene.
void newPlanningSceneCallback(const moveit_msgs::PlanningSceneConstPtr &scene)
ros::Subscriber planning_scene_subscriber_
void includeWorldObjectsInOctree()
std::set< std::string > ignored_frames_
void excludeAttachedBodiesFromOctree()
void configureCollisionMatrix(const planning_scene::PlanningScenePtr &scene)
Configure the collision matrix for a particular scene.
ros::WallDuration dt_state_update_
the amount of time to wait in between updates to the robot state
@ UPDATE_GEOMETRY
The geometry of the scene was updated. This includes receiving new octomaps, collision objects,...
void providePlanningSceneService(const std::string &service_name=DEFAULT_PLANNING_SCENE_SERVICE)
Create an optional service for getting the complete planning scene This is useful for satisfying the ...
void getMonitoredTopics(std::vector< std::string > &topics) const
Get the topic names that the monitor is listening to.
void getUpdatedFrameTransforms(std::vector< geometry_msgs::TransformStamped > &transforms)
double getPlanningScenePublishingFrequency() const
Get the maximum frequency at which planning scenes are published (Hz)
void clearUpdateCallbacks()
Clear the functions to be called when an update to the scene is received.
@ UPDATE_SCENE
The entire scene was updated.
void initialize(bool read_only)
planning_scene::PlanningScenePtr parent_scene_
bool requestPlanningSceneState(const std::string &service_name=DEFAULT_PLANNING_SCENE_SERVICE)
Request a full planning scene state using a service call Be careful not to use this in conjunction wi...
double getDefaultObjectPadding() const
Get the default object padding.
void startPublishingPlanningScene(SceneUpdateType event, const std::string &planning_scene_topic=MONITORED_PLANNING_SCENE_TOPIC)
Start publishing the maintained planning scene. The first message set out is a complete planning scen...
void monitorDiffs(bool flag)
By default, the maintained planning scene does not reason about diffs. When the flag passed in is tru...
std::vector< boost::function< void(SceneUpdateType)> > update_callbacks_
@ UPDATE_TRANSFORMS
The maintained set of fixed transforms in the monitored scene was updated.
double getDefaultRobotPadding() const
Get the default robot padding.
const robot_model_loader::RobotModelLoaderPtr & getRobotModelLoader() const
Get the user kinematic model loader.
ros::Publisher planning_scene_publisher_
LinkShapeHandles link_shape_handles_
void includeWorldObjectInOctree(const collision_detection::World::ObjectConstPtr &obj)
boost::shared_mutex scene_update_mutex_
if diffs are monitored, this is the pointer to the parent scene
void includeAttachedBodiesInOctree()
const planning_scene::PlanningScenePtr & operator->()
PlanningSceneMonitor(const std::string &robot_description, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer=std::shared_ptr< tf2_ros::Buffer >(), const std::string &name="")
Constructor.
ros::Duration shape_transform_cache_lookup_wait_time_
the amount of time to wait when looking up transforms
static const std::string DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC
The name of the topic used by default for attached collision objects.
void lockSceneWrite()
Lock the scene for writing (only one thread can lock for writing and no other thread can lock for rea...
planning
Author(s): Ioan Sucan
, Sachin Chitta
autogenerated on Thu Nov 21 2024 03:24:18