#garfield Logs

Feb 17 2024

#garfield Calendar

12:33 AM rif_shed: g'day rue
12:46 AM rif_shed: 5.30pm here, back and ready to make a few more chips
02:45 AM polprog: thats bad
02:45 AM polprog: :P
10:26 AM obfuscated_d: you around rue_mohr?
12:09 PM rue_mohr: obfuscated_d, hi, yes
12:09 PM rue_mohr: obfuscated_d, did you have a chance to try that code
12:09 PM rue_mohr: I'm just waking up now
12:26 PM obfuscated_d: oh , sorry
12:27 PM obfuscated_d: I did try out the code. I installed the avr toolchain and stopped using the arduino ide. You have an excellent makefile! The code does work great, but it turned out that the interrupt was not triggering on PD7, it is actually triggering on a rising edge of PC0, analog input 0
01:30 PM rue_mohr: ??
01:30 PM rue_mohr: odd
01:30 PM rue_mohr: I'll have to look at that again, it was supposed to be routed from PD7
01:33 PM obfuscated_d: yea, that's was i thought. I mean, it does work really well on PC0...
01:37 PM obfuscated_d: as a side note, what do you normally open your serial port with? I'm using screen, and it works, but the formatting is odd
01:41 PM rue_shop3: minicom
01:42 PM obfuscated_d: ah, maybe I'll try that out
01:44 PM rue_shop3: ugh, I have to go back to the start of this FSM clock, grrr
01:44 PM rue_shop3: distractions
01:45 PM obfuscated_d: work stuff?
01:48 PM rue_shop3: no
01:48 PM rue_shop3: other projects doing the boomerang thing
01:48 PM rue_shop3: I'm always a mess of distractions
01:49 PM rue_shop3: let me see if I can work out whats up with PD7
01:49 PM obfuscated_d: no worries, I haven't had a ton of time to devote to this either. I've been trying to find work,working on side jobs, and doing interview prep. so it's a little hectic
01:50 PM rue_shop3: that sucks
01:50 PM rue_shop3: I ditched being a dev for work stability
01:50 PM obfuscated_d: yea, job market is a little rough right now. at least it has been for me
01:50 PM rue_shop3: became an electrician
01:50 PM rue_shop3: but its not a job you can do forever
01:51 PM rue_shop3: (I'm just babbeling now)
01:51 PM obfuscated_d: ah. I did that for a while when I was younger. I got into tech to save the strain on my body. I was working as a home remodeler 3 years ago
01:51 PM rue_shop3: section 21 of the mega328 pdf is the analog comparator
01:51 PM obfuscated_d: yea, I'm checking ut out now
01:51 PM rue_shop3: figure 21-1 shows the routing
01:52 PM rue_shop3: ACME and ADEN determine the signal source for -
01:53 PM rue_shop3: obfuscated_d, yea, dont let this mess up establishing an income
01:54 PM obfuscated_d: this project? no, it's not. there's only so much jpb hunting I can do in a day
01:54 PM obfuscated_d:  need to keep my sanity somehow
01:55 PM rue_shop3: :)
01:55 PM obfuscated_d: I really want to get more into embedded, so this is great
01:55 PM obfuscated_d: sorry I'm not super helpful at this currently :/
01:56 PM rue_shop3: ok, step 1, grrr find my ascii art for a pro mini
01:57 PM obfuscated_d: haha, no worries about a diagram for my sake, I have pinout diagrams aplenty on hand
01:57 PM rue_shop3: ah, I found a list, close enough
01:58 PM obfuscated_d: https://devboards.info/boards/arduino-pro-mini
01:59 PM rue_shop3: ah no, ascii art to paste into the code
02:00 PM obfuscated_d: oh okay
02:00 PM rue_shop3: https://paste.debian.net/1307653/
02:00 PM rue_shop3: I have that, which isn't but close enough
02:02 PM obfuscated_d: I feel like you mentioned the boomerang , but what is that project about?
02:04 PM rue_shop3: its a finite state machine clock, Laurance on irc made a pcb for one and its not working, I just fired up my prototype one and its not working now either, but I'm going to have to just take it down to the bones and build it up again
02:04 PM rue_shop3: it'll take some time
02:05 PM rue_shop3: in the init
02:05 PM rue_shop3: I must ahve set
02:05 PM rue_shop3: ACME should be high and ADEN should be low...
02:05 PM rue_shop3: I set ACME
02:06 PM rue_shop3: oh
02:06 PM rue_shop3: table 21-1
02:06 PM rue_shop3: ACME clear and ADEN doesn't matter
02:06 PM rue_shop3: oops
02:06 PM rue_shop3: ADCSRB = (1 << ACME); comment that out
02:06 PM obfuscated_d: (y)
02:07 PM rue_shop3: hahah the serial stream is too fast, my window backed up
02:08 PM rue_shop3: oh I said it right in the comments too
02:08 PM rue_shop3: ok
02:08 PM rue_shop3: coding too late at night
02:08 PM rue_shop3: yes, with that not set its working great on PD7
02:09 PM rue_shop3: both directions
02:09 PM obfuscated_d: sweet
02:11 PM rue_shop3: ok, that can be melted into the other code
02:11 PM rue_shop3: but
02:11 PM rue_shop3: rememeber that conditional if thing I was talking about?
02:11 PM rue_shop3: I didn't get the time to sit down and work it out
02:12 PM rue_shop3: ok so, wait
02:12 PM rue_shop3: lets make it step on rising edge, with + on PD6 being count_up
02:13 PM rue_shop3: the polarity of PD6 is right
02:17 PM rue_shop3: oh no, I made pd7 an output
02:17 PM obfuscated_d: it's not working on my end
02:17 PM rue_shop3: change PD7 to be an input!!!
02:17 PM rue_shop3: at the top
02:17 PM obfuscated_d: yup
02:18 PM rue_shop3: I dont know why that worked
02:18 PM rue_shop3: its streaming fast, make the minicom window small
02:18 PM obfuscated_d: working great now
02:18 PM rue_shop3: otherwise it just buffers up
02:18 PM rue_shop3: ok, its the wrong edge
02:19 PM rue_shop3: its changing when the step goes low
02:19 PM rue_shop3: oh, just a sec,
02:19 PM rue_shop3: I'm gonna check an A9844 datasheet
02:19 PM obfuscated_d:  USART_printstring( "\r\n");  change to this
02:20 PM obfuscated_d: fixes that issue
02:20 PM rue_shop3: oh yeam, you can adjust it in minicom tooo
02:20 PM rue_shop3: ctrl-a z for help
02:20 PM rue_shop3: ctrl-a u is add...
02:20 PM rue_shop3: and ctrl-a a is add...
02:22 PM obfuscated_d: what's interesting, is if it's negative, it seems to be sending data slower?
02:23 PM rue_shop3: whats the bits for the other edge?
02:23 PM rue_shop3: ah 0 clear
02:24 PM rue_shop3: ok thats rising edge
02:24 PM rue_shop3: make the minicom window small, it backlogs easy
02:25 PM rue_shop3: datarate is a bit silly for this
02:25 PM obfuscated_d: seems to be keeping up okay. haha yea, it's pretty fast
02:25 PM rue_shop3: I hooked it up to a 0.1Hz signal
02:25 PM rue_shop3: ACSR = ( 1 << ACIS1 ) | ( 1 << ACBG ) | ( 1 << ACIE ); // + input to bandgap, enable interrupts on rising edge
02:25 PM rue_shop3: is the right init
02:26 PM obfuscated_d: so get rid of ACIS0
02:26 PM rue_shop3: yup
02:26 PM rue_shop3: which has it working ok here, so I'll update github
02:26 PM rue_shop3: ok feeling like your brains working, I'm still a bit foggy
02:26 PM rue_shop3: maybe we can work out the if block
02:27 PM obfuscated_d: haha not sure if mine's working that great but I'll try.
02:27 PM obfuscated_d: sounds like we want 1 of three states, moving, idling , stopping
02:28 PM rue_shop3: yup
02:28 PM rue_shop3: and the inputs we have are veloctiy and position
02:28 PM rue_shop3: (and the table)
02:28 PM obfuscated_d: at any time we should be able to discern what state were in
02:28 PM rue_shop3: github updated
02:29 PM rue_shop3: yea, no while() loops when in state
02:29 PM obfuscated_d: I was a little confused about the timer overflow interrupt as velocity
02:29 PM rue_shop3: every change flag we can recalculate
02:29 PM rue_shop3: so, when it gets too slow, the timer will rollover before you see a line
02:29 PM obfuscated_d: oh, so that overflow triggers a new calc
02:30 PM obfuscated_d: which with no prescaler is ~244hz?
02:30 PM rue_shop3: on overflow I just cut the velocity off at 60000, which is close enough to 0 rpm
02:30 PM obfuscated_d: did I do that math wrong
02:30 PM rue_shop3: that sounds about right
02:30 PM rue_shop3: and if your using a descent ecoder, thats not significant motion
02:31 PM obfuscated_d: the motor I got has an annoying 4344 pulses per rev -_-
02:31 PM rue_shop3: its just a catch, you dont want to pick up some random value after a rollover
02:31 PM rue_shop3: thats ok
02:31 PM rue_shop3: strange number
02:31 PM obfuscated_d: just not a clean divisible number
02:32 PM rue_shop3: thats ok
02:32 PM rue_shop3: I'm not worried about the step sizes
02:32 PM rue_shop3: 4344 - 2171 - 1086 - 543
02:33 PM rue_shop3: huh
02:33 PM rue_shop3: ok, so
02:33 PM rue_shop3: the system is stopped
02:34 PM obfuscated_d: it's due to the gear reduction. but whatever, not important
02:34 PM rue_shop3: a step command comes in, and *subtracts* 144 to the position, so the system needs to move forward
02:34 PM rue_shop3: to bring it back to 0
02:34 PM obfuscated_d: why 144?
02:34 PM rue_shop3: random value
02:34 PM obfuscated_d: okay
02:35 PM rue_shop3: the step size can be 'whatever you like' I think 144 is about 18 degrees on my setup
02:35 PM obfuscated_d: okay, so it's pulses per set step size you're after
02:35 PM rue_shop3: you want it to be more than the minimum in the stopping table for sure
02:35 PM obfuscated_d: makes sense
02:36 PM rue_shop3: the value doesn't matter really tho
02:36 PM rue_shop3: just an example
02:36 PM rue_shop3: the system is stopped, and you get the pulse
02:36 PM obfuscated_d: so we're stopped, we get a step command, we start moving forward
02:36 PM rue_shop3: so it needs to turn the motor on forward
02:36 PM rue_shop3: right
02:36 PM obfuscated_d: if on the next calc, there is a new step command, ignore recalc and continue accel?
02:37 PM rue_shop3: well if we evaluate at each line that comes in, we can work out what to do
02:37 PM rue_shop3: but
02:37 PM rue_shop3: you might have a point, checking if there is a new step command might be a good idea, as it could change the outcome
02:38 PM rue_shop3: but lets chew on this if
02:38 PM rue_shop3: block
02:38 PM rue_shop3: while(1) { if(0){ }else if () {} else if () {} else if () {}
02:38 PM rue_shop3: }
02:39 PM obfuscated_d: I like to list things the block needs to know
02:39 PM obfuscated_d: are we moving? what's the current error? are we accelerating or stopping?
02:39 PM rue_shop3: it only has two things, position and velocity
02:39 PM rue_shop3: the others are calc'd
02:40 PM obfuscated_d: okay
02:41 PM rue_shop3: https://paste.debian.net/1307654/
02:41 PM rue_shop3: so, yea after waiting the flag we cant to calc that stuff
02:41 PM rue_shop3: moving is just a check if velocity = 60000
02:42 PM rue_shop3: moving = (velocity == 60000)?0:1;
02:43 PM rue_shop3: feel free to interrupt me :]
02:43 PM rue_shop3: error = posision
02:43 PM obfuscated_d: you're good. I'm taking itin
02:43 PM rue_shop3: because its all zero based
02:43 PM rue_shop3: acccelerating or stopping is more complex
02:44 PM rue_shop3: we need to be accelerating if we are more than the stopping distance away from 0
02:44 PM rue_shop3: we need to be stopping if we are moving and will overshoot 0
02:44 PM obfuscated_d: so as far as accelerating. It's sort of the responsibility of the GRBL or other controller to handle the acceleration accordingly. at least for a stepper
02:44 PM obfuscated_d: I feel like this is similar
02:45 PM rue_shop3: yes, but on our end, we need to know if we should have that motor in forward/reverse or off
02:45 PM obfuscated_d: decelerating is important though
02:45 PM obfuscated_d: thinking out loud kinda. Wondering if we can simplify anything
02:45 PM rue_shop3: and 'decelerating' is complex because that could be full forward or full reverse depending on the target
02:46 PM rue_shop3: https://paste.debian.net/1307655/
02:46 PM rue_shop3: there is a lot of stuff to juggle
02:47 PM Tom_L: busy little channel today
02:47 PM rue_shop3: especially becasue its directional
02:47 PM rue_shop3: hi Tom_L
02:47 PM rue_shop3: were building EGMK!!
02:47 PM rue_shop3: rif left :(
02:47 PM rue_shop3: he emailed me
02:47 PM Tom_L: but he knows
02:48 PM rue_shop3: yep
02:48 PM rue_shop3: I fear to think he was hunting around on freenode for us
02:48 PM rue_shop3: obfuscated_d, which direction were moving seems to be critical
02:49 PM rue_shop3: and that direction flag will be 1 for forward, 0 for stopped and -1 for reverse
02:49 PM Tom_L: still at the same job?
02:49 PM rue_shop3: him? sounds like it
02:49 PM Tom_L: he must like it
02:49 PM obfuscated_d: so something we do know, is that whatever is commanding the steps, is going to have accel/decel profiles... I'm wondering if we could use the time between step commands to evaluate if we should be accelerating, or stopping. That might be too complicated
02:49 PM rue_shop3: he said something a bit cryptic as to how he's feeling about it
02:49 PM rue_shop3: obfuscated_d, we dont ahve to worry about it
02:50 PM rue_shop3: we just need to apply whatever power is needed to the motor to get position back to 0
02:50 PM rue_shop3: and we dont have to worry about the speed we do it, we ALWAYS do it as fast as we can
02:50 PM rue_shop3: were emulating a stepper motor
02:50 PM obfuscated_d: right
02:51 PM rue_shop3: lightens the workload nicely :)
02:51 PM rue_shop3: so, I guess
02:51 PM obfuscated_d: so all we need to worry about, is if we're mid move, and a new step comes in
02:51 PM rue_shop3: not really
02:52 PM rue_shop3: if we take the velocity and position at each change in position, and recalculate the drive, we *should* be ok
02:52 PM rue_shop3: *** and probably recalculate when a new step command comes in
02:52 PM rue_shop3: so while (!flag) will account for encoder lines and the new step commands
02:52 PM rue_shop3: so while (!flag); will account for encoder lines and the new step commands
02:53 PM rue_shop3: oh, on the rollover I didn't set the direction to 0 did I?
02:54 PM rue_shop3: erp, no I didn't
02:54 PM rue_shop3: I'll fix that...
02:54 PM obfuscated_d: the stepDirComp doesn't have that. Do you mean the EncVel?
02:54 PM rue_shop3: enc_pwm_egmk_fixed3 is sort of the last looped version for position control
02:54 PM rue_shop3: but its a thing that should be in all of the servo code
02:55 PM rue_shop3: makingenc_pwm_egmk_fixed4 might be in order...
02:55 PM rue_shop3: making enc_pwm_egmk_fixed4 might be in order...
02:55 PM rue_shop3: hey, we should get your setup going
02:56 PM rue_shop3: seeing as you have the motor
02:56 PM rue_shop3: EncVelProf
02:56 PM rue_shop3: collect the stopping distance table for yours
02:56 PM rue_shop3: figure out how to parse the data
02:56 PM rue_shop3: :]
02:56 PM rue_shop3: I have a second motor I can profile too
02:57 PM obfuscated_d: alrighty, I'll run that and see what happens
02:57 PM rue_shop3: ok, might be good to run it a few times, it takes a while tho
02:57 PM obfuscated_d: can I pipe the output from minicom/
02:58 PM obfuscated_d: not sure how to do it with that
02:58 PM rue_shop3: maybe take it up to about 1000-2000 counts to give the motors speed time to saturate on the later tests
02:58 PM rue_shop3: oh
02:58 PM rue_shop3: you can save it as a file
02:58 PM rue_shop3: ctrl-a L
02:58 PM rue_shop3: it'll ask for a capture filename
02:58 PM rue_shop3: ctrl-a L again to close the file
02:58 PM obfuscated_d: sweet!
02:59 PM rue_shop3: I reset the avr after I start the capture, then erase the initial junk that got caught
03:02 PM obfuscated_d: is it supposed to work on step signals on PB1?
03:02 PM rue_shop3: no, it self-operates
03:02 PM rue_shop3: it starts with 1 step, and goes to the limit in the while (I think I had it at 4000)
03:03 PM obfuscated_d: hmm, not doing anything
03:03 PM rue_shop3: no little ticking noises?
03:03 PM rue_shop3: is it pushing serial data?
03:03 PM obfuscated_d: I'm getting the first line run,hit etc, but nothing else
03:03 PM rue_shop3: is the power on? :)
03:03 PM obfuscated_d: haha
03:03 PM rue_shop3: odd
03:04 PM obfuscated_d: no v out to the motor driver
03:04 PM rue_shop3: it waits to hit the target
03:04 PM rue_shop3: so that would do it :)
03:05 PM obfuscated_d: I don't follow?
03:07 PM rue_shop3: if the motor had no power it would just sit and wait for the system to hit the target line count
03:07 PM rue_shop3: is it working?
03:09 PM obfuscated_d: I flashed enc_pwm_egmk_fixed2, and it moves the motor a few steps then stops. If I wiggle the shaft enough to move the encoder, it moves a few more steps
03:09 PM rue_shop3: oh use the profiler
03:09 PM rue_shop3: EncVelProf
03:09 PM rue_shop3: not 2 tho
03:10 PM rue_shop3: enc_pwm_egmk_fixed2 I think just does a few steps and stops
03:10 PM rue_shop3: we want that profile for you
03:13 PM obfuscated_d: I flashed that, same deal? it moves a couple steps then stops. If I move the shaft it will move a few more steps. it's not sending pulses or serial data when it stops moving the motor
03:13 PM rue_shop3: oh
03:13 PM rue_shop3: the encoder might be backwards
03:14 PM rue_shop3: I'm not sure what it would do
03:14 PM rue_shop3: maybe if you swap the motor leads
03:14 PM rue_shop3: same difference
03:14 PM rue_shop3: we dont need to define which rotation is foward
03:14 PM obfuscated_d: I swapped the encoder channels, that worked '=D
03:14 PM rue_shop3: sweet
03:14 PM rue_shop3: its blithering data?
03:15 PM obfuscated_d: it's sending data and pulses regularly, really bad formatting on the minicom though. how did you set yours?
03:16 PM rue_shop3: ctrl-a z for help
03:16 PM rue_shop3: there is an "add linefeed" and "add carriage return" option
03:16 PM obfuscated_d: ah
03:16 PM obfuscated_d: that did it
03:17 PM obfuscated_d:                                                                                                                                   4
03:17 PM obfuscated_d: 00299, 65535, 24584, 65535, 65505
03:17 PM obfuscated_d: 00300, 65535, 60000, 65535, 65512
03:17 PM obfuscated_d: 00301, 65535, 43265, 65535, 65512
03:17 PM obfuscated_d: 00302, 65535, 60000, 65535, 65512
03:17 PM obfuscated_d: 00303, 65535, 41656, 65535, 65512
03:17 PM obfuscated_d: 00304, 65535, 18865, 65535, 65512
03:17 PM obfuscated_d: 00305, 65535, 60000, 65535, 65512
03:17 PM obfuscated_d: 00306, 65535, 60000, 65535, 65512
03:17 PM obfuscated_d: 00307, 65535, 60000, 65535, 65504
03:17 PM obfuscated_d: 00308, 65535, 36102, 65535, 65520
03:17 PM obfuscated_d: 00309, 65535, 60000, 65535, 65520
03:17 PM obfuscated_d: 00310, 65535, 26338, 65535, 65512
03:17 PM obfuscated_d: 00311, 65535, 60000, 65535, 65519
03:17 PM obfuscated_d: 00312, 65535, 38909, 65535, 65513
03:17 PM obfuscated_d: 00313, 65535, 60000, 65535, 65512
03:17 PM obfuscated_d: 00314, 65535, 60000, 65535, 65521
03:17 PM obfuscated_d: 00315, 65535, 24074, 65535, 65520
03:17 PM rue_shop3: yep, if you hit reset and get a capture from the start
03:17 PM rue_shop3: wow, its ...
03:18 PM rue_shop3: what
03:18 PM obfuscated_d: the 65000 seems wrong
03:18 PM rue_shop3: yep
03:18 PM rue_shop3: the first two columns should match
03:18 PM rue_shop3: ...
03:19 PM rue_shop3: Target, Hit, HitSpeed, StopPos, coastPos
03:19 PM rue_shop3: target and hit should be the same
03:19 PM rue_shop3: and the 60000's in hitspeed are an issue..
03:20 PM rue_shop3: maybe its still backwards?
03:20 PM rue_shop3: the initial steps are *tiny*
03:20 PM rue_shop3: but
03:20 PM rue_shop3: it should hit them
03:22 PM obfuscated_d: 00234, 65535, 60000, 65535, 65512
03:22 PM obfuscated_d: 00235, 65535, 60000, 65535, 65503
03:22 PM obfuscated_d: 00236, 65535, 60000, 65535, 65512
03:22 PM obfuscated_d: 00237, 65535, 32547, 65535, 65513
03:22 PM obfuscated_d: Right here I swapped the encoder channels, it only took these other steps, then stopped
03:22 PM obfuscated_d: 00238, 00238, 07075, 00371, 00370
03:22 PM obfuscated_d: 00239, 00239, 05322, 00354, 00352
03:22 PM obfuscated_d: 00240, 00240, 07982, 00354, 00352
03:22 PM obfuscated_d: 00241, 00241, 05315, 00354, 00351
03:22 PM obfuscated_d: 00242, 00242, 05402, 00355, 00353
03:22 PM obfuscated_d: 00243, 00243, 05281, 00354, 00352
03:22 PM obfuscated_d: 00244, 00244, 06165, 00354, 00351
03:23 PM obfuscated_d: I think the decel in the table is too generous
03:23 PM obfuscated_d: and it's not reaching the target
03:23 PM rue_shop3: thats the right direction
03:23 PM rue_shop3: so
03:23 PM rue_shop3: check the while, I thnk you modified it
03:23 PM rue_shop3: while(target < 4000) {
03:23 PM obfuscated_d: If I give it a nudge so the encoder pules again, it takes another step
03:24 PM rue_shop3: interesting
03:24 PM rue_shop3: ^^ do you have that while set to 4000?
03:24 PM rue_shop3: it was hitting those targets tho, that is good
03:24 PM obfuscated_d:   while(target < 4000) {
03:24 PM obfuscated_d:      position = 0;
03:24 PM obfuscated_d:      // turn on forward drive
03:24 PM obfuscated_d:      MotorForward();
03:25 PM rue_shop3: ok
03:25 PM rue_shop3: if the motor runs it should work
03:25 PM rue_shop3: whats your motor driver?
03:25 PM obfuscated_d: L298
03:25 PM rue_shop3: hmm
03:26 PM rue_shop3: did you need to rewrite the macros?
03:26 PM rue_shop3: #define MotorForward() SetBit(2, PORTB) ; SetBit(3, PORTB)
03:26 PM rue_shop3: #define MotorReverse() ClearBit(2, PORTB); SetBit(3, PORTB)
03:26 PM rue_shop3: #define MotorOff() ClearBit(2, PORTB) ; ClearBit(3, PORTB)
03:26 PM rue_shop3:
03:26 PM obfuscated_d: no, they're good
03:26 PM rue_shop3: huh
03:27 PM rue_shop3: hmm
03:27 PM rue_shop3: is your motor running on 5V?
03:28 PM obfuscated_d: 9v. it's a 12v motor
03:28 PM rue_shop3: ok
03:28 PM rue_shop3: so there shouldn't be any issued with the motor resetting or glitching the controller...
03:28 PM rue_shop3: hmm
03:29 PM rue_shop3: does it always stop at about 244?
03:29 PM obfuscated_d: no, it's strange, always takes a different amount of steps
03:29 PM rue_shop3: huh
03:30 PM obfuscated_d: if I nudge the motor in reverse to trigger the encoder pulse, it starts taking more steps
03:30 PM rue_shop3: the only thing it waits for is the encoder count
03:30 PM rue_shop3: I'm worried its a motor issue
03:30 PM rue_shop3: like a dead spot in the motor
03:31 PM rue_shop3: if you put a 1.5V battery on the motor, does it run ok?
03:31 PM rue_shop3: even if you load it a bit?
03:31 PM rue_shop3: (slow drive to test for bad spots in the motor)
03:32 PM obfuscated_d: motor seems to run fine. I tested it out on its own with the driver and a nano driving the l298. When it stops moving, the nano isn't sending commands to the l298
03:32 PM rue_shop3: hmmm
03:33 PM rue_shop3: MotorForward();
03:33 PM rue_shop3: // at target line count switch to reverse direction
03:33 PM rue_shop3: t = position;
03:33 PM rue_shop3: while( t < target) { flag = 0; while(!flag); cli(); t = position; sei(); }
03:33 PM rue_shop3: targetHit = t;
03:33 PM rue_shop3: targetSpeed = moveTicks;
03:33 PM rue_shop3: MotorReverse();
03:33 PM rue_shop3:
03:33 PM rue_shop3:
03:33 PM rue_shop3: // monitor direction, as soon as it reverses, cut power
03:33 PM rue_shop3: while(direction != -1);
03:33 PM rue_shop3: MotorOff();
03:33 PM rue_shop3: is reverse actually reversing?
03:33 PM rue_shop3: hmm, idea tell me how you have the L298 wired
03:33 PM rue_shop3: or module or whatever
03:34 PM rue_shop3: I had to use an inverter on the L293
03:35 PM rue_shop3: I need to go make some lunch, back in a bit
03:36 PM obfuscated_d: it's one of the generic motor driver modules off amazon. works well. had power in, motor out and the pwm pins
03:40 PM obfuscated_d: I need to go feel and walk the dog, I'll be back in a bit as well
03:40 PM obfuscated_d: feed*
03:41 PM rue_shop3: obfuscated_d, ok, fire me a link for that module when your back and we can check the setup
03:41 PM rue_shop3: rif_shed, hi
03:42 PM rue_shop3: rif_shed, tell me about the biggest stepper motor you have ever had the chance to play with
03:45 PM obfuscated_d: https://www.amazon.com/HiLetgo-Controller-Stepper-H-Bridge-Mega2560/dp/B07BK1QL5T/ref=sr_1_1?keywords=l298n&qid=1708206273&sr=8-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1
03:46 PM obfuscated_d: my suspicion is something to do with the encoder
03:46 PM obfuscated_d: I'll check it out when I get back
03:46 PM rue_shop3: finish up the walk
03:46 PM rue_shop3: I think there is a wiring thing, I need to check
03:46 PM rue_shop3: I think I have one of those moules
03:46 PM rif_shed: hi rue, I have only used upto nema34
03:48 PM rif_shed: am liking the new nema23 closed loop steppers, getting much faster speeds
03:48 PM rue_shop3: :)
03:48 PM rif_shed: and no extra driver to worry about
03:48 PM rue_shop3: so
03:48 PM rue_shop3: obfuscated_d, is helping me develop EGMK
03:48 PM rif_shed: i see, this stands for?
03:49 PM rue_shop3: EGMK is a new control method for dc motors thats name is much cooler than PID
03:49 PM rue_shop3: Educated Guess Motor Kicking
03:49 PM rue_shop3: its targeted at turning DC motors into stepper motors
03:49 PM rue_shop3: and its faster with less lag than a normal servo loop
03:50 PM rue_shop3: obfuscated_d, I do have one of those motors, tell be how you have it hooked p
03:50 PM rue_shop3: rif_shed, I'm making 1HP "stepper motors" with it
03:50 PM rue_shop3: for my 4 foot by 8 foot cnc
03:50 PM rue_shop3: (router 0.1mm resolution)
03:50 PM rue_shop3: (wood)
03:51 PM rif_shed: ok, i found the nema34 pretty good for that size router
03:51 PM rue_shop3: ?
03:52 PM rue_shop3: 34 is ... mm?
03:52 PM rif_shed: 3.4" i think
03:52 PM rue_shop1: 56mm?
03:52 PM rif_shed: 86mm
03:52 PM rue_shop1: k
03:53 PM rue_shop3: what are they generally worth?
03:53 PM rue_shop3: oh! lunch!
03:53 PM rif_shed: mine about $150 AUD delivered, includes inbtegrated driver so pretty good value
03:54 PM rif_shed: thats nema23 though, the 34 are higher
03:57 PM rif_shed: https://www.aliexpress.com/item/32945229209.html
03:59 PM rue_mohr: http://ruemohr.org/~ircjunk/projects/cnc6/p1200136.jpg
04:00 PM rue_mohr: yea $90 CAD
04:00 PM rue_mohr: those are beasts allright
04:01 PM rue_mohr: I'd be up to almost $500 with shipping for 3
04:01 PM rif_shed: yep they can run at pretty high frequency as well with decent torque
04:01 PM rue_mohr: yep
04:01 PM rif_shed: your frame looks interesting, what is the machine to be used for making?
04:02 PM rue_mohr: $500 is way overbudget for my project, but it would be ncie to get it done
04:03 PM rif_shed: the extra money is sometimes worth the saved time, am running out of time
04:04 PM rif_shed: wish i could upload a video, need to get new usb cable
04:05 PM rue_mohr: yea I cant make any money back on it
04:05 PM rue_mohr: I gotta get with my robot body
04:06 PM rue_mohr: what are you gonna do?
04:07 PM rif_shed: well i need a part for a pen that needed a 4th axis, so made a machine to make the part
04:07 PM rue_mohr: yup
04:07 PM rif_shed: and while making it designed it to make pens, and also been making tops
04:07 PM rue_mohr: but I meant about getting old and dieing
04:08 PM rif_shed: try and get as many things done defore that happens, the years just fly by now
04:08 PM rue_mohr: yes, so, your not gonna try to platform hop?
04:08 PM rif_shed: if only
04:09 PM rue_mohr: hah, c- for attitude
04:09 PM rue_mohr: its gonna be a freaking tight fit, but I'm sure I can do it
04:10 PM rue_mohr: but a process like jumping thru spinning fanblades and having nothing mroe than fate to hope you aren't destroyed in the process
04:10 PM rif_shed: ok found a working cable, first youtube for 9 yearsup
04:10 PM rue_mohr: heh
04:10 PM rue_mohr: they didn't cancel your account?
04:11 PM rue_mohr: hey I been following your website as it moves around
04:11 PM rif_shed: yep website will be up again soon as i make somethink
04:11 PM rif_shed: there is nothing there now
04:12 PM rue_mohr: it was hidden in a directory ...
04:12 PM rue_mohr: on a website
04:12 PM rue_mohr: oh I cant find it now
04:12 PM rif_shed: oh cool, have backups here but all a bit ancient now
04:14 PM rue_mohr: search for a unique phrase from soemthing
04:14 PM rue_mohr: it used to turn up
04:14 PM rue_mohr: I used to be able to find it by searching for rue_mohr on google, but thats just a dogpile now
04:14 PM rue_mohr: I come up a lot
04:15 PM rue_mohr: darn near 8k twitter followers, for what thats worth (about 15c I think)
04:15 PM rue_mohr: more than the 100 I expected
04:15 PM rif_shed: yep i found yours the other day thanks to google
04:15 PM rif_shed: good to see you are still active creating things
04:16 PM rue_mohr: if I'm gonna survive being a bio I have to run like hell
04:16 PM rue_mohr: there is a lot of great tech and foundation work going on
04:17 PM rue_mohr: I need to take an EEG and start mixing it with stable diffusion posture detection to train an AI on the translations
04:17 PM rue_mohr: ^^ +cameras
04:18 PM rue_mohr: vrchat could be a great proofing ground
04:18 PM rue_mohr: I work at a hospital now
04:18 PM rue_mohr: I need to see if I can gather up probes
04:18 PM rue_mohr: electrodes, whatever
04:19 PM rue_mohr: opps, disaster, I'm out of milk
04:20 PM rue_mohr: YOU didn't just write me off as a loon just there did you?
04:20 PM rue_mohr: rif_shed, ?
04:20 PM obfuscated_d: i'm back rue_mohr. I played with this a bit more. made new dupont connectors for the pins to the driver. This would be pretty simple with an oscilloscope., but, I can tell with my multimeter, that the nano isn't commanding the driver to move when the motor stops stepping. if I bump the encoder ever so slightly, it starts stepping again
04:21 PM rue_mohr: obfuscated_d, np
04:21 PM rue_mohr: tell me how you have it wired, I have one of those modules
04:22 PM rif_shed: rue_mohr no sir, i did not
04:23 PM obfuscated_d: 9v in to Vin, gnd to gnd, 5v from driver to nano, motor on motorA + and -, PD2 int1 PB3 int2
04:23 PM obfuscated_d: 5v and gnd to nano*
04:23 PM rue_shop3: just the motor driver
04:23 PM rue_shop3: the pins are called
04:24 PM obfuscated_d: int1 and int2 are the pwm inputs on mine
04:24 PM rue_shop3: ENA IN1 IN2 IN3 IN4 ENB
04:24 PM obfuscated_d: yup
04:24 PM rue_shop3: which did you hook to who?
04:24 PM obfuscated_d: in1 to PB2 in2 PB3
04:24 PM rue_shop3: ENA?
04:25 PM obfuscated_d: has the jumper on
04:25 PM rue_shop3: ok
04:25 PM rue_shop3: we need to adjust
04:25 PM rue_shop3: #define MotorForward() SetBit(2, PORTB) ; ClearBit(3, PORTB)
04:25 PM rue_shop3: #define MotorReverse() ClearBit(2, PORTB); SetBit(3, PORTB)
04:25 PM rue_shop3: #define MotorOff() ClearBit(2, PORTB) ; ClearBit(3, PORTB)
04:26 PM rue_shop3: that should fix it
04:26 PM rue_shop3: and your coasting should be less of an issue, beause your off is a brake, mine is a coast
04:30 PM rue_shop3: it would have been nice if the L298 had made either IN1 or IN2 inverted
04:30 PM rue_shop3: rif_shed, you still talkin to me?
04:31 PM obfuscated_d: rue_mohr still the same thing
04:31 PM rue_shop3: ?
04:31 PM rue_shop3: could you confirm that the forward and reverse macos are working right?
04:31 PM rif_shed: yes i am, but trying to upload a vid so i can show ya something, got family lunch on today so not here for too long
04:32 PM rue_shop3: like if you call one of them and then do a while(1);
04:32 PM rue_shop3: rif_shed, ah
04:32 PM rue_shop3: rif_shed, have you heard from bear at all since?
04:34 PM rif_shed: rue, not again nope
04:34 PM rue_shop3: worried about him, forcast didn't look too good
04:35 PM rue_shop3: rif_shed, any work on foxy?
04:36 PM rif_shed: i guess every tool i make has the ultimate purpose of being able to complete her rue
04:36 PM rue_shop3: oh good
04:36 PM rue_shop3: maybe you can move into her when you need to
04:36 PM obfuscated_d: rue_shop1 motorReverse isn't working!?
04:36 PM rue_shop3: yea ok
04:37 PM rue_shop3: thats what I thoguht
04:37 PM rue_shop3: you changed that one macro right?
04:37 PM obfuscated_d: yea
04:37 PM rue_shop3: hehe, so...
04:37 PM rue_shop3: did you use setbit/clearbit or...
04:37 PM rue_shop3: uh..
04:37 PM obfuscated_d:  #define MotorForward() SetBit(2, PORTB) ; ClearBit(3, PORTB)
04:37 PM obfuscated_d:  #define MotorReverse() ClearBit(2, PORTB); SetBit(3, PORTB)
04:37 PM obfuscated_d:  #define MotorOff() ClearBit(2, PORTB) ; ClearBit(3, PORTB)
04:38 PM rue_shop3: should be right
04:38 PM obfuscated_d: looks correct to me
04:38 PM obfuscated_d: one pin high, one low
04:38 PM rue_shop3: yup
04:38 PM rue_shop3: driver issue?
04:38 PM rue_shop3: is it getting IN1 and IN2 different levels?
04:39 PM obfuscated_d: on my jeezlus, I'm an idiot
04:39 PM rue_shop3: no, cause you found the issue
04:39 PM obfuscated_d: wrong pin on the nano
04:39 PM Tom_L: rif_shed, what are you using for a cnc control?
04:39 PM rue_shop3: rif_shed, if its GRBL, just lie
04:40 PM Tom_L: nobody asked you sir !
04:40 PM * rue_shop3 stays quiet
04:40 PM rif_shed: https://www.youtube.com/shorts/mJZk1MMsL98
04:40 PM rif_shed: sorry but the sound
04:41 PM rue_shop3: nice
04:41 PM Tom_L: and what about the cad cam to do that
04:42 PM rue_shop3: I should build an A axis
04:42 PM rif_shed: dxf to y axis mapped to a axis and then massaged
04:42 PM * rue_shop3 nods
04:42 PM Tom_L: grbl?
04:43 PM * rue_shop3 dont say it rif... lie!
04:43 PM * rue_shop3 signs 'dont say mach either!!'
04:43 PM rif_shed: my controller is a new thing
04:43 PM Tom_L: i doubt it would do rotary anyway
04:45 PM rue_shop3: obfuscated_d, meet rifraf ( rif_shed ) by the way, a builder from the land down under
04:45 PM obfuscated_d: Howdy!
04:45 PM rue_shop3: obfuscated_d, and Tom, who is a builder in the states
04:45 PM rif_shed: g'day obfuscated_d, nice to meet ya
04:45 PM rue_shop3: obfuscated_d, polprog is a programmer in poland
04:45 PM obfuscated_d: I'm in good old West Virginia
04:46 PM rue_shop3: WormFood, is of interesting background too
04:46 PM rue_shop3: Tom_L, rif_shed WormFood polprog aandrew are all 'from irc'
04:47 PM rue_shop3: obfuscated_d, here is in from twitter
04:47 PM Tom_L: i used nema23 on mine but they're 570in/oz
04:47 PM obfuscated_d: I just started doing the whole "social media" thing
04:47 PM rue_shop3: were you doing any chat or stuff before?
04:47 PM obfuscated_d: nah
04:48 PM rue_shop3: irc is a fraction of what it used to be
04:48 PM obfuscated_d: just playing in my shop alone. I have a small group of friends locally I talk with daily about projects, and anything else really
04:48 PM rue_shop3: but suffers from what whole "there are an infinite number of servers and channels, good luck finding anyone"
04:48 PM rue_shop3: locals are awesome
04:48 PM rue_shop3: I have one buddy who can kinda understand me
04:49 PM rue_shop3: nickname moon, but he uses random names
04:49 PM rue_shop3: and he can only stand to look at his computer screen about 15 mins at a time
04:50 PM obfuscated_d: yea, that's where I'm at. I have one friend who does software that has similar interests (programming, machining, electronics). but I wanted to meet some more people
04:50 PM rue_shop3: yup,
04:50 PM rue_shop3: you did good, I been trying to find people for about 24 years now
04:50 PM rue_shop3: check out the people I'm following on twitter
04:50 PM rue_shop3: MOST of them are interesting makers
04:50 PM rue_shop3: there is some noise
04:51 PM obfuscated_d: yea, I started following a few that you shared posts from. it was a welcome sight, I felt like I wouldn't find any makers
04:51 PM rue_shop3: and If I followed someone with like 12 followers and found their content not really awesome, I rarely have the heart to unfollow them
04:51 PM obfuscated_d: haha, that's me
04:52 PM rue_shop3: its a problem if 90 or the 100 people your following are all japaneese
04:52 PM rue_shop3: twitters translate isn't workin awesome lateley
04:52 PM obfuscated_d: they have some of the funniest posts though
04:52 PM rue_shop3: p.s. sorry, I type with a mashing process that leaves behind a lot of spelling issues I dont bother to correct
04:53 PM obfuscated_d: no worries, I can understand what you mean
04:53 PM rue_shop3: ok, so hows the motor operation going?
04:53 PM obfuscated_d: letting it run to get some data
04:53 PM obfuscated_d: it's going good
04:53 PM rue_shop3: ah cool
04:53 PM rue_shop3: did you reset it to catch from 2?
04:53 PM obfuscated_d: yea
04:53 PM rue_shop3: sweet
04:54 PM obfuscated_d: i'm at line 785 so fat
04:54 PM obfuscated_d: far
04:54 PM rue_shop3: yea, its slow
04:54 PM rue_shop3: but the data is pretty good
04:54 PM rue_shop3: hows the uncertainty and variation really well
04:54 PM rue_shop3: did you notice the maketable source code?
04:55 PM obfuscated_d: didn't see that
04:55 PM rue_shop3: it uses one of my linear interpolator libraries so you can give it some points and it'll fill in the intermediate values
04:55 PM rue_shop3: must have been how to developed the current tables
04:57 PM rue_shop3: so I'm going to assume an interrupt wont be interrupted while its changing the position variable
04:57 PM rue_shop3: or if it does, the error wont matter
04:57 PM rue_shop3: but its a note
05:01 PM obfuscated_d: how many lines you think is good?
05:02 PM obfuscated_d: seems like it gets to full speed in a few ticks, so I probably don't need data up to 1500 lines
05:03 PM rue_shop3: the chart doesn't saturate as fast as you would tink
05:03 PM rue_shop3: 1500 sounds good tho
05:04 PM rue_shop3: its a healthy pile of datapoints
05:04 PM rue_shop3: https://paste.debian.net/1307663/
05:04 PM rue_shop3: this is my framework so far for the redo
05:06 PM rue_shop3: the if(0) is taken out by the compiler, and normalizes the rest of the if statements
05:07 PM rue_shop3: there needs to be all sorts of direction sensitive code going on
05:08 PM obfuscated_d: right, I feel like that's the tricky part
05:08 PM rif_shed: this internet is worse than dial up today, cannot upload a simple noisy video
05:08 PM rue_shop3: we should be able to break it down one scenario at a time
05:09 PM rue_shop3: rif_shed, still asdl up there?
05:09 PM rue_shop3: adsl
05:09 PM rue_shop3: dsl?
05:09 PM rif_shed: yeah, we have this NBN thing
05:09 PM rue_shop3: ooo not heard of that one
05:10 PM rif_shed: cannot even upload to imgur
05:10 PM rue_shop3: No Body is Networking ?
05:10 PM rue_shop3: No Bloody Network ?
05:10 PM rif_shed: national broadband network, was outdated before it was completed
05:10 PM rue_shop3: mhm
05:11 PM rue_shop3: obfuscated_d, ok, lets restart while you data collects a few times
05:11 PM rue_shop3: were stopped
05:12 PM rue_shop3: a step comes in and position goes to -144
05:12 PM rue_shop3: so we need to drive the motor forward
05:12 PM rue_shop3: because:
05:12 PM rue_shop3: to close the error we have to move forward
05:13 PM rue_shop3: and the forward motion + the expected stopping distance is ----- --- the target
05:13 PM rif_shed: same machine as before but before the knurling https://www.youtube.com/watch?v=gytoimzLKHc
05:14 PM rue_shop3: what... did you use A axis as a lathe!? with a cutter on the head?
05:14 PM rue_shop3: hah
05:15 PM rif_shed: yep
05:15 PM rue_shop3: I see, that is awesome
05:15 PM rif_shed: yeah am loving it
05:15 PM rue_shop3: did you see the video of me putting the material in the chuck?
05:15 PM rif_shed: nope
05:16 PM rue_shop3: https://www.youtube.com/watch?v=G2HqOZ1vws0
05:16 PM rue_shop3: oh no, wrong one
05:16 PM rue_shop3: thats bending a spring
05:16 PM rue_shop3: https://www.youtube.com/watch?v=7jBCo70l1A4
05:16 PM rue_shop3: this one
05:16 PM rue_shop3: I had to make a step in a bunch of short pins
05:17 PM rif_shed: saw the spring bending, pretty cool
05:17 PM rue_shop3: tom was the champion of that
05:18 PM rue_shop3: obfuscated_d, The forward motion + the expected stopping distance is ----- --- the target
05:18 PM rif_shed: ah yes i did see that one
05:18 PM rif_shed: is cool
05:18 PM rif_shed: ok i must run, but here is something you don't see every day
05:18 PM rif_shed: https://imgur.com/a/8dyLvYe
05:18 PM rue_shop3: but the bit mounting was not great, it kept shifting on me
05:19 PM rif_shed: have lost the video, but this top does it often so will recreate
05:19 PM rue_shop3: huh
05:19 PM rue_shop3: no magnets?
05:19 PM rif_shed: no trickert at all, well balanced
05:19 PM rue_shop3: obfuscated_d, The forward motion + the expected stopping distance is ----- --- the target
05:19 PM rif_shed: could not believe it the first time
05:20 PM obfuscated_d: sorry, distracted. is this a fill in the blank ? haha
05:20 PM obfuscated_d: pets are needy tonight
05:20 PM rue_shop3: obfuscated_d, Motor on forward if position + expected stopping distance is short of 0
05:20 PM rue_shop3: obfuscated_d, no worreis
05:21 PM rue_shop3: obfuscated_d, Motor on forward: if (position + expected stopping distance is short of 0)
05:22 PM rue_shop3: obfuscated_d, Motor on forward: if ((position < 0) && ((position + table[velocity]) < 0))
05:32 PM rue_shop3: now, lets say the motor is running at a high speed in reverse and we need to stop
05:32 PM rue_shop3: which is the other reason to turn it on forward
05:32 PM obfuscated_d: so we'll always know, what the current velocity is right
05:32 PM rue_shop3: yes, thats moveTicks
05:32 PM rue_shop3: its a stranage inverse value, but if you just go with it, its ok
05:32 PM rue_shop3: if the direction is negative and the stopping distance is > 0 (were gonna miss) then turn the motor on forward
05:32 PM rue_shop3: so turning the motor off will end up being velocty based?
05:33 PM rue_shop3: yours might not be much, but I dont mind using one table for initial testing
05:34 PM rue_shop3: lets just go with 1 table for now
05:34 PM rue_shop3: reverse can go suck a lemon
05:34 PM obfuscated_d: haha
05:34 PM rue_shop3: having two tables will just be a performance improvement
05:34 PM rue_shop3: it might not even make a difference in a lot of cases
05:34 PM obfuscated_d: we can keep both, it won't change the code (that much)
05:35 PM rue_shop3: yea, easier to oust it for now
05:35 PM rue_shop3: https://paste.debian.net/1307665/
05:35 PM obfuscated_d: I'm thinking of a scenario like a z axis leadscrew. where forward might be wayyy less decel needed than reverse
05:36 PM rue_shop3: yup
05:36 PM rue_shop3: its totally true
05:36 PM rue_shop3: but we can work into that
05:38 PM rue_shop3: you know
05:38 PM rue_shop3: we could kinda summarize this as
05:39 PM rue_shop3: "accelerate forward", "accelerate reverse", "decelerate forward", "decelerate reverse" and "powerdown"
05:39 PM obfuscated_d: I feel like the moment to decide when to stop, and when to reverse, might be a tune thing
05:39 PM obfuscated_d: per motor
05:39 PM rue_shop3: it should be definined by the stopping distance table
05:39 PM rue_shop3: we dont want it to accelerate to try to correct and error under the minimum stopping distance
05:39 PM rue_shop3: or it'll miss
05:40 PM rue_shop3: there is another alg we can use for tiny amounts of error like that
05:40 PM rue_shop3: (later)
05:40 PM obfuscated_d: could just be  a P controller
05:40 PM rue_shop3: I got better
05:41 PM rue_shop3: ;)
05:41 PM rue_shop3: timed pulses with known correction values
05:41 PM rue_shop3: (later later)
05:42 PM rue_shop3: enum drivestatus AF, AR, DF, DR, PD
05:42 PM rue_shop3: ?
05:42 PM obfuscated_d: sounds like it
05:42 PM rue_shop3: because then its just 5 questions
05:43 PM rue_shop3: - when do we accelerate forward...
05:43 PM obfuscated_d: we have - error
05:43 PM rue_shop3: or more than
05:44 PM rue_shop3: if () driveStatus = AF;
05:44 PM obfuscated_d: then we check the LUT, calculate the error
05:45 PM obfuscated_d: if error is still approaching 0 (no new steps) continue with the checking on stopping distance
05:46 PM obfuscated_d: at some point, we start to decel
05:46 PM rue_shop3: https://paste.debian.net/1307668/
05:47 PM rue_shop3: I am only reprocessing if the has been a change in position
05:47 PM rue_shop3: which would be either from the encoder or the control inputs
05:47 PM rue_shop3: (via flag)
05:48 PM rue_shop3: if the error is approaching 0
05:49 PM rue_shop3: if dir < 0 && error > 0
05:49 PM rue_shop3: ?
05:49 PM rue_shop3: if (dir < 0) && (error > 0)
05:49 PM rue_shop3: but
05:49 PM obfuscated_d: so do we have a prev error and current error?
05:49 PM rue_shop3: no, the encoder tracks the direction and velocity
05:49 PM rue_shop3: every line is sees, it updates
05:50 PM rue_shop3: we need a posisition+stopping_distance[speed] <=> 0
05:51 PM rue_shop3: } else if ( ) { driveStatus = AF;
05:52 PM rue_shop3: } else if ( position+VLUT[speed] < 0 ) { driveStatus = AF;
05:52 PM rue_shop3: the direction and error are kinda integrated into that
05:52 PM rue_shop3: by only having one variable we are trying to zero, the math gets easier
05:52 PM rue_shop3: the position IS the error
05:53 PM rue_shop3: the encoder and the control input both work that same value
05:54 PM rue_shop3: its nice beacsue its auto doing the math, but also because you dont have to worry about dealing with rollover
05:54 PM rue_shop3: +-32k would be an insane amount of accumulated error
05:54 PM rue_shop3: it should only ever be 1 step max, otherwise your trying to accelerate too fast
05:55 PM obfuscated_d: that high would mean we're commanding steps way faster than the motor can handle
05:55 PM rue_shop3: yea!
05:55 PM rue_shop3: we could put a light on it for that :0
05:55 PM rue_shop3: "slow down ****er" light
05:55 PM rue_shop3: hehe
05:56 PM obfuscated_d: "idiot light"  I think is the technical term
05:56 PM rue_shop3: :] sure.
05:56 PM obfuscated_d: not all the jokes can be winners ..... haha
05:56 PM rue_shop3: :]
05:56 PM rue_shop3: break for a bit?
05:57 PM rue_shop3: if I'm gonna be up all night, I need milk for tea
05:57 PM rue_shop3: I cant drink 8L of tea with no milk
05:57 PM obfuscated_d: sounds good. I'm getting foggy. Was doing interview prep all day. I'm so tired of data structured right now
05:57 PM obfuscated_d: structures*
05:57 PM rue_shop3: https://paste.debian.net/1307670/
05:58 PM rue_shop3: that is wehre I'm at
05:59 PM rue_shop3: but there is something missing I think
05:59 PM rue_shop3: it should account for the min correction distance
06:08 PM obfuscated_d: can't we just tack that on there? if ( position+VLUT[speed]  - minCorrectionDistance < 0 )
06:09 PM obfuscated_d: +
06:37 PM rue_shop3: obfuscated_d, yes
06:38 PM rue_shop3: I think
06:51 PM obfuscated_d: so we're here about
06:51 PM obfuscated_d:  enum DriveStatus {AF, AR, DF, DR, PD} DriveDirection;
06:51 PM obfuscated_d:     error = position + VLUT[speed] + minCorrectionDistance;
06:51 PM obfuscated_d:     if (error < 0) {
06:51 PM obfuscated_d:         if(error < -500){
06:51 PM obfuscated_d:         //error out of range
06:51 PM obfuscated_d:         break;
06:51 PM obfuscated_d:      }
06:51 PM obfuscated_d:       DriveDirection = AF;
06:51 PM obfuscated_d:     } else if (error > 0) {
06:51 PM obfuscated_d:       DriveDirection = AR;
06:51 PM obfuscated_d:     } else if( error == 0) {
06:51 PM obfuscated_d:         DriveDirection = PD;
06:51 PM obfuscated_d:     }
06:51 PM obfuscated_d:     else if(){
06:51 PM obfuscated_d:     }
06:51 PM obfuscated_d:     switch (DriveDirection) {
06:51 PM obfuscated_d:       case AF:
06:55 PM obfuscated_d: don't know if it's worth checking == 0
07:09 PM rue_mohr: we could make sure the drive is off if the error is zero :]
07:09 PM rue_mohr: ok I got milk
07:09 PM rue_mohr: need to check the mailbox...
07:20 PM rue_mohr: nothing (some bills and stuff, I'll leave them in there till something arrives from aliexpress)
07:20 PM rue_mohr: obfuscated_d, how close is it to a few data sets over there?
07:22 PM obfuscated_d: I have 2, I got distracted with trying to get code to run so the nano got occupied
07:24 PM rue_mohr: 2 data sets is good, can I see?
07:24 PM rue_mohr: I'v only treid with my main motor so far
07:25 PM obfuscated_d: https://paste.debian.net/1307673
07:25 PM obfuscated_d: here's one
07:25 PM obfuscated_d: I think I overwrote the second :/
07:25 PM obfuscated_d: first
07:26 PM rue_mohr: ok, I'll play with this
07:26 PM rue_mohr: I want to see how it compares to mine
07:28 PM rue_mohr: wow
07:29 PM rue_mohr: oh odd
07:30 PM rue_mohr: your velocity is much lower than mine granted, arbitrary units
07:30 PM rue_mohr: but your stopping distances are way way shorter
07:32 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/foo.png
07:33 PM rue_mohr: but see how the speed hadn't really quite leveled off?
07:35 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/foo.png (edit)
07:35 PM rue_mohr: so, one of the lines, left or right, is what we want to make a table of
07:35 PM rue_mohr: *but*
07:36 PM rue_mohr: the code should divide the velocity down a bit to make sure it stays in 8 bits
07:36 PM rue_mohr: we could cut yours off at 30000
07:36 PM rue_mohr: if we divide it by 128
07:37 PM rue_mohr: so
07:37 PM rue_mohr: shift it by 7 bits
07:37 PM obfuscated_d: ticks >> 7
07:37 PM rue_mohr: yup
07:37 PM rue_mohr: then it'll fit in a 8 bit table
07:37 PM rue_mohr: now
07:37 PM rue_mohr: I'm not good about which line to follow
07:38 PM rue_mohr: we want to be pessimistic
07:38 PM rue_mohr: use the longer stopping distance
07:38 PM rue_mohr: which is..
07:38 PM rue_mohr: the top line
07:39 PM rue_mohr: if you pick some points on it...
07:40 PM obfuscated_d: yea
07:40 PM rue_mohr: maketable does the division
07:40 PM rue_mohr: but its only set to 8 and not the easy way
07:41 PM obfuscated_d: I could write a python script to make the table :) it's easier
07:41 PM rue_mohr: if you like sure
07:41 PM rue_mohr: but
07:41 PM rue_mohr: mine interpolates
07:42 PM obfuscated_d: yea, I think I can handle that
07:43 PM rue_mohr: ok, lets both try and see how close we are
07:47 PM rue_mohr: I'm jellous of your stop distances
07:49 PM obfuscated_d: haha, it's a little motor
07:50 PM obfuscated_d: so I'm a little unclear about the table layout, is each index the speed >> 3 , and the value at that index is the number of steps?
07:51 PM obfuscated_d: or ticks rather, not steps
07:51 PM obfuscated_d: or no, steps
07:53 PM rue_mohr: d = i[k] where k is the veloctiy (ticks >> 7) and d is the distance is went past the target before it stopped
07:53 PM rue_mohr: which is Y on that graph
07:53 PM rue_mohr: thats why i use the interpolator, I take points off that top line and let it do the linearinterpolation between 0-255
07:53 PM rue_mohr: ?
07:54 PM rue_mohr: the idea is to look up, for the current speed, what the stopping distance is expected to be
07:54 PM rue_mohr: if we take the top line were pessimistic and should never stop "long"
07:55 PM rue_mohr: but if were stopping short we can flip into coast mode and kinda stretch out the stop
07:55 PM rue_mohr: your coast mode is a brake, but that doesn't matter cause we know how long it takes
07:56 PM rue_mohr: oh my, no, thats not right
07:56 PM rue_mohr: (my results)
07:56 PM rue_mohr: aha
07:56 PM rue_mohr: uint8_t VLUT[256] = {
07:56 PM rue_mohr: 064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,064,055,053,051,049,047,046,044,043,041,040,039,037,036,035,033,032,031,030,030,029,028,027,027,026,025,025,024,024,023,023,022,022,021,021,020,020,019,018,018,017,017,017,016,016,016,015,015,014,014,014,013,013,012,012,012,011,011,011,011,011,011,010,
07:56 PM rue_mohr: 010,010,010,010,010,009,009,009,009,009,009,008,008,008,008,008,008,007,007,007,007,007,007,007,007,007,007,007,006,006,006,006,006,006,006,006,006,006,006,006,005,005,005,005,005,005,005,005,005,005,005,005,004,004,004,004,004,004,004,004,004,004,004,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,003,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,
07:56 PM rue_mohr: 002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,002,};
07:57 PM rue_mohr: I'll try to see how well it fits
08:06 PM obfuscated_d: I think I need to call it a night
08:06 PM rue_mohr: heh
08:06 PM rue_mohr: have a good one
08:06 PM rue_mohr: I'll do what I can in the meantime
08:06 PM rue_mohr: I'd like it if I could chart these and verify them easier
08:07 PM obfuscated_d: thanks man. I'll be sharper tomorrow, been at the computer 12hrs today
08:07 PM rue_mohr: no worries
08:07 PM rue_mohr: its been great to have someone to work with
08:21 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/foof.png
08:21 PM rue_mohr: I think thats a not so bad fit
08:21 PM rue_mohr: for an 8 bit table
09:03 PM rue_mohr: https://github.com/fdcl-gwu/aruco-markers
09:03 PM rue_mohr: for me later
09:42 PM rue_shop3: obfuscated_d, I just lost that code you posted me
09:42 PM rue_shop3: how did you send me that?
09:42 PM rue_shop3: did I just imagine it?
10:16 PM rue_shop3: no, you did the enum
10:16 PM rue_shop3: how did you send me that
11:01 PM rue_mohr: https://infosec.exchange/@RueNahcMohr/111950717629991168
11:01 PM rue_mohr: Tom_L, will it play?
11:40 PM rue_shop3: obfuscated_d, I'm just starting again with my other motor
11:41 PM rue_shop3: its a gearmotor
11:45 PM rue_shop3: obfuscated_d, do you think I should edit the profiler to output the data with the math? like do the subtract to actually list the stopping and post-coasting distance?