The never complete autopilot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nppilot/NOTES

88 lines
2.6 KiB

Bugs
====
1. The servo output is noisy.
Not too bad, but you can hear the servo dithering and see it on the
scope. Not surprising as it's interrupt derrived.
2. The rover side halts after ~30s.
Seems to have cleared after changing the serial port read to all
bytes instead of 1 by 1.
Nope, still present. Perhaps noise causing a break or other error?
Added a watchdog to see if it's the inputs
Checked against pyserial. Match fine.
3. FIXED: Communication is unreliable until reflashed.
Running avrdude flash makes all frames come through. Before that
only short ones do. Could be the port settings or AVR speed.
4. FIXED: Lacking logging.
Log all the inputs and outputs. Was turned down due to #2.
Fixes
=====
3.
Loading calibrate and putting the scope on shows 902.7 us for 9
bits. Suggests FCPU = 8.31 MHz. So the divisor should be good,
suggesting the mode is not.
After running rover, stty says:
speed 38400 baud; line = 0;
min = 1; time = 0;
-brkint -imaxbel
-opost
-isig -icanon -echo -echoe
After flashing, stty says:
speed 19200 baud; line = 0;
min = 1; time = 0;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
1:0:8bf:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
And running stty with this clears the fault.
Diff:
ignbrk -icrnl
-onlcr
-iexten -echok -echoctl -echoke
Shouldn't matter: ignbrk
FIXED: goserial was pulling in the (broken) serial_posix.go. Fix the
build selectors.
Thoughts on Go
==============
No generics is messy:
1. Can't have a min/max/abs that work on any numeric types.
2. Can't easily pick float32 vs float64 based on the application as
you have to redo everything else.
I'd like nullable types for things like inputs that may be missing.
Having no generics makes implementing an alternative harder.
No default argument values. I'd like to do a 'CheckClose(a, b,
epsilon=0.01)' but you either need to supply epsilon everywhere or do
a CheckClose and CheckClose2.
No operator overloading.
Built in types are special. You can do len(MyOwnType) and instead
need MyOwnType.Len().
Explicit casting. This is OK, but it's weird to need to cast an int
to a float to multiply it by another float.
select across channels is nice.
The %+v struct-with-field-names formatter is nice.
No easy test for 'x in map'.
Strings are a funny mix of bytes and runes. Most work on bytes, but
range works on runes. Popping a rune from a string is messy.
The built-in types are good and generic and do things like return
specific polymorphisim. You can't do that on anything else.