# turtlebot3_interactive_marker *This file is ai generated. Do not edit this file directly. Instead, edit the node source code and run the generate-node-docs command to update this file.* ## Description An interactive visualization node that allows users to control the TurtleBot3 using RViz interactive markers. Users can click and drag red arrows to move the robot to specific positions, or rotate circular handles to change the robot's orientation. This provides an intuitive graphical interface for robot control. ## Publishers - `cmd_vel` ([geometry_msgs/Twist](http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html)) - Velocity commands based on interactive marker feedback ## Subscribers - `odom` ([nav_msgs/Odometry](http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html)) - Current robot pose for marker position updates ## Parameters The node uses hardcoded control parameters: - Maximum linear velocity: 0.1 m/s (in X and Y directions) - Maximum angular velocity: 0.5 rad/s - Position threshold: 0.01 meters - Orientation threshold: 0.01 radians (~0.57 degrees) - Update rate: 10 Hz (0.1 second timer) ## Interactive Markers The node creates two interactive markers in RViz: 1. **Movement Marker** (in "odom" frame): - Name: `turtlebot3_move_marker` - Allows translation in the XY plane - Drag to set goal position 2. **Rotation Marker** (in "base_link" frame): - Name: `turtlebot3_rotate_marker` - Allows rotation around Z-axis - Drag circular handle to set goal orientation ## Example Usage Launch the interactive marker node: ```bash ros2 run turtlebot3_example turtlebot3_interactive_marker ``` Setup RViz visualization: ```bash # In a separate terminal rviz2 ``` In RViz: 1. Add "InteractiveMarkers" display 2. Set the topic to `/turtlebot3_interactive_marker/update` 3. You should see red arrows for position control and a rotation handle ## Behavior ### Position Control When the movement marker is dragged: - Node calculates the difference between current and goal position - Computes forward and lateral speeds in the robot's frame - Linear velocities are clamped to ±0.1 m/s - Robot moves until within 0.01 m of target - Movement marker updates to track current position ### Orientation Control When the rotation marker is dragged: - Node calculates the angular difference between current and goal orientation - Angular velocity is clamped to ±0.5 rad/s - Robot rotates until within 0.01 rad (~0.57°) of target - Only angular velocity is commanded (no translation) ### Marker Updates - Movement marker automatically updates its position and orientation to match the robot - This provides visual feedback of the robot's current pose - Markers are updated at 10 Hz ## Control Logic ``` If position goal is active: - Calculate position error in global frame - Transform to robot frame (forward/lateral) - Apply velocity limits - Publish Twist command Else if orientation goal is active: - Calculate angular error - Apply velocity limits - Publish Twist command with rotation only Else: - Publish zero velocity ``` ## Notes - Requires RViz2 with interactive markers plugin - Both position and orientation goals cannot be active simultaneously - Position goals take priority over orientation goals - The node provides smooth motion by continuously updating velocities - Interactive markers provide real-time visual feedback - Compatible with standard TurtleBot3 setup (requires odometry)