Skip to content

Commit b1472a1

Browse files
committedJan 10, 2022
Quikplan public.
0 parents  commit b1472a1

17 files changed

+1570
-0
lines changed
 

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__pycache__
2+
env
3+
.vscode/*
4+
.idea/*
5+
6+
renders/*

‎LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 FRC Team 604 Quixilver
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# *Quikplan*
2+
![quikplan](https://github.com/frc604/quikplan-public/blob/main/resources/quikplan.png)
3+
4+
<p align="center">
5+
<img src="https://github.com/frc604/quikplan-public/blob/main/resources/barrel_racing.gif" height="500"/>
6+
</p>
7+
8+
## Quikstart
9+
10+
### Requirements
11+
* [Python](https://www.python.org/downloads/) 3.7 or 3.8
12+
13+
Note: Quikplan has been **tested** with Python version `3.7` and `3.8`. Older versions **may** work but Python `3.9` is not currently supported.
14+
15+
### Installation
16+
* Clone the repository to your local machine with `git clone https://github.com/frc604/quikplan-public.git`
17+
* Navigate into the cloned repository with `cd quikplan-public`
18+
* Install the necessary libraries through `pip` by running `pip3 install --upgrade -r requirements.txt` in the root folder
19+
20+
### Running
21+
There are currently two available optimizers: `slalom` and `barrel_racing`. To run them just run their corresponding python file:
22+
* `python quikplan.py --slalom`
23+
* `python quikplan.py --barrel_racing`
24+
25+
## Initialization
26+
Quikplan also includes a simple GUI for creating initialization paths to be optimized. This can be launched by running:
27+
* `python quikplan.py --init`
28+
29+
<p align="center">
30+
<img src="https://github.com/frc604/quikplan-public/blob/main/resources/init_gui.png" height="300"/>
31+
</p>
32+
33+
Once the GUI has launched you can click on any of the preloaded setups in the obstacles list to load it onto the chart.
34+
35+
To add a waypoint just left click anywhere on the embedded chart and the line will expand to include the point you clicked.
36+
37+
Clicking and dragging lets you move a previously placed waypoint.
38+
39+
Right clicking on a previously placed waypoint deletes it from the path.
40+
41+
After creating an initialization path you can save it to a json file by clicking the `Save to JSON` button and entering the json name.
42+
43+
## Visualization
44+
Quikplan offers numerous options to visualize optimized paths. The two main methods for this are `plot_traj` and `anim_traj` in `helpers.py`.
45+
46+
### `plot_traj`
47+
`plot_traj` will plot the x, y, and theta poses in a trajectory using the provided robot geometry. It can also be used to plot obstacles. See `quikplan_slalom.py` for example use cases.
48+
49+
If the `save_png` param of `plot_traj` is set to `True` Quikplan will save the plot to a png file in the `renders` folder.
50+
51+
### `anim_traj`
52+
`anim_traj` will animate the robot moving through the poses in a trajectory using the provided robot geometry. It also has support for plotting obstacles. `quikplan_slalom.py` has an example use case.
53+
54+
Note: The timestep in `anim_traj` should be set to the dt between the trajectory states (in milliseconds) for the animation to run at the rate of the trajectory. `interp_state_vector` can be used to convert an optimized trajectory to a desired dt.
55+
56+
If the `save_gif` param of `anim_traj` is set to `True` Quikplan will save the animated trajectory as a gif file in the `renders` folder.

‎constants.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from enum import Enum
2+
3+
G = 9.81 # m/s/s
4+
5+
6+
class StateVars(Enum):
7+
xIdx = 0
8+
yIdx = 1
9+
thetaIdx = 2
10+
vlIdx = 3
11+
vrIdx = 4
12+
alIdx = 5
13+
arIdx = 6
14+
15+
16+
class ControlVars(Enum):
17+
jlIdx = 0
18+
jrIdx = 1

0 commit comments

Comments
 (0)
Please sign in to comment.