moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
planning_scene_display.cpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2012, Willow Garage, Inc.
5 * Copyright (c) 2013, Ioan A. Sucan
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of Willow Garage nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *********************************************************************/
35
36/* Author: Ioan Sucan */
37
42
43#include <rviz_common/transformation/transformation_manager.hpp>
44#include <rviz_default_plugins/robot/robot.hpp>
45#include <rviz_default_plugins/robot/robot_link.hpp>
46
47#include <rviz_common/properties/property.hpp>
48#include <rviz_common/properties/bool_property.hpp>
49#include <rviz_common/properties/float_property.hpp>
50#include <rviz_common/properties/color_property.hpp>
51#include <rviz_common/properties/enum_property.hpp>
52#include <rviz_common/display_context.hpp>
53// For Rolling, Kilted, and newer
54#if RCLCPP_VERSION_GTE(29, 6, 0)
55#include <tf2_ros/buffer.hpp>
56// For Jazzy and older
57#else
58#include <tf2_ros/buffer.h>
59#endif
60
61#include <OgreSceneManager.h>
62#include <OgreSceneNode.h>
63
66
67#include <cmath>
68
69namespace moveit_rviz_plugin
70{
71// ******************************************************************************************
72// Base class constructor
73// ******************************************************************************************
74PlanningSceneDisplay::PlanningSceneDisplay(bool listen_to_planning_scene, bool show_scene_robot)
75 : Display()
76 , planning_scene_needs_render_(true)
77 , current_scene_time_(0.0f)
78 , logger_(moveit::getLogger("moveit.ros.planning_scene_display"))
79{
80 move_group_ns_property_ = new rviz_common::properties::StringProperty("Move Group Namespace", "",
81 "The name of the ROS namespace in "
82 "which the move_group node is running",
83 this, SLOT(changedMoveGroupNS()), this);
84 robot_description_property_ = new rviz_common::properties::StringProperty(
85 "Robot Description", "robot_description", "The name of the ROS parameter where the URDF for the robot is loaded",
86 this, SLOT(changedRobotDescription()), this);
87
88 if (listen_to_planning_scene)
89 {
90 planning_scene_topic_property_ = new rviz_common::properties::RosTopicProperty(
91 "Planning Scene Topic", "/monitored_planning_scene",
92 rosidl_generator_traits::data_type<moveit_msgs::msg::PlanningScene>(),
93 "The topic on which the moveit_msgs::msg::PlanningScene messages are received", this,
94 SLOT(changedPlanningSceneTopic()), this);
95 }
96 else
97 {
99 }
100
101 // Planning scene category -------------------------------------------------------------------------------------------
102 scene_category_ = new rviz_common::properties::Property("Scene Geometry", QVariant(), "", this);
103
105 new rviz_common::properties::StringProperty("Scene Name", "(noname)", "Shows the name of the planning scene",
106 scene_category_, SLOT(changedSceneName()), this);
107 scene_name_property_->setShouldBeSaved(false);
109 new rviz_common::properties::BoolProperty("Show Scene Geometry", true,
110 "Indicates whether planning scenes should be displayed",
111 scene_category_, SLOT(changedSceneEnabled()), this);
112
114 new rviz_common::properties::FloatProperty("Scene Alpha", 0.9f, "Specifies the alpha for the scene geometry",
115 scene_category_, SLOT(changedSceneAlpha()), this);
116 scene_alpha_property_->setMin(0.0);
117 scene_alpha_property_->setMax(1.0);
118
119 scene_color_property_ = new rviz_common::properties::ColorProperty(
120 "Scene Color", QColor(50, 230, 50), "The color for the planning scene obstacles (if a color is not defined)",
121 scene_category_, SLOT(changedSceneColor()), this);
122
124 new rviz_common::properties::EnumProperty("Voxel Rendering", "Occupied Voxels", "Select voxel type.",
125 scene_category_, SLOT(changedOctreeRenderMode()), this);
126
127 octree_render_property_->addOption("Occupied Voxels", OCTOMAP_OCCUPIED_VOXELS);
128 octree_render_property_->addOption("Free Voxels", OCTOMAP_FREE_VOXELS);
130 octree_render_property_->addOption("Disabled", OCTOMAP_DISABLED);
131
132 octree_coloring_property_ = new rviz_common::properties::EnumProperty(
133 "Voxel Coloring", "Z-Axis", "Select voxel coloring mode", scene_category_, SLOT(changedOctreeColorMode()), this);
134
136 octree_coloring_property_->addOption("Cell Probability", OCTOMAP_PROBABLILTY_COLOR);
137
139 new rviz_common::properties::FloatProperty("Scene Display Time", 0.01f,
140 "The amount of wall-time to wait in between rendering "
141 "updates to the planning scene (if any)",
142 scene_category_, SLOT(changedSceneDisplayTime()), this);
143 scene_display_time_property_->setMin(0.0001);
144
145 if (show_scene_robot)
146 {
147 robot_category_ = new rviz_common::properties::Property("Scene Robot", QVariant(), "", this);
148
149 scene_robot_visual_enabled_property_ = new rviz_common::properties::BoolProperty(
150 "Show Robot Visual", true,
151 "Indicates whether the robot state specified by the planning scene should be "
152 "displayed as defined for visualisation purposes.",
153 robot_category_, SLOT(changedSceneRobotVisualEnabled()), this);
154
155 scene_robot_collision_enabled_property_ = new rviz_common::properties::BoolProperty(
156 "Show Robot Collision", false,
157 "Indicates whether the robot state specified by the planning scene should be "
158 "displayed as defined for collision detection purposes.",
159 robot_category_, SLOT(changedSceneRobotCollisionEnabled()), this);
160
162 new rviz_common::properties::FloatProperty("Robot Alpha", 1.0f, "Specifies the alpha for the robot links",
163 robot_category_, SLOT(changedRobotSceneAlpha()), this);
164 robot_alpha_property_->setMin(0.0);
165 robot_alpha_property_->setMax(1.0);
166
168 new rviz_common::properties::ColorProperty("Attached Body Color", QColor(150, 50, 150),
169 "The color for the attached bodies", robot_category_,
170 SLOT(changedAttachedBodyColor()), this);
171 }
172 else
173 {
174 robot_category_ = nullptr;
177 robot_alpha_property_ = nullptr;
179 }
180}
181
182// ******************************************************************************************
183// Deconstructor
184// ******************************************************************************************
186{
187 clearJobs();
188
190 if (context_ && context_->getSceneManager() && planning_scene_node_)
191 context_->getSceneManager()->destroySceneNode(planning_scene_node_);
192 planning_scene_robot_.reset();
194}
195
197{
199 {
200 std::unique_lock<std::mutex> ulock(main_loop_jobs_lock_);
201 main_loop_jobs_.clear();
202 }
203}
204
206{
207 Display::onInitialize();
208 auto ros_node_abstraction = context_->getRosNodeAbstraction().lock();
209 if (!ros_node_abstraction)
210 {
211 RVIZ_COMMON_LOG_WARNING("Unable to lock weak_ptr from DisplayContext in PlanningSceneDisplay constructor");
212 return;
213 }
214 node_ = ros_node_abstraction->get_raw_node();
215 planning_scene_topic_property_->initialize(ros_node_abstraction);
216
217 // the scene node that contains everything and is located at the planning frame
218 planning_scene_node_ = scene_node_->createChildSceneNode();
219
220 if (robot_category_)
221 {
223 std::make_shared<RobotStateVisualization>(planning_scene_node_, context_, "Planning Scene", robot_category_);
224 planning_scene_robot_->setVisible(true);
226 planning_scene_robot_->setCollisionVisible(scene_robot_collision_enabled_property_->getBool());
227 changedRobotSceneAlpha();
229 }
230}
231
233{
235 planning_scene_robot_->clear();
236 Display::reset();
237
238 if (isEnabled())
239 addBackgroundJob([this] { loadRobotModel(); }, "loadRobotModel");
240
242 {
243 planning_scene_robot_->setVisible(true);
245 planning_scene_robot_->setCollisionVisible(scene_robot_collision_enabled_property_->getBool());
246 }
247}
248
249void PlanningSceneDisplay::addBackgroundJob(const std::function<void()>& job, const std::string& name)
250{
251 background_process_.addJob(job, name);
252}
253
254void PlanningSceneDisplay::spawnBackgroundJob(const std::function<void()>& job)
255{
256 std::thread t(job);
257 t.detach();
258}
259
260void PlanningSceneDisplay::addMainLoopJob(const std::function<void()>& job)
261{
262 std::unique_lock<std::mutex> ulock(main_loop_jobs_lock_);
263 main_loop_jobs_.push_back(job);
264}
265
267{
268 std::unique_lock<std::mutex> ulock(main_loop_jobs_lock_);
269 while (!main_loop_jobs_.empty())
271}
272
274{
276 while (!main_loop_jobs_.empty())
277 {
278 std::function<void()> fn = main_loop_jobs_.front();
279 main_loop_jobs_.pop_front();
280 main_loop_jobs_lock_.unlock();
281 try
282 {
283 fn();
284 }
285 catch (std::exception& ex)
286 {
287 RCLCPP_ERROR(logger_, "Exception caught executing main loop job: %s", ex.what());
288 }
290 }
292 main_loop_jobs_lock_.unlock();
293}
294
295const planning_scene_monitor::PlanningSceneMonitorPtr& PlanningSceneDisplay::getPlanningSceneMonitor()
296{
298}
299
301{
302 return move_group_ns_property_->getStdString();
303}
304
305const moveit::core::RobotModelConstPtr& PlanningSceneDisplay::getRobotModel() const
306{
308 {
309 return planning_scene_monitor_->getRobotModel();
310 }
311 else
312 {
313 static moveit::core::RobotModelConstPtr empty;
314 return empty;
315 }
316}
317
319{
321 return planning_scene_monitor_->waitForCurrentRobotState(t);
322 return false;
323}
324
329
334
339
340void PlanningSceneDisplay::changedSceneColor()
341{
343}
344
345void PlanningSceneDisplay::changedMoveGroupNS()
346{
347 if (isEnabled())
348 reset();
349}
350
351void PlanningSceneDisplay::changedRobotDescription()
352{
353 if (isEnabled())
354 reset();
355}
356
357void PlanningSceneDisplay::changedSceneName()
358{
360 if (ps)
361 ps->setName(scene_name_property_->getStdString());
362}
363
365{
366 QColor color = scene_color_property_->getColor();
367 Ogre::ColourValue env_color(color.redF(), color.greenF(), color.blueF(), scene_alpha_property_->getFloat());
369 color = attached_body_color_property_->getColor();
370 Ogre::ColourValue attached_color(color.redF(), color.greenF(), color.blueF(), robot_alpha_property_->getFloat());
371
372 try
373 {
376 {
377 planning_scene_render_->renderPlanningScene(
378 ps, env_color, attached_color, static_cast<OctreeVoxelRenderMode>(octree_render_property_->getOptionInt()),
379 static_cast<OctreeVoxelColorMode>(octree_coloring_property_->getOptionInt()),
380 scene_alpha_property_->getFloat());
381 }
382 else
383 {
384 planning_scene_render_->updateRobotPosition(ps);
385 }
386 }
387 catch (std::exception& ex)
388 {
389 RCLCPP_ERROR(logger_, "Caught %s while rendering planning scene", ex.what());
390 }
391 planning_scene_render_->getGeometryNode()->setVisible(scene_enabled_property_->getBool());
392}
393
394void PlanningSceneDisplay::changedSceneAlpha()
395{
397}
398
399void PlanningSceneDisplay::changedRobotSceneAlpha()
400{
402 {
403 planning_scene_robot_->setAlpha(robot_alpha_property_->getFloat());
405 }
406}
407
408void PlanningSceneDisplay::changedPlanningSceneTopic()
409{
411 {
412 planning_scene_monitor_->startSceneMonitor(planning_scene_topic_property_->getStdString());
414 if (!getMoveGroupNS().empty())
415 service_name = rclcpp::names::append(getMoveGroupNS(), service_name);
416 auto bg_func = [=]() {
417 if (planning_scene_monitor_->requestPlanningSceneState(service_name))
418 {
420 }
421 else
422 {
423 setStatus(rviz_common::properties::StatusProperty::Warn, "PlanningScene", "Requesting initial scene failed");
424 }
425 };
426 addBackgroundJob(bg_func, "requestPlanningSceneState");
427 }
428}
429
430void PlanningSceneDisplay::changedSceneDisplayTime()
431{
432}
433
434void PlanningSceneDisplay::changedOctreeRenderMode()
435{
436}
437
438void PlanningSceneDisplay::changedOctreeColorMode()
439{
440}
441
442void PlanningSceneDisplay::changedSceneRobotVisualEnabled()
443{
444 if (isEnabled() && planning_scene_robot_)
445 {
446 planning_scene_robot_->setVisible(true);
449 }
450}
451
452void PlanningSceneDisplay::changedSceneRobotCollisionEnabled()
453{
454 if (isEnabled() && planning_scene_robot_)
455 {
456 planning_scene_robot_->setVisible(true);
457 planning_scene_robot_->setCollisionVisible(scene_robot_collision_enabled_property_->getBool());
459 }
460}
461
462void PlanningSceneDisplay::changedSceneEnabled()
463{
465 planning_scene_render_->getGeometryNode()->setVisible(scene_enabled_property_->getBool());
466}
467
468void PlanningSceneDisplay::setGroupColor(rviz_default_plugins::robot::Robot* robot, const std::string& group_name,
469 const QColor& color)
470{
471 if (getRobotModel())
472 {
473 const moveit::core::JointModelGroup* jmg = getRobotModel()->getJointModelGroup(group_name);
474 if (jmg)
475 {
476 const std::vector<std::string>& links = jmg->getLinkModelNamesWithCollisionGeometry();
477 for (const std::string& link : links)
478 setLinkColor(robot, link, color);
479 }
480 }
481}
482
483void PlanningSceneDisplay::unsetAllColors(rviz_default_plugins::robot::Robot* robot)
484{
485 if (getRobotModel())
486 {
487 const std::vector<std::string>& links = getRobotModel()->getLinkModelNamesWithCollisionGeometry();
488 for (const std::string& link : links)
489 unsetLinkColor(robot, link);
490 }
491}
492
493void PlanningSceneDisplay::unsetGroupColor(rviz_default_plugins::robot::Robot* robot, const std::string& group_name)
494{
495 if (getRobotModel())
496 {
497 const moveit::core::JointModelGroup* jmg = getRobotModel()->getJointModelGroup(group_name);
498 if (jmg)
499 {
500 const std::vector<std::string>& links = jmg->getLinkModelNamesWithCollisionGeometry();
501 for (const std::string& link : links)
502 unsetLinkColor(robot, link);
503 }
504 }
505}
506
507void PlanningSceneDisplay::setLinkColor(const std::string& link_name, const QColor& color)
508{
510 setLinkColor(&planning_scene_robot_->getRobot(), link_name, color);
511}
512
513void PlanningSceneDisplay::unsetLinkColor(const std::string& link_name)
514{
516 unsetLinkColor(&planning_scene_robot_->getRobot(), link_name);
517}
518
519void PlanningSceneDisplay::setLinkColor(rviz_default_plugins::robot::Robot* robot, const std::string& link_name,
520 const QColor& color)
521{
522 rviz_default_plugins::robot::RobotLink* link = robot->getLink(link_name);
523
524 // Check if link exists
525 if (link)
526 link->setColor(color.redF(), color.greenF(), color.blueF());
527}
528
529void PlanningSceneDisplay::unsetLinkColor(rviz_default_plugins::robot::Robot* robot, const std::string& link_name)
530{
531 rviz_default_plugins::robot::RobotLink* link = robot->getLink(link_name);
532
533 // Check if link exists
534 if (link)
535 link->unsetColor();
536}
537// ******************************************************************************************
538// Load
539// ******************************************************************************************
540planning_scene_monitor::PlanningSceneMonitorPtr PlanningSceneDisplay::createPlanningSceneMonitor()
541{
543 return std::make_shared<planning_scene_monitor::PlanningSceneMonitor>(node_, rml,
544 getNameStd() + "_planning_scene_monitor");
545}
546
548{
550 // Ensure old PSM is destroyed before we attempt to create a new one
552}
553
555{
556 // wait for other robot loadRobotModel() calls to complete;
557 std::scoped_lock _(robot_model_loading_lock_);
558
559 // we need to make sure the clearing of the robot model is in the main thread,
560 // so that rendering operations do not have data removed from underneath,
561 // so the next function is executed in the main loop
562 addMainLoopJob([this] { clearRobotModel(); });
563
565
566 planning_scene_monitor::PlanningSceneMonitorPtr psm = createPlanningSceneMonitor();
567 if (psm->getPlanningScene())
568 {
569 planning_scene_monitor_.swap(psm);
570 planning_scene_monitor_->addUpdateCallback(
573 });
574 addMainLoopJob([this] { onRobotModelLoaded(); });
576 }
577 else
578 {
579 addMainLoopJob([this]() {
580 setStatus(rviz_common::properties::StatusProperty::Error, "PlanningScene", "No Planning Scene Loaded");
581 });
582 }
583}
584
585// This should always run in the main GUI thread!
587{
588 changedPlanningSceneTopic();
589 planning_scene_render_ = std::make_shared<PlanningSceneRender>(planning_scene_node_, context_, planning_scene_robot_);
590 planning_scene_render_->getGeometryNode()->setVisible(scene_enabled_property_->getBool());
591
594 {
595 planning_scene_robot_->load(*getRobotModel()->getURDF());
596 moveit::core::RobotState* rs = new moveit::core::RobotState(ps->getCurrentState());
597 rs->update();
598 planning_scene_robot_->update(moveit::core::RobotStateConstPtr(rs));
599 }
600
601 bool old_state = scene_name_property_->blockSignals(true);
602 scene_name_property_->setStdString(ps->getName());
603 scene_name_property_->blockSignals(old_state);
604
605 setStatus(rviz_common::properties::StatusProperty::Ok, "PlanningScene", "Planning Scene Loaded Successfully");
606}
607
611
617
620{
621 getPlanningSceneRW()->getCurrentStateNonConst().update();
622 QMetaObject::invokeMethod(this, "setSceneName", Qt::QueuedConnection,
623 Q_ARG(QString, QString::fromStdString(getPlanningSceneRO()->getName())));
625}
626
627void PlanningSceneDisplay::setSceneName(const QString& name)
628{
629 scene_name_property_->setString(name);
630}
631
633{
634 Display::onEnable();
635
636 addBackgroundJob([this] { loadRobotModel(); }, "loadRobotModel");
637
639 {
640 planning_scene_robot_->setVisible(true);
642 planning_scene_robot_->setCollisionVisible(scene_robot_collision_enabled_property_->getBool());
643 }
645 planning_scene_render_->getGeometryNode()->setVisible(scene_enabled_property_->getBool());
646
649}
650
651// ******************************************************************************************
652// Disable
653// ******************************************************************************************
655{
657 {
658 planning_scene_monitor_->stopSceneMonitor();
660 planning_scene_render_->getGeometryNode()->setVisible(false);
661 }
663 planning_scene_robot_->setVisible(false);
664 Display::onDisable();
665}
666
671
672// For Rolling, L-turtle, and newer
673#if RCLCPP_VERSION_GTE(30, 0, 0)
674void PlanningSceneDisplay::update(std::chrono::nanoseconds wall_dt, std::chrono::nanoseconds ros_dt)
675{
676 Display::update(wall_dt, ros_dt);
677
679
681
683 updateInternal(wall_dt, ros_dt);
684}
685// For Kilted and older
686#else
687void PlanningSceneDisplay::update(float wall_dt, float ros_dt)
688{
689 Display::update(wall_dt, ros_dt);
690
692
694
696 updateInternal(wall_dt, ros_dt);
697}
698#endif
699
700void PlanningSceneDisplay::updateInternal(std::chrono::nanoseconds wall_dt, std::chrono::nanoseconds /*ros_dt*/)
701{
702 current_scene_time_ += std::chrono::duration_cast<std::chrono::duration<double>>(wall_dt).count();
706 {
708 current_scene_time_ = 0.0f;
711 }
712}
713
714void PlanningSceneDisplay::updateInternal(double wall_dt, double ros_dt)
715{
716 updateInternal(std::chrono::nanoseconds(std::lround(wall_dt)), std::chrono::nanoseconds(std::lround(ros_dt)));
717}
718
719void PlanningSceneDisplay::load(const rviz_common::Config& config)
720{
721 Display::load(config);
722}
723
724void PlanningSceneDisplay::save(rviz_common::Config config) const
725{
726 Display::save(config);
727}
728
729// ******************************************************************************************
730// Calculate Offset Position
731// ******************************************************************************************
733{
734 if (!getRobotModel())
735 return;
736
737 Ogre::Vector3 position;
738 Ogre::Quaternion orientation;
739
740 context_->getFrameManager()->getTransform(getRobotModel()->getModelFrame(), rclcpp::Time(0, 0, RCL_ROS_TIME),
741 position, orientation);
742
743 planning_scene_node_->setPosition(position);
744 planning_scene_node_->setOrientation(orientation);
745}
746
748{
749 Display::fixedFrameChanged();
751}
752
753} // namespace moveit_rviz_plugin
const std::vector< std::string > & getLinkModelNamesWithCollisionGeometry() const
Get the names of the links that are part of this joint group and also have geometry associated with t...
Representation of a robot's state. This includes position, velocity, acceleration and effort.
void update(bool force=false)
Update all transforms.
void addJob(const JobCallback &job, const std::string &name)
Add a job to the queue of jobs to execute. A name is also specifies for the job.
rviz_common::properties::Property * scene_category_
rviz_common::properties::EnumProperty * octree_coloring_property_
planning_scene_monitor::LockedPlanningSceneRO getPlanningSceneRO() const
get read-only access to planning scene
rviz_common::properties::StringProperty * robot_description_property_
void unsetGroupColor(rviz_default_plugins::robot::Robot *robot, const std::string &group_name)
rviz_common::properties::BoolProperty * scene_robot_collision_enabled_property_
rviz_common::properties::ColorProperty * attached_body_color_property_
void setLinkColor(const std::string &link_name, const QColor &color)
rviz_common::properties::EnumProperty * octree_render_property_
void sceneMonitorReceivedUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type)
planning_scene_monitor::LockedPlanningSceneRW getPlanningSceneRW()
get write access to planning scene
void save(rviz_common::Config config) const override
virtual void updateInternal(std::chrono::nanoseconds wall_dt, std::chrono::nanoseconds ros_dt)
void unsetLinkColor(const std::string &link_name)
void spawnBackgroundJob(const std::function< void()> &job)
std::deque< std::function< void()> > main_loop_jobs_
virtual void onRobotModelLoaded()
This is an event called by loadRobotModel() in the MainLoop; do not call directly.
rviz_common::properties::FloatProperty * scene_alpha_property_
void setGroupColor(rviz_default_plugins::robot::Robot *robot, const std::string &group_name, const QColor &color)
void calculateOffsetPosition()
Set the scene node's position, given the target frame and the planning frame.
virtual void onSceneMonitorReceivedUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type)
void addMainLoopJob(const std::function< void()> &job)
queue the execution of this function for the next time the main update() loop gets called
virtual planning_scene_monitor::PlanningSceneMonitorPtr createPlanningSceneMonitor()
rviz_common::properties::FloatProperty * robot_alpha_property_
planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_
const moveit::core::RobotModelConstPtr & getRobotModel() const
void addBackgroundJob(const std::function< void()> &job, const std::string &name)
rviz_common::properties::StringProperty * move_group_ns_property_
rviz_common::properties::StringProperty * scene_name_property_
void update(float wall_dt, float ros_dt) override
PlanningSceneDisplay(bool listen_to_planning_scene=true, bool show_scene_robot=true)
rviz_common::properties::FloatProperty * scene_display_time_property_
virtual void onNewPlanningSceneState()
This is called upon successful retrieval of the (initial) planning scene state.
rviz_common::properties::BoolProperty * scene_robot_visual_enabled_property_
rviz_common::properties::Property * robot_category_
void unsetAllColors(rviz_default_plugins::robot::Robot *robot)
rviz_common::properties::RosTopicProperty * planning_scene_topic_property_
Ogre::SceneNode * planning_scene_node_
displays planning scene with everything in it
rviz_common::properties::BoolProperty * scene_enabled_property_
bool waitForCurrentRobotState(const rclcpp::Time &t)
wait for robot state more recent than t
const planning_scene_monitor::PlanningSceneMonitorPtr & getPlanningSceneMonitor()
rviz_common::properties::ColorProperty * scene_color_property_
moveit::tools::BackgroundProcessing background_process_
void load(const rviz_common::Config &config) override
This is a convenience class for obtaining access to an instance of a locked PlanningScene.
This is a convenience class for obtaining access to an instance of a locked PlanningScene.
static const std::string DEFAULT_PLANNING_SCENE_SERVICE
The name of the service used by default for requesting full planning scene state.
robot_model_loader::RobotModelLoaderPtr getSharedRobotModelLoader(const rclcpp::Node::SharedPtr &node, const std::string &robot_description)
Main namespace for MoveIt.
std::string append(const std::string &left, const std::string &right)