diff --git a/README.md b/README.md index ce7ef18..077cd63 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,25 @@ (WIP) An auto creation tool for Ridgebotics 2024 ### Install + ```shell git clone https://github.com/astatin3/autoPlanner cd autoPlanner pip install -r requirements.txt python3 ./main.py ``` + ### Usage: -##### "Path Editor" Tab: +##### "Path Editor" Tab: + - Click to add 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: + - 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. - 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. ##### "Export" Tab: + - Click export, and save to a file ### Known Bugs: + - 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) \ No newline at end of file +- The driver controller's movement stick is rotated by 90 degrees (Maybe) diff --git a/src/pathEditor.py b/src/pathEditor.py index fc43aec..8059d58 100644 --- a/src/pathEditor.py +++ b/src/pathEditor.py @@ -101,6 +101,26 @@ def points2rad(center, pos): diffY = center[1] - pos[1] 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: name = "Path Editor" @@ -149,6 +169,9 @@ class pathEditor: clickType, clickIndex = getElemAt(pos) if clickType == -1: pass + elif clickType == 1: + smoothPoints(clickIndex) + refresh() elif clickType == 0: if clickIndex > 0: if clickIndex < len(nodes)-1: