mirror of
https://github.com/Team4388/autoPlanner2025.git
synced 2026-06-09 00:38:05 -06:00
Add a feature to make the path continuous
This commit is contained in:
@@ -3,19 +3,25 @@
|
|||||||
(WIP) An auto creation tool for Ridgebotics 2024
|
(WIP) An auto creation tool for Ridgebotics 2024
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/astatin3/autoPlanner
|
git clone https://github.com/astatin3/autoPlanner
|
||||||
cd autoPlanner
|
cd autoPlanner
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
python3 ./main.py
|
python3 ./main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage:
|
### Usage:
|
||||||
|
|
||||||
##### "Path Editor" Tab:
|
##### "Path Editor" Tab:
|
||||||
|
|
||||||
- Click to add nodes
|
- Click to add nodes
|
||||||
- Click on specific points to manipulate paths and nodes
|
- Click on specific points to manipulate paths and nodes
|
||||||
|
- Double click on nodes to delete them
|
||||||
|
- Double click on control points to make path, and robot movment continuous, while keeping the node clicked the at the same location
|
||||||
|
|
||||||
##### "Button editor" Tab:
|
##### "Button editor" Tab:
|
||||||
|
|
||||||
- Click on specific frames on the timeline to change to that position
|
- Click on specific frames on the timeline to change to that position
|
||||||
- When selected on a frame, the robot's position in that time should show up.
|
- When selected on a frame, the robot's position in that time should show up.
|
||||||
- Drag positional keyframes around to speed up and speed down the robot's travel between nodes
|
- Drag positional keyframes around to speed up and speed down the robot's travel between nodes
|
||||||
@@ -23,8 +29,10 @@ python3 ./main.py
|
|||||||
- In button mode select buttons on the driver and operator controllers.
|
- In button mode select buttons on the driver and operator controllers.
|
||||||
|
|
||||||
##### "Export" Tab:
|
##### "Export" Tab:
|
||||||
|
|
||||||
- Click export, and save to a file
|
- Click export, and save to a file
|
||||||
|
|
||||||
### Known Bugs:
|
### Known Bugs:
|
||||||
|
|
||||||
- Because the variables don't get transferred over yet, you must click on the button editor tab before exporting.
|
- Because the variables don't get transferred over yet, you must click on the button editor tab before exporting.
|
||||||
- The driver controller's movement stick is rotated by 90 degrees (Maybe)
|
- The driver controller's movement stick is rotated by 90 degrees (Maybe)
|
||||||
@@ -101,6 +101,26 @@ def points2rad(center, pos):
|
|||||||
diffY = center[1] - pos[1]
|
diffY = center[1] - pos[1]
|
||||||
return -math.atan2(diffY, diffX) - (math.pi/2)
|
return -math.atan2(diffY, diffX) - (math.pi/2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def smoothPoints(index: int):
|
||||||
|
for i in range(index+1, len(curveEditPoints)):
|
||||||
|
controlPointPos = curveEditPoints[i-1]
|
||||||
|
nodePos = nodes[i]
|
||||||
|
curveEditPoints[i] = (
|
||||||
|
2*nodePos[0] - controlPointPos[0],
|
||||||
|
2*nodePos[1] - controlPointPos[1]
|
||||||
|
)
|
||||||
|
for i in range(0, index):
|
||||||
|
controlPointPos = curveEditPoints[index-i]
|
||||||
|
nodePos = nodes[index-i]
|
||||||
|
curveEditPoints[index-i-1] = (
|
||||||
|
2*nodePos[0] - controlPointPos[0],
|
||||||
|
2*nodePos[1] - controlPointPos[1]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class pathEditor:
|
class pathEditor:
|
||||||
name = "Path Editor"
|
name = "Path Editor"
|
||||||
|
|
||||||
@@ -149,6 +169,9 @@ class pathEditor:
|
|||||||
clickType, clickIndex = getElemAt(pos)
|
clickType, clickIndex = getElemAt(pos)
|
||||||
if clickType == -1:
|
if clickType == -1:
|
||||||
pass
|
pass
|
||||||
|
elif clickType == 1:
|
||||||
|
smoothPoints(clickIndex)
|
||||||
|
refresh()
|
||||||
elif clickType == 0:
|
elif clickType == 0:
|
||||||
if clickIndex > 0:
|
if clickIndex > 0:
|
||||||
if clickIndex < len(nodes)-1:
|
if clickIndex < len(nodes)-1:
|
||||||
|
|||||||
Reference in New Issue
Block a user