Skip to content

apark2459/thymio-path-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

thymio-path-tracking

ROS package for path-tracking on the Thymio II robot (wireless version). It contains two nodes: (1) reference.py and (2) controller.py. Version of Ubuntu and ROS distribution used were Ubuntu 20.04 and ROS Noetic. OptiTrack motion capture system was used for localization.

Contents of the package

reference.py

This node generates a reference pose at every time step corresponding to the set of waypoints that you pass to the node as a ROS parameter. Then it publishes the reference poses to a topic in real-time, which the controller node is subscribed to.

controller.py

This node subscribes to the topic that reference.py publishes reference poses to. It also subscribes to a motion capture node, from which it receives the robot pose in real-time. It then compares the robot pose to the reference pose and generates a control command to correct discrepancies.

Launching the nodes

A launch file, main.launch, has been written to run the two nodes at once. You can pass in ROS parameters for the set of waypoints that you wish the robot to track, the reference velocity to track, and the controller gains (has already been tuned). The 'waypoints' parameter should be a string of a nested list containing the waypoints. For example, to track a square of side length 1 meter, pass in "[[1,0],[1,1],[0,1],[0,0]]" as the paramter 'waypoints.' Note that the point [0,0] is defined as the position of the robot at the time of launching the node. The waypoints should be defined relative to this starting position of the robot.

Procedure for running the package

To run the ROS package, follow these steps:
(1) Create a new workspace and copy this package into the src folder. This src folder should also contain ros-aseba and ros-thymio packages downloaded from https://jeguzzi.github.io/ros-aseba/installation.html.
(2) Run roscore.
(3) To establish a connection between the Thymio and the PC, turn on the Thymio and insert the wireless USB dongle to the PC.
(4) Run the following commands to connect Thymio to the PC:

cd ~/<workspace>
source ~/<workspace>/install/setup.bash
source ~/<workspace>/devel/setup.bash
export DEVICE="ser:device=/dev/ttyACM0"
export SIMULATION=False
sudo chmod 666 /dev/ttyACM0
roslaunch thymio_driver main.launch device:=$DEVICE simulation:=$SIMULATION

If connection is successful, a message “thymio-II is ready at namespace” should appear in the shell.

(5) Run the following command to launch the motion capture node:

roslaunch mocap_optitrack mocap.launch

(6) Finally, run the following commands to launch the path tracking package:

cd ~/<workspace>
source ~/<workspace>/install/setup.bash
source ~/<workspace>/devel/setup.bash
roslaunch path_tracking main.launch

About

ROS package for path-tracking on the Thymio II robot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published