Robowflex
v0.1
Making MoveIt Easy
|
RVIZ visualization helper. See Live Visualization with RViz for more information. More...
#include <visualization.h>
Public Member Functions | |
RVIZHelper (const RobotConstPtr &robot, const std::string &name="robowflex") | |
Constructor. All parameters are placed under /name. This helper puts trajectories under /name/trajectory, scenes under /name/scene, and other markers under /name/markers. The robot description is placed under /name/robot_description. More... | |
Trajectories | |
void | updateTrajectory (const planning_interface::MotionPlanResponse &response) |
Updates the trajectory being visualized. More... | |
void | updateTrajectory (const Trajectory &trajectory) |
Updates the trajectory being visualized. More... | |
void | updateTrajectory (const robot_trajectory::RobotTrajectoryPtr &trajectory) |
Updates the trajectory being visualized. More... | |
void | updateTrajectory (const moveit_msgs::RobotTrajectory &traj, const moveit::core::RobotState &start) |
Updates the trajectory being visualized. More... | |
void | updateTrajectories (const std::vector< robot_trajectory::RobotTrajectoryPtr > &trajectories) |
Updates the trajectory being visualized to a list of trajectories. More... | |
void | updateTrajectories (const std::vector< planning_interface::MotionPlanResponse > &responses) |
Updates the trajectory being visualized to a list of trajectories. More... | |
void | updateTrajectories (const std::vector< TrajectoryPtr > &trajectories) |
Updates the trajectory being visualized to a list of trajectories. More... | |
States | |
void | visualizeState (const robot_state::RobotStatePtr &state) |
Visualizes a robot state. More... | |
void | visualizeState (const std::vector< double > &state) |
Visualizes a robot state. More... | |
void | visualizeCurrentState () |
Visualize the current state of the robot. More... | |
Scenes | |
void | removeScene () |
Removes the scene being visualized. More... | |
void | updateScene (const SceneConstPtr &scene) |
Updates the scene being visualized. More... | |
void | updatePCD (const sensor_msgs::PointCloud2 &msg) |
Updates the pointcloud being visualized. More... | |
Markers | |
void | addMarker (const visualization_msgs::Marker &marker, const std::string &name="") |
Add a marker message (under the name "name") to the scene. More... | |
void | addMarker (double x, double y, double z, const std::string &name="") |
Add a spherical marker (under the name "name") to the scene. More... | |
void | addMarker (const Eigen::Vector3d &point, const std::string &name="") |
Add a point (spherical) marker to the scene. More... | |
void | addTransformMarker (const std::string &name, const std::string &base_frame, const RobotPose &pose, double scale=1) |
Add a transform marker to the managed list of markers. Displayed after an updateMarkers() call. More... | |
void | addGeometryMarker (const std::string &name, const GeometryConstPtr &geometry, const std::string &base_frame, const RobotPose &pose, const Eigen::Vector4d &color=color::WHITE) |
Add a marker to the managed list of markers. Displayed after an updateMarkers() call. More... | |
void | addArrowMarker (const std::string &name, const std::string &base_frame, const RobotPose &pose, const Eigen::Vector4d &color, const Eigen::Vector3d &scale) |
Adds an arrow marker to the managed list of markers. Displayed after an updateMarkers() call. More... | |
void | addTextMarker (const std::string &name, const std::string &text, const std::string &base_frame, const RobotPose &pose, double height, const Eigen::Vector4d &color=color::WHITE) |
Adds a text marker to the managed list of markers. Displayed after updateMarkers(). More... | |
void | addLineMarker (const std::string &name, const std::vector< Eigen::Vector3d > &points, const std::vector< Eigen::Vector4d > &colors, double scale) |
Add a set of lines as markers. More... | |
void | addGoalMarker (const std::string &name, const MotionRequestBuilder &request) |
Adds the current goal of the motion request builder as a set of markers in the marker array. More... | |
void | addGoalMarker (const std::string &name, const moveit_msgs::MotionPlanRequest &request) |
Adds the current goal of the motion plan request as a set of markers in the marker array. More... | |
void | removeAllMarkers () |
Removes all markers that were added through addMarker(). More... | |
void | removeMarker (const std::string &name) |
Removes a marker that was added through addMarker(). More... | |
void | updateMarkers () |
Displays the managed list of markers. Keeps track of whether markers have already been displayed and simply need an update, and removes markers removed by removeMarker(). More... | |
Private Member Functions | |
void | fillMarker (visualization_msgs::Marker &marker, const std::string &base_frame, const RobotPose &pose, const Eigen::Vector4d &color, const Eigen::Vector3d &scale) const |
Fills a marker in with some common default information. More... | |
Private Attributes | |
RobotConstPtr | robot_ |
Robot being visualized. More... | |
ros::NodeHandle | nh_ |
Handle for publishing. More... | |
ros::Publisher | marker_pub_ |
Marker publisher. More... | |
ros::Publisher | trajectory_pub_ |
Trajectory publisher. More... | |
ros::Publisher | scene_pub_ |
Scene publisher. More... | |
ros::Publisher | pcd_pub_ |
Pointcloud publisher. More... | |
ros::Publisher | state_pub_ |
State publisher. More... | |
std::multimap< std::string, visualization_msgs::Marker > | markers_ |
Markers to publish. More... | |
RVIZ visualization helper. See Live Visualization with RViz for more information.
Definition at line 37 of file visualization.h.
IO::RVIZHelper::RVIZHelper | ( | const RobotConstPtr & | robot, |
const std::string & | name = "robowflex" |
||
) |
Constructor. All parameters are placed under /name. This helper puts trajectories under /name/trajectory, scenes under /name/scene, and other markers under /name/markers. The robot description is placed under /name/robot_description.
[in] | robot | Robot to model with this helper. |
[in] | name | Namespace to use. |
Definition at line 39 of file visualization.cpp.
void IO::RVIZHelper::addArrowMarker | ( | const std::string & | name, |
const std::string & | base_frame, | ||
const RobotPose & | pose, | ||
const Eigen::Vector4d & | color, | ||
const Eigen::Vector3d & | scale | ||
) |
Adds an arrow marker to the managed list of markers. Displayed after an updateMarkers() call.
[in] | name | Name of the marker. |
[in] | base_frame | Base frame of the pose of the marker. |
[in] | pose | Pose of the marker. |
[in] | color | Color of the marker. |
[in] | scale | The scale of the marker. |
Definition at line 204 of file visualization.cpp.
void IO::RVIZHelper::addGeometryMarker | ( | const std::string & | name, |
const GeometryConstPtr & | geometry, | ||
const std::string & | base_frame, | ||
const RobotPose & | pose, | ||
const Eigen::Vector4d & | color = color::WHITE |
||
) |
Add a marker to the managed list of markers. Displayed after an updateMarkers() call.
[in] | name | Name of the marker. |
[in] | geometry | Geometry of the marker to create. |
[in] | base_frame | Base frame of the pose of the marker. |
[in] | pose | Pose of the marker. |
[in] | color | Color of the marker. |
Definition at line 271 of file visualization.cpp.
void IO::RVIZHelper::addGoalMarker | ( | const std::string & | name, |
const MotionRequestBuilder & | request | ||
) |
Adds the current goal of the motion request builder as a set of markers in the marker array.
[in] | name | Name of the marker(s). |
[in] | request | Request to add goal of as a marker. |
Definition at line 421 of file visualization.cpp.
void IO::RVIZHelper::addGoalMarker | ( | const std::string & | name, |
const moveit_msgs::MotionPlanRequest & | request | ||
) |
Adds the current goal of the motion plan request as a set of markers in the marker array.
[in] | name | Name of the marker(s). |
[in] | request | Request to add goal of as a marker. |
Definition at line 326 of file visualization.cpp.
void IO::RVIZHelper::addLineMarker | ( | const std::string & | name, |
const std::vector< Eigen::Vector3d > & | points, | ||
const std::vector< Eigen::Vector4d > & | colors, | ||
double | scale | ||
) |
Add a set of lines as markers.
[in] | name | Name of the marker. |
[in] | points | Pair-wise list of points to add as lines. (eg., 0-1, 2-3, ...) |
[in] | colors | List of colors for each point. |
[in] | scale | Scale of the marker. |
Definition at line 229 of file visualization.cpp.
void IO::RVIZHelper::addMarker | ( | const Eigen::Vector3d & | point, |
const std::string & | name = "" |
||
) |
Add a point (spherical) marker to the scene.
[in] | point | The x,y,z coordinates as a vector |
[in] | name | Name of marker. |
Definition at line 462 of file visualization.cpp.
void IO::RVIZHelper::addMarker | ( | const visualization_msgs::Marker & | marker, |
const std::string & | name = "" |
||
) |
Add a marker message (under the name "name") to the scene.
[in] | marker | A marker message. |
[in] | name | Name of marker. |
Definition at line 440 of file visualization.cpp.
void IO::RVIZHelper::addMarker | ( | double | x, |
double | y, | ||
double | z, | ||
const std::string & | name = "" |
||
) |
Add a spherical marker (under the name "name") to the scene.
[in] | x | The x coordinate of the sphere. |
[in] | y | The y coordinate of the sphere. |
[in] | z | The z coordinate of the sphere. |
[in] | name | Name of marker. |
Definition at line 445 of file visualization.cpp.
void IO::RVIZHelper::addTextMarker | ( | const std::string & | name, |
const std::string & | text, | ||
const std::string & | base_frame, | ||
const RobotPose & | pose, | ||
double | height, | ||
const Eigen::Vector4d & | color = color::WHITE |
||
) |
Adds a text marker to the managed list of markers. Displayed after updateMarkers().
[in] | name | Name of the marker. |
[in] | text | The text to display. |
[in] | base_frame | Base frame of the pose of the marker. |
[in] | pose | Pose of the marker. |
[in] | height | The height of the text. |
[in] | color | Color of the marker. |
Definition at line 216 of file visualization.cpp.
void IO::RVIZHelper::addTransformMarker | ( | const std::string & | name, |
const std::string & | base_frame, | ||
const RobotPose & | pose, | ||
double | scale = 1 |
||
) |
Add a transform marker to the managed list of markers. Displayed after an updateMarkers() call.
[in] | name | Name of the marker. |
[in] | base_frame | Base frame of the pose of the marker. |
[in] | pose | Pose of the transform. |
[in] | scale | Scale factor that controls the size of the frame marker. |
Definition at line 259 of file visualization.cpp.
|
private |
Fills a marker in with some common default information.
[out] | marker | Marker to fill. |
[in] | base_frame | Base frame of the pose of the marker. |
[in] | pose | Pose of the marker. |
[in] | color | Color of the marker. |
[in] | scale | The scale of the marker. |
Definition at line 183 of file visualization.cpp.
void IO::RVIZHelper::removeAllMarkers | ( | ) |
Removes all markers that were added through addMarker().
Definition at line 426 of file visualization.cpp.
void IO::RVIZHelper::removeMarker | ( | const std::string & | name | ) |
Removes a marker that was added through addMarker().
[in] | name | The name of the marker to remove. |
Definition at line 432 of file visualization.cpp.
void IO::RVIZHelper::removeScene | ( | ) |
Removes the scene being visualized.
Definition at line 467 of file visualization.cpp.
void IO::RVIZHelper::updateMarkers | ( | ) |
Displays the managed list of markers. Keeps track of whether markers have already been displayed and simply need an update, and removes markers removed by removeMarker().
Definition at line 507 of file visualization.cpp.
void IO::RVIZHelper::updatePCD | ( | const sensor_msgs::PointCloud2 & | msg | ) |
Updates the pointcloud being visualized.
[in] | msg | Pointcloud msg to visualize. |
Definition at line 493 of file visualization.cpp.
void IO::RVIZHelper::updateScene | ( | const SceneConstPtr & | scene | ) |
Updates the scene being visualized.
[in] | scene | Scene to visualize. If null, removes scene by publishing empty message. |
Definition at line 472 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectories | ( | const std::vector< planning_interface::MotionPlanResponse > & | responses | ) |
Updates the trajectory being visualized to a list of trajectories.
[in] | responses | Planning responses to visualize. |
Definition at line 127 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectories | ( | const std::vector< robot_trajectory::RobotTrajectoryPtr > & | trajectories | ) |
Updates the trajectory being visualized to a list of trajectories.
[in] | trajectories | Vector of MoveIt! robot trajectories to visualize. |
Definition at line 96 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectories | ( | const std::vector< TrajectoryPtr > & | trajectories | ) |
Updates the trajectory being visualized to a list of trajectories.
[in] | responses | Vector of robowflex trajectories to visualize. |
Definition at line 138 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectory | ( | const moveit_msgs::RobotTrajectory & | traj, |
const moveit::core::RobotState & | start | ||
) |
Updates the trajectory being visualized.
[in] | traj | RobotTrajectory to visualize. |
[in] | start | base_state to copy values for other joints. |
Definition at line 75 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectory | ( | const planning_interface::MotionPlanResponse & | response | ) |
Updates the trajectory being visualized.
[in] | response | Planning response to visualize. |
Definition at line 57 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectory | ( | const robot_trajectory::RobotTrajectoryPtr & | trajectory | ) |
Updates the trajectory being visualized.
[in] | trajectory | Trajectory to visualize. |
Definition at line 67 of file visualization.cpp.
void IO::RVIZHelper::updateTrajectory | ( | const Trajectory & | trajectory | ) |
Updates the trajectory being visualized.
[in] | trajectory | Trajectory to visualize. |
Definition at line 62 of file visualization.cpp.
void IO::RVIZHelper::visualizeCurrentState | ( | ) |
Visualize the current state of the robot.
Definition at line 178 of file visualization.cpp.
void IO::RVIZHelper::visualizeState | ( | const robot_state::RobotStatePtr & | state | ) |
Visualizes a robot state.
[in] | state | The state of the robot to be visualized. |
Definition at line 148 of file visualization.cpp.
void IO::RVIZHelper::visualizeState | ( | const std::vector< double > & | state | ) |
Visualizes a robot state.
[in] | state | The state of the robot to be visualized. |
Definition at line 165 of file visualization.cpp.
|
private |
Marker publisher.
Definition at line 250 of file visualization.h.
|
private |
Markers to publish.
Definition at line 256 of file visualization.h.
|
private |
Handle for publishing.
Definition at line 249 of file visualization.h.
|
private |
Pointcloud publisher.
Definition at line 253 of file visualization.h.
|
private |
Robot being visualized.
Definition at line 248 of file visualization.h.
|
private |
Scene publisher.
Definition at line 252 of file visualization.h.
|
private |
State publisher.
Definition at line 254 of file visualization.h.
|
private |
Trajectory publisher.
Definition at line 251 of file visualization.h.