Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nhjschulz/turtlesim_teleop_python
ROS2 TurtleSim Python Controller
https://github.com/nhjschulz/turtlesim_teleop_python
Last synced: about 1 month ago
JSON representation
ROS2 TurtleSim Python Controller
- Host: GitHub
- URL: https://github.com/nhjschulz/turtlesim_teleop_python
- Owner: nhjschulz
- License: mit
- Created: 2024-08-12T15:04:56.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-09-25T07:05:31.000Z (4 months ago)
- Last Synced: 2024-10-25T20:26:52.431Z (3 months ago)
- Language: Python
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# turtlesim_teleop_python
A ROS2 TurtleSim Python Controller similar to turtle_teleop_key, but
using python turtle command scripts for controlling instead of key strokes.Running this example wiill result in the following output:
![turtle_sim_pythonop_demo](./doc/turtlesim_pythonop_demo.png)Read the [ROS2 turtlesim Tutorial](https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html)
if you are unfamiliar with this evironment.The following Python turtle commands are supported. See the
[Python Turtle](https://docs.python.org/3/library/turtle.html) page for command
details.* Movement
forward(), backward(), right(), left(), goto(), setpos(), teleport(), setx(),
sety(), setheading(), home(), circle()* State
position(), towards(), xcor(), ycor(), heading(), distance(), clear()
* Pen Control
pendown(), penup()## Installation and Running as ROS2 package
1. Clone this repository into a ROS2 workspace src folder
2. Build workspace with `colcon build` followed by `source install/local_setup.bash`
3. In another terminal launch the turtlesim package as described in the ROS2 Tutorialsudo apt install ros-$ROS_DISTRO-turtlesim
ros2 run turtlesim turtlesim_node3. Run this package from the workspace with
ros2 run turtlesim_teleop_python pythonop_turtle
## Parameter
The package provides the following custom parameters:
| Parameter | Type |Description | Default |
|---------------|-------|--------------------------------------------------| --------|
| delay | float | Delay between sending update messages in seconds.| 1.0 |
| scale_angular | float | Scale factor for angular movements. | 1.0 |
| scale_linear | float | Scale factor for linear movements. | 1.0 |## Interactive Usage
Interactive testing is working by going into
`turtlesim_teleop_python/turtlesim_teleop_python` folder
and start python3 from there. Then execute the commands below as an example:```python
import rclpy
from pythonop_turtle import TurtleTwistPublisherrclpy.init()
turtle = TurtleTwistPublisher()turtle.penup()
turtle.clear()
turtle.home()
turtle.pendown()
turtle.left(90)
turtle.forward(5)
turtle.right(160)
turtle.forward(5.5)
turtle.left(160)
turtle.forward(5)
turtle.right(90)
turtle.forward(3)
turtle.backward(1.5)
turtle.right(90)
turtle.forward(5)
turtle.penup()
turtle.goto(2,2)
turtle.pendown()
turtle.circle(1.5)turtle.destroy_node()
rclpy.shutdown()
```