Skip to content

Commit 4158695

Browse files
committed
Remove PlanningSceneMonitor (#387)
This partially reverts 89f3257, where PSM was introduced to fetch the current robot state. However, this introduced several new issues, because this approach couldn't resolve TF frames.
1 parent 1786e10 commit 4158695

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

doc/motion_planning_api/src/motion_planning_api_tutorial.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <moveit/robot_model_loader/robot_model_loader.h>
4242
#include <moveit/planning_interface/planning_interface.h>
4343
#include <moveit/planning_scene/planning_scene.h>
44-
#include <moveit/planning_scene_monitor/planning_scene_monitor.h>
4544
#include <moveit/kinematic_constraints/utils.h>
4645
#include <moveit_msgs/DisplayTrajectory.h>
4746
#include <moveit_msgs/PlanningScene.h>
@@ -72,30 +71,19 @@ int main(int argc, char** argv)
7271
// .. _RobotModelLoader:
7372
// http://docs.ros.org/indigo/api/moveit_ros_planning/html/classrobot__model__loader_1_1RobotModelLoader.html
7473
const std::string PLANNING_GROUP = "panda_arm";
75-
robot_model_loader::RobotModelLoaderPtr robot_model_loader(
76-
new robot_model_loader::RobotModelLoader("robot_description"));
77-
robot_model::RobotModelPtr robot_model = robot_model_loader->getModel();
74+
robot_model_loader::RobotModelLoader robot_model_loader("robot_description");
75+
robot_model::RobotModelPtr robot_model = robot_model_loader.getModel();
7876
/* Create a RobotState and JointModelGroup to keep track of the current robot pose and planning group*/
7977
robot_state::RobotStatePtr robot_state(new robot_state::RobotState(robot_model));
8078
const robot_state::JointModelGroup* joint_model_group = robot_state->getJointModelGroup(PLANNING_GROUP);
8179

82-
// Using the :moveit_core:`RobotModel`, we can construct a
83-
// :planning_scene:`PlanningScene` that maintains the state of
84-
// the world (including the robot).
80+
// Using the :moveit_core:`RobotModel`, we can construct a :planning_scene:`PlanningScene`
81+
// that maintains the state of the world (including the robot).
8582
planning_scene::PlanningScenePtr planning_scene(new planning_scene::PlanningScene(robot_model));
8683

87-
// With the planning scene we create a planing scene monitor that
88-
// monitors planning scene diffs and applys them to the planning scene
89-
planning_scene_monitor::PlanningSceneMonitorPtr psm(
90-
new planning_scene_monitor::PlanningSceneMonitor(planning_scene, robot_model_loader));
91-
psm->startPublishingPlanningScene(planning_scene_monitor::PlanningSceneMonitor::UPDATE_SCENE);
92-
psm->startStateMonitor();
93-
psm->startSceneMonitor();
84+
// Configure a valid robot state
85+
planning_scene->getCurrentStateNonConst().setToDefaultValues(joint_model_group, "ready");
9486

95-
while (!psm->getStateMonitor()->haveCompleteState() && ros::ok())
96-
{
97-
ROS_INFO_STREAM_THROTTLE_NAMED(1, node_name, "Waiting for complete state from topic ");
98-
}
9987
// We will now construct a loader to load a planner, by name.
10088
// Note that we are using the ROS pluginlib library here.
10189
boost::scoped_ptr<pluginlib::ClassLoader<planning_interface::PlannerManager>> planner_plugin_loader;
@@ -138,7 +126,7 @@ int main(int argc, char** argv)
138126
// The package MoveItVisualTools provides many capabilties for visualizing objects, robots,
139127
// and trajectories in RViz as well as debugging tools such as step-by-step introspection of a script
140128
namespace rvt = rviz_visual_tools;
141-
moveit_visual_tools::MoveItVisualTools visual_tools("panda_link0", rviz_visual_tools::RVIZ_MARKER_TOPIC, psm);
129+
moveit_visual_tools::MoveItVisualTools visual_tools("panda_link0");
142130
visual_tools.loadRobotStatePub("/display_robot_state");
143131
visual_tools.enableBatchPublishing();
144132
visual_tools.deleteAllMarkers(); // clear all old markers

0 commit comments

Comments
 (0)