|
SMACC2
|
Component for visualizing trajectories as RViz markers. More...
#include <cp_trajectory_visualizer.hpp>


Public Member Functions | |
| CpTrajectoryVisualizer (double publishRate=10.0) | |
| Constructor. | |
| virtual | ~CpTrajectoryVisualizer ()=default |
| void | onInitialize () override |
| Initialize the marker publisher. | |
| void | update () override |
| Periodic update - publishes markers if enabled. | |
| void | setTrajectory (const std::vector< geometry_msgs::msg::PoseStamped > &poses, const std::string &ns="trajectory") |
| Set trajectory to visualize. | |
| void | clearMarkers () |
| Clear all markers. | |
| void | setColor (float r, float g, float b, float a=1.0) |
| Set marker color (RGBA values 0.0-1.0) | |
| void | setScale (double scale) |
| Set marker scale (sphere diameter in meters) | |
| void | setEnabled (bool enabled) |
| Enable/disable marker publishing. | |
| bool | isEnabled () const |
| Check if visualizer is enabled. | |
Public Member Functions inherited from smacc2::ISmaccComponent | |
| ISmaccComponent () | |
| virtual | ~ISmaccComponent () |
| virtual std::string | getName () const |
Public Member Functions inherited from smacc2::ISmaccUpdatable | |
| ISmaccUpdatable () | |
| ISmaccUpdatable (rclcpp::Duration duration) | |
| void | executeUpdate (rclcpp::Node::SharedPtr node) |
| void | setUpdatePeriod (rclcpp::Duration duration) |
Private Attributes | |
| rclcpp::Publisher< visualization_msgs::msg::MarkerArray >::SharedPtr | markersPub_ |
| visualization_msgs::msg::MarkerArray | markers_ |
| std::mutex | markersMutex_ |
| bool | markersReady_ = false |
| bool | enabled_ = false |
| double | markerScale_ = 0.02 |
| float | markerColor_ [4] = {0.0f, 1.0f, 0.0f, 0.8f} |
| double | publishRate_ |
| rclcpp::Time | lastPublishTime_ |
Additional Inherited Members | |
Protected Member Functions inherited from smacc2::ISmaccComponent | |
| template<typename TOrthogonal , typename TClient > | |
| void | onComponentInitialization () |
| template<typename EventType > | |
| void | postEvent (const EventType &ev) |
| template<typename EventType > | |
| void | postEvent () |
| template<typename TOrthogonal , typename TSourceObject > | |
| void | onOrthogonalAllocation () |
| template<typename TOrthogonal , typename TSourceObject > | |
| void | onStateOrthogonalAllocation () |
| template<typename TComponent > | |
| void | requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist) |
| template<typename TComponent > | |
| void | requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist) |
| template<typename TComponent > | |
| void | requiresComponent (TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
| template<typename TComponent > | |
| void | requiresComponent (std::string name, TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
| template<typename TClient > | |
| void | requiresClient (TClient *&requiredClientStorage) |
| template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
| SmaccComponentType * | createSiblingComponent (TArgs... targs) |
| template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
| SmaccComponentType * | createSiblingNamedComponent (std::string name, TArgs... targs) |
| rclcpp::Node::SharedPtr | getNode () |
| rclcpp::Logger | getLogger () const |
| ISmaccStateMachine * | getStateMachine () |
Protected Member Functions inherited from smacc2::ISmaccUpdatable | |
Protected Attributes inherited from smacc2::ISmaccComponent | |
| ISmaccStateMachine * | stateMachine_ |
| ISmaccClient * | owner_ |
Component for visualizing trajectories as RViz markers.
This component publishes trajectory paths as visualization markers that can be viewed in RViz. It follows the ISmaccUpdatable pattern for periodic publishing.
Pattern: Publisher + ISmaccUpdatable (similar to nav2z_client's CpWaypointsVisualizer)
Definition at line 44 of file cp_trajectory_visualizer.hpp.
|
inline |
Constructor.
| publishRate | Publishing rate (default: 10Hz) |
Definition at line 52 of file cp_trajectory_visualizer.hpp.
|
virtualdefault |
|
inline |
Clear all markers.
Definition at line 176 of file cp_trajectory_visualizer.hpp.
References enabled_, smacc2::ISmaccComponent::getLogger(), markers_, markersMutex_, markersPub_, and markersReady_.
Referenced by cl_moveit2z::CbMoveEndEffectorTrajectory::onExit().


|
inline |
Check if visualizer is enabled.
Definition at line 226 of file cp_trajectory_visualizer.hpp.
References enabled_.
|
inlineoverridevirtual |
Initialize the marker publisher.
Reimplemented from smacc2::ISmaccComponent.
Definition at line 59 of file cp_trajectory_visualizer.hpp.
References smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), lastPublishTime_, and markersPub_.

|
inline |
Set marker color (RGBA values 0.0-1.0)
Definition at line 201 of file cp_trajectory_visualizer.hpp.
References markerColor_.
|
inline |
Enable/disable marker publishing.
Definition at line 217 of file cp_trajectory_visualizer.hpp.
References enabled_, and markersMutex_.
|
inline |
Set marker scale (sphere diameter in meters)
Definition at line 212 of file cp_trajectory_visualizer.hpp.
References markerScale_.
|
inline |
Set trajectory to visualize.
| poses | Vector of poses defining the trajectory path |
| ns | Namespace for the markers (default: "trajectory") |
Definition at line 99 of file cp_trajectory_visualizer.hpp.
References enabled_, smacc2::ISmaccComponent::getLogger(), markerColor_, markers_, markerScale_, markersMutex_, and markersReady_.
Referenced by cl_moveit2z::CbMoveEndEffectorTrajectory::onEntry().


|
inlineoverridevirtual |
Periodic update - publishes markers if enabled.
Implements smacc2::ISmaccUpdatable.
Definition at line 72 of file cp_trajectory_visualizer.hpp.
References enabled_, smacc2::ISmaccComponent::getNode(), lastPublishTime_, markers_, markersMutex_, markersPub_, markersReady_, and publishRate_.

|
private |
Definition at line 234 of file cp_trajectory_visualizer.hpp.
Referenced by clearMarkers(), isEnabled(), setEnabled(), setTrajectory(), and update().
|
private |
Definition at line 242 of file cp_trajectory_visualizer.hpp.
Referenced by onInitialize(), and update().
|
private |
Definition at line 238 of file cp_trajectory_visualizer.hpp.
Referenced by setColor(), and setTrajectory().
|
private |
Definition at line 230 of file cp_trajectory_visualizer.hpp.
Referenced by clearMarkers(), setTrajectory(), and update().
|
private |
Definition at line 237 of file cp_trajectory_visualizer.hpp.
Referenced by setScale(), and setTrajectory().
|
private |
Definition at line 231 of file cp_trajectory_visualizer.hpp.
Referenced by clearMarkers(), setEnabled(), setTrajectory(), and update().
|
private |
Definition at line 229 of file cp_trajectory_visualizer.hpp.
Referenced by clearMarkers(), onInitialize(), and update().
|
private |
Definition at line 233 of file cp_trajectory_visualizer.hpp.
Referenced by clearMarkers(), setTrajectory(), and update().
|
private |
Definition at line 241 of file cp_trajectory_visualizer.hpp.
Referenced by update().