3 #ifndef ROBOWFLEX_SCENE_
4 #define ROBOWFLEX_SCENE_
9 #include <Eigen/Geometry>
11 #include <moveit_msgs/PlanningScene.h>
13 #include <moveit/collision_detection/collision_matrix.h>
14 #include <moveit/planning_scene/planning_scene.h>
15 #include <moveit/robot_state/robot_state.h>
58 Scene(
const robot_model::RobotModelConstPtr &
robot);
81 const planning_scene::PlanningScenePtr &
getSceneConst()
const;
86 planning_scene::PlanningScenePtr &
getScene();
117 void useMessage(
const moveit_msgs::PlanningScene &msg,
bool diff =
false);
304 double distanceACM(
const robot_state::RobotState &state,
#define ROBOWFLEX_CLASS_FORWARD(C)
Macro that forward declares a class and defines two shared ptrs types:
A const shared pointer wrapper for robowflex::Geometry.
A shared pointer wrapper for robowflex::Geometry.
Adds functionality to uniquely ID a specific class as well as the "version" of that class,...
A const shared pointer wrapper for robowflex::Robot.
A shared pointer wrapper for robowflex::Scene.
The actual plugin loader for collision plugins. Heavily inspired by code in moveit_ros/planning.
Wrapper class around the planning scene and collision geometry.
double distanceToCollision(const robot_state::RobotState &state) const
Get the distance to collision for a robot state.
bool moveObjectGlobal(const std::string &name, const RobotPose &transform)
Move all shapes in an object according to the given transform specified in world frame.
void clearACM(collision_detection::AllowedCollisionMatrix &acm) const
Disables collision between all entries in the ACM (all robot links and objects in the scene)
planning_scene::PlanningScenePtr scene_
Underlying planning scene.
CollisionPluginLoaderPtr loader_
Plugin loader that sets collision detectors for the scene.
ScenePtr deepCopy() const
Deep Copy.
void useMessage(const moveit_msgs::PlanningScene &msg, bool diff=false)
Set the planning scene to be the same as a message.
double distanceACM(const robot_state::RobotState &state, const collision_detection::AllowedCollisionMatrix &acm) const
Get the distance to collision using an ACM.
moveit::core::GroupStateValidityCallbackFn getGSVCF(bool verbose) const
Get the group state validity callback function that uses this scene.
RobotPose getObjectPose(const std::string &name) const
Get the current pose of a collision object. If the object has multiple geometries,...
void fixCollisionObjectFrame(moveit_msgs::PlanningScene &msg)
Corrects frame mismatches on loaded scenes by using the current root frame instead.
double distanceToObject(const robot_state::RobotState &state, const std::string &object) const
Get the distance to collision to a specific object.
bool fromYAMLFile(const std::string &file)
Load a planning scene from a YAML file.
bool detachObject(const std::string &name)
Helper function that detaches the object from the internal scene state.
void removeCollisionObject(const std::string &name)
Removes an object from the planning scene.
bool attachObjectToState(robot_state::RobotState &state, const std::string &name) const
Attach the named collision object name to the default end-effector of the given robot state....
moveit_msgs::PlanningScene getMessage() const
Get the message that describes the current planning scene.
collision_detection::AllowedCollisionMatrix & getACM()
Get the current allowed collision matrix of the planning scene.
std::vector< std::string > getCollisionObjects() const
Returns a list of all the names of collision objects in the scene.
bool toYAMLFile(const std::string &file) const
Serialize the current planning scene to a YAML file.
const planning_scene::PlanningScenePtr & getSceneConst() const
Get a const reference to the planning scene.
RobotPose getFramePose(const std::string &id) const
Get the pose of a particular frame in the scene. Example, use this to get the pose from /world to /ba...
bool hasObject(const std::string &name) const
Returns true if the object name is in the scene.
planning_scene::PlanningScenePtr & getScene()
Get a reference to the planning scene.
robot_state::RobotState & getCurrentState()
Get a reference to the current robot state in the planning scene.
GeometryPtr getObjectGeometry(const std::string &name) const
Returns a representation of a collision object in the scene as a Geometry. If the object has multiple...
void operator=(const Scene &scene)
Assignment Copy Constructor.
Scene(const RobotConstPtr &robot)
Constructor.
double distanceBetweenObjects(const std::string &one, const std::string &two) const
Get the distance to collision between two collision objects in the scene.
const collision_detection::AllowedCollisionMatrix & getACMConst() const
Get the current allowed collision matrix of the planning scene.
RobotPose getObjectGraspPose(const std::string &name, const RobotPose &offset) const
Get a pose in the global frame relative to a collision object for grasping.
bool attachObject(const std::string &name)
Helper function that attaches object to internal state and removes from scene.
const robot_state::RobotState & getCurrentStateConst() const
Get a constant reference to the current robot state in the planning scene.
bool setCollisionDetector(const std::string &detector_name) const
Attempts to set the collision detector plugin used by the scene to name. In MoveIt by default,...
collision_detection::CollisionResult checkCollision(const robot_state::RobotState &state, const collision_detection::CollisionRequest &request={}) const
Check if a robot state is in collision.
bool fromOpenRAVEXMLFile(const std::string &file, std::string models_dir="")
void updateCollisionObject(const std::string &name, const GeometryConstPtr &geometry, const RobotPose &pose)
Adds or updates collision object in the planning scene. If the geometry reference is the same,...
bool moveAllObjectsGlobal(const RobotPose &transform)
Move all objects according to a transform specified in world frame.
bool moveObjectLocal(const std::string &name, const RobotPose &transform)
Move all shapes in an object according to the given transform specified in object frame....
boost::function< bool(RobotState *robot_state, const JointModelGroup *joint_group, const double *joint_group_variable_values)> GroupStateValidityCallbackFn
Functions for loading and animating robots in Blender.
Main namespace. Contains all library classes and functions.
std::decay< decltype(std::declval< moveit::core::Transforms >().getTransform("")) >::type RobotPose
A pose (point in SE(3)) used in various functions. Defined from what MoveIt! uses.
Functions for loading and animating scenes in Blender.