turtlebot3_patrol_client
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 action client node that sends patrol goals to the TurtleBot3 patrol server. Users can specify the patrol pattern (square or triangle), the side length, and the number of iterations through a command-line interface. The client monitors action feedback and displays the patrol progress.
Actions
Client
turtlebot3(turtlebot3_msgs/Patrol)Sends patrol goals to the patrol server
Receives feedback during execution
Receives final result upon completion
Parameters
None - the node uses interactive command-line input for configuration.
Example Usage
Launch the patrol client (requires patrol server to be running):
# Terminal 1: Start the patrol server
ros2 run turtlebot3_example turtlebot3_patrol_server
# Terminal 2: Start the patrol client
ros2 run turtlebot3_example turtlebot3_patrol_client
Input example:
TurtleBot3 Patrol Client
----------------------------------------------
Input below
mode: s: square, t: triangle
travel_distance (unit: m)
patrol_count
----------------------------------------------
mode(s: square, t: triangle): s
travel_distance: 1.0
patrol_count: 2
This will command the robot to perform 2 square patterns with 1.0 meter sides.
Interactive Input
Mode Selection
s- Square patrol patternt- Triangle patrol patternx- Exit the program
Parameters
travel_distance (float):
Side length of the geometric pattern in meters
Must be positive
Typical values: 0.5 to 2.0 meters
patrol_count (int):
Number of complete patterns to execute
Must be positive integer
Typical values: 1 to 5 iterations
Behavior
Goal Submission
User provides input for mode, distance, and count
Client converts mode character to numeric value:
‘s’ → 1.0 (square)
‘t’ → 2.0 (triangle)
‘x’ → shutdown
Client packages parameters into Patrol goal message:
goal.x= pattern typegoal.y= travel distancegoal.z= patrol count
Client waits for server availability
Client sends goal asynchronously
Feedback Handling
During patrol execution:
Client receives periodic feedback from server
Displays progress messages: “Received feedback: line 1”, “line 2”, etc.
Feedback indicates which side of the pattern is being traversed
Result Handling
Upon completion:
Client receives final result from server
Displays completion message: “Result: square patrol complete!!” or “Result: triangle patrol complete!!”
Node shuts down automatically
Error Handling
If goal is rejected:
Displays “Goal rejected :(”
Returns without executing patrol
If goal is accepted:
Displays “Goal accepted :)”
Continues monitoring feedback and result
Example Scenarios
Small Square Test
mode: s
travel_distance: 0.5
patrol_count: 1
Result: One 0.5m × 0.5m square
Large Triangle Patrol
mode: t
travel_distance: 1.5
patrol_count: 3
Result: Three triangles with 1.5m sides
Multiple Squares
mode: s
travel_distance: 1.0
patrol_count: 5
Result: Five 1.0m × 1.0m squares
Notes
Requires
turtlebot3_patrol_serverto be runningBoth client and server shut down after completing the patrol
Restart both nodes for subsequent patrol missions
Invalid mode input will cause the node to shut down
The client uses asynchronous action calls with callbacks
Feedback is logged in real-time during execution
Compatible with any action server implementing the Patrol action interface