Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b837676
Merge pull request #23 from osu-uwrt/Controller-New-AutoFF
zehdari Apr 3, 2025
0ee7263
Alex Latest
spyalexs Jul 5, 2025
248850e
Merge branch 'Drag-Sampling' of https://github.com/osu-uwrt/riptide_c…
spyalexs Jul 5, 2025
91e5bbb
Merge pull request #26 from osu-uwrt/Drag-Sampling
Effo12345 Jul 13, 2025
f6d2b38
Added safety checks to prevent near zero writing, and write to temp f…
zehdari Sep 19, 2025
0b6bf2f
Move autoff files to /var/lib/autoff
osu-uwrt-bot2 Sep 28, 2025
2afae69
Merge pull request #27 from osu-uwrt/AutoFFCorruptionFixes
Effo12345 Sep 28, 2025
3e7bb9d
new damping made, tuning it
thdrmngm Feb 25, 2026
aa4457d
Reversing previous commit to start of day
thdrmngm Feb 25, 2026
520862d
done control loop version
thdrmngm Feb 25, 2026
8749844
pre avg smc, post main adjustments
thdrmngm Mar 3, 2026
e956c92
working smc minimizer ff, needs tuning still
thdrmngm Mar 6, 2026
52daa28
Min avg smc doneish, roll not working
thdrmngm Mar 11, 2026
6943c06
updated to position min, working enough to tune and fix
thdrmngm Mar 16, 2026
1e98e1c
continued tuning, getting better
thdrmngm Mar 24, 2026
455ac10
tuned pretty good avg error
thdrmngm Mar 25, 2026
02fdc62
further tuning and layout clean up
thdrmngm Mar 25, 2026
540b55c
finished on normal model: pre mass tests
thdrmngm Mar 26, 2026
eae09c1
good for COM and KG tests, not for mid sim update
thdrmngm Apr 1, 2026
4d7df86
added in reset for mid run weight update - not fully good
thdrmngm Apr 17, 2026
23106e8
saving before potential revert
thdrmngm May 22, 2026
056d326
Revert "saving before potential revert"
thdrmngm May 23, 2026
fc3ec07
Revert "added in reset for mid run weight update - not fully good"
thdrmngm May 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
41 changes: 26 additions & 15 deletions riptide_controllers/src/riptide_controllers/controller_overseer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import yaml
import yaml.parser
import rclpy
import shutil
import numpy as np
from collections import deque
from rclpy.node import Node
Expand Down Expand Up @@ -45,7 +46,7 @@
AUTOTUNE_REINIT_TOPIC_NAME = "controller/re_init_accumulators"
WEIGHTS_FORCE_UPDATE_PERIOD = 1

ORIN_AUTOTUNE_DIR = "/bin"
ORIN_AUTOTUNE_DIR = "/var/lib/autoff"

AUTOFF_INIT_TOLERANCE = .01 #seeing rounding errors lol

Expand Down Expand Up @@ -902,6 +903,13 @@ def ffAutoTuneCB(self, msg):
self.re_init_signal_pub.publish(msg)

return

# Make sure we aren't writing 0 -ish values
if (abs(msg.linear.x) < AUTOFF_INIT_TOLERANCE and abs(msg.linear.y) < AUTOFF_INIT_TOLERANCE and
abs(msg.linear.z) < AUTOFF_INIT_TOLERANCE and abs(msg.angular.x) < AUTOFF_INIT_TOLERANCE and
abs(msg.angular.y) < AUTOFF_INIT_TOLERANCE and abs(msg.angular.z) < AUTOFF_INIT_TOLERANCE):
self.get_logger().warn("Received near-zero autotune data, skipping write to prevent corruption")
return

#if the twist has been updated
if (not (self.currentAutoTuneTwist[0] == msg.linear.x and self.currentAutoTuneTwist[1] == msg.linear.y and self.currentAutoTuneTwist[2] == msg.linear.z and
Expand All @@ -911,7 +919,7 @@ def ffAutoTuneCB(self, msg):

drag_forward_string = ""
drag_reverse_string = ""
if(not ((self.drag_comp_forward_data is None) or (self.drag_comp_reverse_data is None))):
if self.drag_comp_forward_data is not None and self.drag_comp_reverse_data is not None:

#write the forward drag string
drag_forward_string = f"drag_forward: ["
Expand All @@ -927,22 +935,25 @@ def ffAutoTuneCB(self, msg):

#write config to file
try:
with open(self.autoff_config_path, "w") as config:

# Write to temporary file first
temp_path = self.autoff_config_path + ".tmp"
with open(temp_path, "w") as config:
config.write(auto_ff_config_string)


if not ((self.drag_comp_forward_data is None) or (self.drag_comp_reverse_data is None)):
#cant save until cb complete
if self.drag_comp_forward_data is not None and self.drag_comp_reverse_data is not None:
config.write(drag_forward_string)
config.write(drag_reverse_string)

config.close()

except FileExistsError:
self.get_logger().error(f"Cannot open ff auto tune file at: {self.autoff_config_path}")
except PermissionError:
self.get_logger().error(f"No Permission to write of autoff file at: {self.autoff_config_path}")

# Move temp only after successful write
shutil.move(temp_path, self.autoff_config_path)

except (FileExistsError, PermissionError) as e:
# Clean up temp file if it exists
if os.path.exists(temp_path):
try:
os.remove(temp_path)
except:
pass
self.get_logger().error(f"Failed to write autotune file: {e}")



Expand Down