57 #include <OgreSceneManager.h> 58 #include <OgreSceneNode.h> 66 : Display(), model_is_loading_(false), planning_scene_needs_render_(true), current_scene_time_(0.0
f)
69 "which the move_group node is running",
72 "Robot Description",
"robot_description",
"The name of the ROS parameter where the URDF for the robot is loaded",
75 if (listen_to_planning_scene)
78 ros::message_traits::datatype<moveit_msgs::PlanningScene>(),
79 "The topic on which the moveit_msgs::PlanningScene messages are received",
this,
91 new rviz::BoolProperty(
"Show Scene Geometry",
true,
"Indicates whether planning scenes should be displayed",
100 "Scene Color", QColor(50, 230, 50),
"The color for the planning scene obstacles (if a color is not defined)",
117 new rviz::FloatProperty(
"Scene Display Time", 0.2
f,
"The amount of wall-time to wait in between rendering " 118 "updates to the planning scene (if any)",
122 if (show_scene_robot)
127 "Show Robot Visual",
true,
"Indicates whether the robot state specified by the planning scene should be " 128 "displayed as defined for visualisation purposes.",
132 "Show Robot Collision",
false,
"Indicates whether the robot state specified by the planning scene should be " 133 "displayed as defined for collision detection purposes.",
142 new rviz::ColorProperty(
"Attached Body Color", QColor(150, 50, 150),
"The color for the attached bodies",
181 Display::onInitialize();
222 boost::thread
t(job);
250 catch (std::exception& ex)
252 ROS_ERROR(
"Exception caught executing main loop job: %s", ex.what());
276 static robot_model::RobotModelConstPtr empty;
330 rviz::Color env_color(color.redF(), color.greenF(), color.blueF());
333 rviz::Color attached_color(color.redF(), color.greenF(), color.blueF());
343 catch (std::exception& ex)
345 ROS_ERROR(
"Caught %s while rendering planning scene", ex.what());
418 const robot_model::JointModelGroup* jmg =
getRobotModel()->getJointModelGroup(group_name);
421 const std::vector<std::string>& links = jmg->getLinkModelNamesWithCollisionGeometry();
422 for (std::size_t i = 0; i < links.size(); ++i)
432 const std::vector<std::string>& links =
getRobotModel()->getLinkModelNamesWithCollisionGeometry();
433 for (std::size_t i = 0; i < links.size(); ++i)
442 const robot_model::JointModelGroup* jmg =
getRobotModel()->getJointModelGroup(group_name);
445 const std::vector<std::string>& links = jmg->getLinkModelNamesWithCollisionGeometry();
446 for (std::size_t i = 0; i < links.size(); ++i)
470 link->
setColor(color.redF(), color.greenF(), color.blueF());
513 if (psm->getPlanningScene())
542 robot_state::RobotState* rs =
new robot_state::RobotState(ps->getCurrentState());
601 Display::onDisable();
611 Display::update(wall_dt, ros_dt);
634 Display::load(config);
639 Display::save(config);
650 Ogre::Vector3 position;
651 Ogre::Quaternion orientation;
661 Display::fixedFrameChanged();
virtual QColor getColor() const
const planning_scene_monitor::PlanningSceneMonitorPtr & getPlanningSceneMonitor()
std::string getNameStd() const
virtual void changedAttachedBodyColor()
void changedSceneRobotCollisionEnabled()
planning_scene_monitor::LockedPlanningSceneRW getPlanningSceneRW()
get write access to planning scene
void setGroupColor(rviz::Robot *robot, const std::string &group_name, const QColor &color)
void changedMoveGroupNS()
PlanningSceneDisplay(bool listen_to_planning_scene=true, bool show_scene_robot=true)
const std::string getMoveGroupNS() const
Update the links of an rviz::Robot using a robot_state::RobotState.
void changedSceneRobotVisualEnabled()
rviz::RosTopicProperty * planning_scene_topic_property_
virtual void onInitialize()
virtual void onSceneMonitorReceivedUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type)
rviz::EnumProperty * octree_coloring_property_
void changedOctreeRenderMode()
virtual void fixedFrameChanged()
DisplayContext * context_
rviz::EnumProperty * octree_render_property_
static const std::string DEFAULT_PLANNING_SCENE_SERVICE
void clearJobs()
remove all queued jobs
boost::mutex main_loop_jobs_lock_
void unsetLinkColor(const std::string &link_name)
virtual float getFloat() const
rviz::FloatProperty * scene_display_time_property_
RobotStateVisualizationPtr planning_scene_robot_
void changedRobotSceneAlpha()
geometry_msgs::TransformStamped t
RobotLink * getLink(const std::string &name)
virtual void onRobotModelLoaded()
This is an event called by loadRobotModel() in the MainLoop; do not call directly.
virtual void updateInternal(float wall_dt, float ros_dt)
Ogre::SceneNode * scene_node_
std::string getStdString()
virtual bool getBool() const
virtual void update(float wall_dt, float ros_dt)
boost::mutex robot_model_loading_lock_
void setColor(float red, float green, float blue)
rviz::ColorProperty * scene_color_property_
rviz::Property * scene_category_
void addBackgroundJob(const boost::function< void()> &job, const std::string &name)
virtual void addOption(const QString &option, int value=0)
void executeMainLoopJobs()
const boost::shared_ptr< tf::TransformListener > & getTFClientPtr()
virtual void save(rviz::Config config) const
rviz::StringProperty * move_group_ns_property_
rviz::BoolProperty * scene_robot_visual_enabled_property_
virtual FrameManager * getFrameManager() const =0
std::deque< boost::function< void()> > main_loop_jobs_
float current_scene_time_
planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_
Ogre::SceneNode * planning_scene_node_
displays planning scene with everything in it
rviz::FloatProperty * scene_alpha_property_
void setShouldBeSaved(bool save)
bool waitForCurrentRobotState(const ros::Time &t=ros::Time::now())
wait for robot state more recent than t
void queueRenderSceneGeometry()
void changedOctreeColorMode()
void renderPlanningScene()
virtual void load(const rviz::Config &config)
void addMainLoopJob(const boost::function< void()> &job)
queue the execution of this function for the next time the main update() loop gets called ...
void unsetAllColors(rviz::Robot *robot)
rviz::Property * robot_category_
virtual Ogre::SceneManager * getSceneManager() const =0
void waitForAllMainLoopJobs()
const robot_model::RobotModelConstPtr & getRobotModel() const
rviz::ColorProperty * attached_body_color_property_
virtual planning_scene_monitor::PlanningSceneMonitorPtr createPlanningSceneMonitor()
bool getTransform(const Header &header, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
void sceneMonitorReceivedUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type)
virtual ~PlanningSceneDisplay()
rviz::StringProperty * scene_name_property_
void changedSceneEnabled()
moveit::tools::BackgroundProcessing background_process_
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
void calculateOffsetPosition()
Set the scene node's position, given the target frame and the planning frame.
rviz::FloatProperty * robot_alpha_property_
void unsetGroupColor(rviz::Robot *robot, const std::string &group_name)
rviz::StringProperty * robot_description_property_
rviz::BoolProperty * scene_enabled_property_
boost::condition_variable main_loop_jobs_empty_condition_
rviz::BoolProperty * scene_robot_collision_enabled_property_
PlanningSceneRenderPtr planning_scene_render_
void setLinkColor(const std::string &link_name, const QColor &color)
virtual int getOptionInt()
void changedRobotDescription()
bool setStdString(const std::string &std_str)
bool planning_scene_needs_render_
void spawnBackgroundJob(const boost::function< void()> &job)
void changedPlanningSceneTopic()
void changedSceneDisplayTime()
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
virtual QString getName() const
planning_scene_monitor::LockedPlanningSceneRO getPlanningSceneRO() const
get read-only access to planning scene