A Wheel Robot Odometry Tuning CLI Toolkit for VEX Robotics.
OTune is developed by Huaidian Daniel Hou ‘22 at the Haverford School as a Graduation project. The project is mentored by Mr. Myers and supported by the Haverford VEX Robotics Team 169. Some hardware for early development of this program is sponsored by Josiah Somani ‘22.
The project requires a few hardware components in order to function properly. In the case that some hardware is missing, I would like to attach the list of hardware required by this program:
-
A functioning computer with Linux installed
-
A Functioning robot brain with a working Micro USB port
-
A long Micro-USB to USB-A cable
-
A Vive Tracker package, which includes:
-
Tracker itself.
-
A USB-A to USB-C cable
-
A USB-C base
-
A USB-A Receiver
-
-
Lighthouses (base stations) for the Vive Tracker
- Either 1 or 2 base stations will work, but 2 base stations will result in more consistent performance.
-
Make sure you have a PC with Linux installed
- OTune is developed on Ubuntu 20.04 as of June 2022, but most other Linux distros should also work.
-
Install ROS Noetic (the latest version of ROS as of OTune development)
- Newer version of ROS should also work, but it is not a guarantee.
-
Create Your Catkin Workspace with this official guide
- Since your Catkin Workspace may not be the same as the one used during the time of development, the path to your Catkin Workspace is represented by the following for the rest of the guide
-
Install Steam
-
Install SteamVR
-
(Optional) Install VSCode
- For intuitive access to some config files later in this guide, installing a GUI script editor like VSCode is recommended, although you can still use editors like vim or nano.
-
Change SteamVR Settings
code <YOUR_STEAM_PATH>/steamppps/common/SteamVR/resources/settings/default.vrsettings # In the section "SteamVR" # Change Parameter "requireHMD" from "true" to "false"
-
In this case, “code” command is used to open file in VSCode. If you wish to use other editors, replace “code” with commands to open other editors.
-
<YOUR_STEAM_PATH> is usually
~/.local/share/Steam
but it may vary depending on your Steam installation.
-
-
Install ROS Package vive_ros
-
Install with provided instructions on the Vive_ROS Github Page
-
Replace the source code folder with the vive_ros folder in the cloned folder with the one from the provided package.
- This package contains minor changes to the code so that the node can run at 100 Hz and print every received information to the terminal.
-
-
Install ROS Package rosserial
-
Follow the instructions on their Github Page
https://github.com/ros-drivers/rosserial
-
Clone this to the src folder in your catkin workspace
cd <YOUR_CATKIN_WS>/src git clone https://github.com/ros-drivers/rosserial.git
-
Add otune_rosserial.launch to rosserial_vex_v5 launch folder
cp <PROVIDED_OTUNE_ROSSERIAL_PATH>/rosserial_vex_v5/otune_rosserial.launch catkin_ws/src/rosserial/rosserial_vex_v5/launch
-
-
-
Install ROS Package OTune from the provided package
- Copy and paste the provided rosserial package to the catkin_ws directory
- Note: because this is a custom package, it is not open source anywhere, so make sure you always have a copy of the provided package securely stored locally and in the cloud.
-
return to your main catkin workspace and compile these packages
cd <YOUR_CATKIN_WS>/ source devel/setup.bash catkin_make
-
Tips: every time a new instance of terminal is opened, if you want to run script or launch file on a complied package, run the following command
cd <YOUR_CATKIN_WS> source devel/setup.bash
Or you can add this to your .bashrc file so this is done automatically every time a new bash instance is started
code ~/.bashrc # Add thie following line to the end of the bash file: # # source <YOUR_CATKIN_WS>/devel/setup.bash # # Close the .bashrc file and source it: source ~/.bashrc
-
Configure your user access on USB devices so that you can upload programs to the Brain in Linux as well as receive messages from it.
-
Add the current user to the group “dialout” and “tty”
usermod -aG dialout ${USER} usermod -aG tty ${USER}
-
Restart the computer.
-
Now pros should be able to communicate with the brain
-
-
Install the template otune_rosserial in your PROS project
-
Configure your drive to follow the path when program starts or when it receives some form of signal.
- Because the tuner uses the hypotenuse of planar velocity, this velocity is always positive. Therefore, if you are using left-right configuration of any kind, make sure both of your wheels run in the positive direction at any point during the tuning. If one wheel travels the opposite direction of the other wheel, the tuning will become less accurate.
-
Configure your robot to transmit the appropriate string to OTune
- Format 1: “<TUNING_MODE><LEFT_WHEEL_VELOCITY_RAW>_<RIGHT_WHEEL_VELOCITY_RAW>”
- Format 3: “<TUNING_MODE><CENTER_WHEEL_VELOCITY_RAW>_<BACK_WHEEL_VELOCITY_RAW>”
- Format 3 (Not supported by otune_optimizer.py as of June 2022): “<TUNING_MODE><LEFT_WHEEL_VELOCITY_RAW><RIGHT_WHEEL_VELOCITY_RAW><BACK_WHEEL_VELOCITY_RAW>”
- For Example, a Center_back wheel configuration robot driving 20% through the desired path, with center wheel rotational velocity 1400deg/s and back wheel rotational velocity 200deg
- The string should be “1_20_1400_200”
-
Open a new terminal and start a roscore
roscore
-
Start Steam
-
Start SteamVR
-
Connect Tracker
-
Turn on lighthouse and make sure they are properly installed and synced
b. Turn on tracker and connect to SteamVR
Since we are not using a headset, we cannot and don’t need to do calibraiton
-
-
Start the vive node in a new terminal
cd ~/catkin_ws source devel/setup.bash roslaunch vive_ros vive.launch
- You should be able to see the output velocities in the terminal window
-
Turn on your PROS program on the VEX brain
-
Start the otune_rosserial node in a new terminal
cd ~/catkin_ws source devel/setup.bash roslaunch rosserial_vex_v5 otune_rosserial.launch
- You should be able to see the string messages in the terminal window
- If not, check your USB connection
-
Run the otune_listener.py script in the otune package
rosrun otune otune_listener.py
- You should see prompts from the script telling you if the tuning is in progress and how much it has done
- At the end of the tuning, the script will automatically tune the parameters based on the recorded bag file.
- otune_rosserial is dependent on ros_lib, the package provided in rosserial to enable communication between the VEX Brain and the ROS system.
- If you are using a different version of ROS (the version tested is ROS Noetic as of June 2022)
-
Make sure your rosserial and vive_ros packages are compiled under the currently installed ROS version.
-
Use the following script to create a pros project.
catkin_ws/src/rosserial_vex_v5/src/scripts/genproject.sh <YOUR_PROJECT_DIRECTORY>
-
Delete the old autonomous.cpp, opcontrol.cpp, and initialize.cpp files, located in the src folder, as they were for older versions of PROS.
-
Copy the following folders to the respective folders in the newly generated project
otune_rosserial/include/otune otune_rosserial/src/otune
-
Compile and see if there are error due to change in the version of ROS.
-
If not, Congratulations!
-
Edit the makefile and use the PROS conductor to make the new project a template
-
See official PROS Conductor documentation for detailed usecases
-
As of June 2022, PROS 3.3.3, this command is used to make the project into a template:
pros make template
-
This project is distributed under the MIT License. For details, read LICENSE.