code logs -> 2019 -> Sat, 02 Mar 2019< code.20190301.log - code.20190303.log >
--- Log opened Sat Mar 02 00:00:49 2019
00:01 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
00:44 Derakon[AFK] is now known as Derakon
00:58 celmin|sleep is now known as celticminstrel
01:15
<&McMartin>
[R] I *think* it's predominantly C so it should not be too terribly nasty
01:32 Kindamoody is now known as Kindamoody[zZz]
04:26 catalyst [Jessikat@Nightstar-5dv16h.cable.virginm.net] has quit [Connection closed]
04:36 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
04:42 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
04:51 macdjord|slep is now known as macdjord
04:52 * macdjord ponders his adaptive bisection search algorithm
04:54
<@macdjord>
I use 3 strategies for picking my test index:
04:54
<@macdjord>
1) Linear interpolation between the min and max values of the range
04:55
<@macdjord>
2) Linear interpolation, but the result is clamped to never fall within the first or last 10% of the range
04:55
<@macdjord>
3) Straight bisection
04:56
<@macdjord>
I start with strategy 1, but if any given round removes < 10% of the range, I fall back to strategy 2 for the next round.
04:58
<@macdjord>
If the strategy 2 round take off more than 10% of the range, I resume strategy 1 for the next round. If it only takes off 10% (the clamping ensures it cannot do worse) then I fall back to strategy 3 for the next round.
04:59
<@macdjord>
And after any round of strategy 3 I try strategy 2 again.
05:00
<@macdjord>
The idea is that strat 1 can potentially find the answer in O(1) time if the data is ~linear.
05:02
<@macdjord>
Strat 2 handles the case where the target value is near one end of the range, but linear interpolation keeps guessing values on the small end.
05:02
<@macdjord>
And then start 3 ensures reasonable performance even against pathological inputs.
05:02
<@macdjord>
Now, what can I do to improve it?
05:12 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code
05:12 mode/#code [+qo Vorntastic Vorntastic] by ChanServ
05:18 mac [macdjord@Nightstar-grpbnp.mc.videotron.ca] has joined #code
05:18 mode/#code [+o mac] by ChanServ
05:19 macdjord [macdjord@Nightstar-grpbnp.mc.videotron.ca] has quit [Ping timeout: 121 seconds]
05:23 Derakon is now known as Derakon[AFK]
06:16 mac [macdjord@Nightstar-grpbnp.mc.videotron.ca] has quit [[NS] Quit: Deep inside, every housecat believes themself to be just a temporarily embarrassed tiger.]
06:22 macdjord [macdjord@Nightstar-grpbnp.mc.videotron.ca] has joined #code
06:22 mode/#code [+o macdjord] by ChanServ
06:49 celticminstrel is now known as celmin|sleep
10:16 Kindamoody[zZz] is now known as Kindamoody
11:00 Kindamoody is now known as Kindamoody|afk
11:08 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
15:50 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:50 mode/#code [+qo Vornicus Vornicus] by ChanServ
17:32 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
17:40 * ToxicFrog bonks her head gently against the keyboard
17:40
<&ToxicFrog>
The reason none of my debugging output is working is because AVR libc doesn't link in support for printf("%f") by default, because it's huge.
17:40
<&[R]>
Ha
17:41
<&[R]>
... and it doesn't give any error/warning about that?
17:42
<&ToxicFrog>
It outputs ? instead
17:43
<&ToxicFrog>
I mean, in the documentation for vfprintf() it mentions this, but there's no compile-time warning or anything
17:43
<&ToxicFrog>
I think because this is a linker setting, and by the time the linker runs it has no idea what arguments you passed to printf
18:05
<&ToxicFrog>
Oh no wonder the numbers I'm getting from this thing are so weird
18:05
<&ToxicFrog>
Magnetic field inclination where I am is like +70°
18:10
<~Vornicus>
so north is ...down?
18:17
<&ToxicFrog>
Yes.
18:17
<&ToxicFrog>
Turns out magnetic compasses are usually counterweighted based on their expected country of use to compensate for this!
18:19
<&ToxicFrog>
Magnetomechanical compasses, I mean.
18:19
<~Vornicus>
oh shit that's neat
18:19
<&ToxicFrog>
While what I have is a solid-state magnetoresistive compass, which just gives me a field vector.
18:19
<&ToxicFrog>
(since it's actually three individual magnetometers, one per axis)
18:23
<&ToxicFrog>
Now, as long as it's level I can get away with taking the arctangent of the two horizontal axes and throwing out the third, but if you tilt it more than 20° to the south it starts giving you garbage.
18:23
<&ToxicFrog>
I may have to implement some sort of inclination correction.
18:27
<~Vornicus>
proj(v, x) + proj(v, z)
18:27
<&ToxicFrog>
You're going to have to expand on that
18:29
<&ToxicFrog>
At the moment it gives me x/y/z field strength values and I take atan2(z,y) (or whatever axes are horizontal in its current mounting) and then range-correct it into [0,360)
18:29
<~Vornicus>
where proj(a, b) = b * dot(a,b) / dot(b,b)
18:30
<~Vornicus>
where x and z are your horizontal axes
18:30
<&ToxicFrog>
(basically, taking the projection of the field strength vector into the horizontal plane, then computing its angle)
18:38
<~Vornicus>
though I guess v - proj(v, y) would work faster. remember you need to consider the orientation of your thingy according to the gyros
18:39
<&ToxicFrog>
There are no gyros.
18:39
<&ToxicFrog>
I have three single-axis magnetometers at 90° to each other and that's it.
18:39
<&ToxicFrog>
Understanding of which axes are "horizontal" and which axis is "vertical" is determined at compile time based on how I've mounted the compass.
18:40
<~Vornicus>
aha
18:40
<~Vornicus>
What is it mounted on?
18:41
<&ToxicFrog>
At the moment, a breadboard
18:41
<&ToxicFrog>
Eventually, some sort of clothing
18:42
<&ToxicFrog>
I may have to eventually pair it with gyros and/or accelerometers to get it to work reliably, but knowing the inclination and approximate field strength in this region should be enough for it to figure out roughly how it's oriented.
18:42
<&ToxicFrog>
The most immediate aggravation is just that if you tilt it ~20° south or so, what happens is that the up/down axis increases slightly, the east/west axis remains the same, and the north/south axis suddenly reverses.
18:46
<~Vornicus>
Things I saw coming: that
18:49
<&ToxicFrog>
But knowing the local inclination should be sufficient to correct for that, I think -- basically, get the field vector, then swing it up by 70°, then project and get the bearing.
18:50
<&ToxicFrog>
...assuming we can differentiate between "facing north" and "facing south but tilted down 40°", but I think we can do that with the east-west axis
18:50
<&ToxicFrog>
But I do not have nearly enough brain today to work out the details of that
18:52
<&ToxicFrog>
Especially not while on Alex duty with no backup ;.;
18:53
<~Vornicus>
You only get one vector, don't you?
18:56
<&ToxicFrog>
Yes -- the readings from the three magnetometers.
18:57
<&ToxicFrog>
Oh, right, hrm, I can't do that with east-west
18:57
<&ToxicFrog>
For some reason I was briefly modeling Earth's magnetic field as two overlapping fields at right angles to each other, which...it really isn't
18:58
<&ToxicFrog>
I probably should not be trying to math while this tired.
18:59
<~Vornicus>
Right, you don't get full orientation, just one of the two vectors, so you can't distinguish between the two, you're gimbal locked
18:59 Derakon[AFK] is now known as Derakon
19:01
<&ToxicFrog>
Right. So if I want this to be inclination-corrected I also need, at minimum, something to tell it what direction gravity is in.
19:15
<~Vornicus>
Yep.
19:20
<~Vornicus>
Cross those two you get east (or west, depending on handedness), cross east and down and you get north (or south)
19:58 mode/#code [+o PinkFreud] by ChanServ
20:12 Kindamoody|afk is now known as Kindamoody
21:34 poxifide [poxifide@Nightstar-09mo82.rcfreak0.com] has quit [G-Lined: Spamming proxy, see ya... (ID: 8ZVABLHNEJ)]
21:35 Tamber [tamber@furryhelix.co.uk] has quit [G-Lined: Spamming proxy, see ya... (ID: TMB3TADPNX)]
21:40 Tamber [tamber@furryhelix.co.uk] has joined #code
21:40 mode/#code [+o Tamber] by ChanServ
--- Log closed Sat Mar 02 23:00:54 2019
--- Log opened Sat Mar 02 23:01:00 2019
23:01 TheWatcher [chris@GlobalOperator.Nightstar.Net] has joined #code
23:01 Irssi: #code: Total of 32 nicks [24 ops, 0 halfops, 0 voices, 8 normal]
23:01 mode/#code [+o TheWatcher] by ChanServ
23:01 Irssi: Join to #code was synced in 15 secs
23:30 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
23:36 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
--- Log closed Sun Mar 03 00:00:50 2019
code logs -> 2019 -> Sat, 02 Mar 2019< code.20190301.log - code.20190303.log >

[ Latest log file ]