37 #include <boost/algorithm/string.hpp> 38 #include <boost/algorithm/string/replace.hpp> 62 : animating_path_(false)
63 , drop_displaying_trajectory_(false)
67 , trajectory_slider_panel_(
NULL)
68 , trajectory_slider_dock_panel_(
NULL)
72 ros::message_traits::datatype<moveit_msgs::DisplayTrajectory>(),
73 "The topic on which the moveit_msgs::DisplayTrajectory messages are received", widget,
77 new rviz::BoolProperty(
"Show Robot Visual",
true,
"Indicates whether the geometry of the robot as defined for " 78 "visualisation purposes should be displayed",
82 new rviz::BoolProperty(
"Show Robot Collision",
false,
"Indicates whether the geometry of the robot as defined " 83 "for collision detection purposes should be displayed",
92 "The amount of wall-time to wait in between displaying " 93 "states along a received trajectory path",
101 "is to be animated in a loop",
108 "shown in the trajectory trail.",
113 "Interrupt Display",
false,
114 "Immediately show newly planned trajectory, interrupting the currently displayed one.", widget);
117 "Robot Color", QColor(150, 50, 150),
"The color of the animated robot", widget, SLOT(
changedRobotColor()),
this);
120 "Color Enabled",
false,
"Specifies whether robot coloring is enabled", widget, SLOT(
enabledRobotColor()),
this);
155 connect(trajectory_slider_dock_panel_, SIGNAL(visibilityChanged(
bool)),
this,
227 trajectory_trail_.resize((
int)std::ceil((t->getWayPointCount() + stepsize - 1) / (
float)stepsize));
230 int waypoint_i = std::min(i * stepsize, t->getWayPointCount() - 1);
333 if (tm ==
"REALTIME")
337 boost::replace_all(tm,
"s",
"");
342 t = boost::lexical_cast<
float>(tm);
344 catch (
const boost::bad_lexical_cast& ex)
468 if (!msg->model_id.empty() && msg->model_id !=
robot_model_->getName())
469 ROS_WARN(
"Received a trajectory to display for model '%s' but model '%s' was expected", msg->model_id.c_str(),
475 for (std::size_t i = 0; i < msg->trajectory.size(); ++i)
479 t->setRobotTrajectoryMsg(*
robot_state_, msg->trajectory_start, msg->trajectory[i]);
514 for (
auto& link : robot->
getLinks())
515 link.second->unsetColor();
523 std_msgs::ColorRGBA color_msg;
524 color_msg.r = color.redF();
525 color_msg.g = color.greenF();
526 color_msg.b = color.blueF();
527 color_msg.a = color.alphaF();
533 for (
auto& link : robot->
getLinks())
534 robot->
getLink(link.first)->
setColor(color.redF(), color.greenF(), color.blueF());
rviz::BoolProperty * display_path_visual_enabled_property_
virtual QColor getColor() const
void setName(const QString &name)
rviz::DisplayContext * context_
float current_state_time_
virtual ~TrajectoryVisualization()
#define ROS_ERROR_STREAM_NAMED(name, args)
robot_trajectory::RobotTrajectoryPtr trajectory_message_to_display_
Update the links of an rviz::Robot using a robot_state::RobotState.
TrajectoryPanel * trajectory_slider_panel_
void changedRobotPathAlpha()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void changedDisplayPathCollisionEnabled()
rviz::BoolProperty * trail_display_property_
void unsetRobotColor(rviz::Robot *robot)
std::vector< rviz::Robot * > trajectory_trail_
virtual int getInt() const
virtual QIcon getIcon() const
robot_model::RobotModelConstPtr robot_model_
virtual float getFloat() const
void changedLoopDisplay()
void update(int way_point_count)
virtual QWidget * getParentWindow()=0
ros::Subscriber trajectory_topic_sub_
void changedTrajectoryTopic()
void onRobotModelLoaded(robot_model::RobotModelConstPtr robot_model)
void addOptionStd(const std::string &option)
geometry_msgs::TransformStamped t
RobotLink * getLink(const std::string &name)
const M_NameToLink & getLinks() const
rviz::ColorProperty * robot_color_property_
void clearTrajectoryTrail()
void setSliderPosition(int position)
std::string getStdString()
void pauseButton(bool check)
virtual bool getBool() const
void setColor(float red, float green, float blue)
bool drop_displaying_trajectory_
void onInitialize(Ogre::SceneNode *scene_node, rviz::DisplayContext *context, ros::NodeHandle update_nh)
virtual PanelDockWidget * addPane(const QString &name, QWidget *pane, Qt::DockWidgetArea area=Qt::LeftDockWidgetArea, bool floating=true)=0
robot_state::RobotStatePtr robot_state_
rviz::BoolProperty * interrupt_display_property_
TrajectoryVisualization(rviz::Property *widget, rviz::Display *display)
Playback a trajectory from a planned path.
ros::NodeHandle update_nh_
rviz::FloatProperty * robot_path_alpha_property_
robot_trajectory::RobotTrajectoryPtr displaying_trajectory_message_
float getStateDisplayTime()
Ogre::SceneNode * scene_node_
void incomingDisplayTrajectory(const moveit_msgs::DisplayTrajectory::ConstPtr &msg)
ROS callback for an incoming path message.
rviz::BoolProperty * enable_robot_color_property_
void trajectorySliderPanelVisibilityChange(bool enable)
RobotStateVisualizationPtr display_path_robot_
int getSliderPosition() const
void changedStateDisplayTime()
virtual void update(float wall_dt, float ros_dt)
void interruptCurrentDisplay()
void setRobotColor(rviz::Robot *robot, const QColor &color)
boost::mutex update_trajectory_message_
rviz::BoolProperty * display_path_collision_enabled_property_
void setDefaultAttachedObjectColor(const QColor &color)
rviz::IntProperty * trail_step_size_property_
rviz::PanelDockWidget * trajectory_slider_dock_panel_
bool setStdString(const std::string &std_str)
void setRobotTrajectoryMsg(const robot_state::RobotState &reference_state, const trajectory_msgs::JointTrajectory &trajectory)
virtual QString getName() const
virtual WindowManagerInterface * getWindowManager() const =0
rviz::RosTopicProperty * trajectory_topic_property_
void changedDisplayPathVisualEnabled()
Slot Event Functions.
Update the links of an rviz::Robot using a robot_state::RobotState.
void changedTrailStepSize()
rviz::EditableEnumProperty * state_display_time_property_
rviz::BoolProperty * loop_display_property_