Author: Asa Rogers
This package, turtle_brick
, simulates a turtle robot that interacts with an arena and brick within the ROS 2 environment. The turtle attempts to catch a falling brick by coordinating its movements in the arena based on physics and real-time positioning. The simulation utilizes RViz for visualization and integrates a variety of ROS 2 services and messages to control the turtle's actions and the environment.
-
Launch the Simulation:
- Use the following command to launch the arena and turtle simulation:
colcon clean workspace -y && colcon build && source install/setup.bash && ros2 launch turtle_brick show_turtle.launch.py
- This will start the turtle simulation in the RViz environment, along with the
arena
,catcher
, andturtle_robot
nodes.
- Use the following command to launch the arena and turtle simulation:
-
Place the brick:
- Use this command to place the brick in the arena at a x, y, z position:
source install/setup.bash && ros2 service call /place turtle_brick_interfaces/srv/Place "{x: 5.0, y: 1.0, z: 10.0}"
- Use this command to place the brick in the arena at a x, y, z position:
-
Drop the Brick:
- Use this command to drop the brick:
ros2 service call /drop std_srvs/srv/Empty
- This initiates the brick’s descent, which the turtle will attempt to catch if it is within reachable range.
- Use this command to drop the brick:
-
Videos:
-
Here are videos demonstrating the turtle's behavior under different scenarios:
- Brick within Catching Range:
-
Screencast.from.2024-10-31.14-14-26.online-video-cutter.com.mp4
- **Brick Out of Reach**:
Screencast.from.2024-10-31.14-15-44.online-video-cutter.com.mp4
The package defines nodes and services as follows:
-
Arena (
arena
node): Initializes the arena environment in RViz, including walls and a platform. It also provides services for placing, dropping, and stopping the brick’s gravity to simulate sticking on the turtle platform. -
Catcher (
catcher
node): Controls the turtle’s movements to attempt catching the brick. It calculates reachability based on brick and turtle positions and uses thestop_gravity
service to catch the brick if reachable. -
Turtle Robot (
turtle_robot
node): Manages turtle robot simulation within the arena, handling dynamic frames, transformations, and velocities for movement control.