#garfield Logs

Feb 20 2024

#garfield Calendar

06:05 AM polprog: WormFood: what was it? there are a few ways windows 10 can fuck itself up
08:55 AM rue_mohr: no, linux
08:56 AM rue_mohr: I probably could have sat down and fixed it, but probably would have ended up with the same
08:59 AM rue_mohr: but grrr, the UI it ended up with is horrid tho
09:01 AM aandrew: yeah I have a win10 computer for work I refuse to touch, it sits on a shelf and I RDP into it whenever I need it, which is about once a month or whenever it reboots itself for some shit update I didn't need and then RDP won't let me log in until it's done once locally
09:01 AM aandrew: I'm not supposed to use my personal computer but fuck that, they give me the cheapest corporate laptop (admittedly decent horsepower) then say don't use my stuff. whatever
09:02 AM rue_mohr: heh
09:11 AM rue_mohr: obfuscated_d, I'm just working out how this would go, so carry on, I didn't get anywhere useful !
09:14 AM rue_mohr: keep tabs on the serial prints, they take a long time :] (0.2ms/character)
09:17 AM rue_mohr: eventually error should handle direction...
09:18 AM rue_mohr: dont forget to trim i down to 8 bits
09:34 AM rue_mohr: heh, this is a tricky mess...
09:36 AM rue_mohr: I'm going to try to do the machine like its in an event loop
10:06 AM rue_mohr: it feels like the state machine is working out, at each step in the process you can work out the conditions to go to the next part of the process
10:21 AM rue_mohr: ah careful, moveticks is unsigned.
10:47 AM rue_mohr: while(!flag ); flag = 0; <-- I'm going to change to that so that if a flag occurs during the other code, its not cleared again on the chck
10:49 AM rue_mohr: https://paste.debian.net/1307965/
10:49 AM rue_mohr: tahts were I'm at so far
10:49 AM rue_mohr: still working things out
10:50 AM rue_mohr: its a lot of evolving :]
10:51 AM obfuscated_d: mornin!
10:51 AM rue_mohr: hi
10:52 AM obfuscated_d: yeah, the code I pasted last night was... messy
10:52 AM rue_mohr: no worries, its all getting figured out
10:52 AM rue_mohr: I'm feeling good about this state machine thing
10:52 AM rue_mohr: I set it up like an event handler loop
10:52 AM rue_mohr: / state machine
10:52 AM rue_mohr: lots of the states roll into each other tho
10:53 AM rue_mohr: but the context is helping (me, anyhow)
10:53 AM obfuscated_d: yea, I feel like we're getting closer
10:53 AM rue_mohr: so
10:54 AM rue_mohr: before I do a syntax check :] , I'm thinking that the step control pulse should have a seperate flag to reset the state machine
10:54 AM rue_mohr: but
10:54 AM rue_mohr: if its decellerating to a position thats already good, it'd mess up
10:55 AM rue_mohr: ... maybe
10:55 AM rue_mohr: oh, if I cache the drive signal it would be ok
10:56 AM obfuscated_d: in my hackery I sent, it's not super intuitive but the basic idea behind what I had going on there was
10:56 AM obfuscated_d: we enter the loop, we have error, we accel to the decel point, decel is called, motor is put in full reverse, when we reach ~ the stop point, it coasts and re enters the main loop, there's still error, it calls accel, the error is too small to accelerate so it calls decel, decels pulses reverse again.. does that make sense? it sort of bumps itself
10:56 AM obfuscated_d: to a stop. I don't think my code there is completely correct, but that's the idea I had in the moment I wrote that
10:57 AM rue_mohr: that sounds right, the problem when it was just an if block was, that for some reason, it seems to need context
10:58 AM rue_mohr: when I was doing out the state machine it got strange
10:58 AM rue_mohr: I was just going to have accel and decel
10:59 AM rue_mohr: but it turned into: check if we should accel or not, start accel, wait for accel to be 'done' , decel for 'forward', decel for 'reverse', and 'done'
10:59 AM obfuscated_d: that's pretty much what I arrived at
11:00 AM obfuscated_d: I tried to get DRY with it and pass a direction to acel and decel, totally had the signs wrong though haha
11:01 AM rue_mohr: yea, all the directions and signs mess me up
11:02 AM obfuscated_d: I'm making the mistake of trying to simplify the logic, before the logic is even worked out
11:04 AM obfuscated_d: I like what you have going on so far
11:05 AM rue_mohr: so, Incase the state machine 'falls thru' and changes the motor drive signal a few times on the way, I just changed it to a variable
11:05 AM rue_mohr: and update the motor at the end
11:05 AM rue_mohr: https://paste.debian.net/1307972/
11:06 AM rue_mohr: state 5 can be where the sub-2 line error is handled later (timed pulses)
11:06 AM rue_mohr: Now I need something that snaps it back to state 0
11:07 AM rue_mohr: I'm thinking this should be a control pulse
11:07 AM rue_mohr: which seems to mean another flag from the interrupt system
11:07 AM rue_mohr: or 'flag' gets bit-mapped instead of incremented
11:09 AM rue_mohr: if (ABS(stopPos) < DEADZONE) {
11:09 AM rue_mohr: thats an error
11:09 AM rue_mohr: should be the current position?
11:09 AM rue_mohr: yea, cause dont accelerate in the dead zone
11:11 AM rue_mohr: if (driveState == 5) {
11:11 AM rue_mohr: motorDrive = 0; // coast
11:11 AM rue_mohr: }
11:17 AM rue_mohr: it would be helpfull to have a program that told us the max speed of the encoder pulses, in moveTicks...
11:17 AM rue_mohr: maybe the profiler should do that
11:20 AM rue_mohr: ok I'll bitmap flag
11:36 AM obfuscated_d: I'm still messing with this code, sorry not too talkative, i get tunnel vision
11:40 AM rue_mohr: ...that cant be right, it just compiled, fine, the first time....
11:40 AM rue_mohr: am I in the right directory?
11:42 AM obfuscated_d: haha
11:42 AM rue_mohr: obfuscated_d, where you can, try to reduce the debug prints, watch thats 0.2ms/character printed
11:43 AM rue_mohr: its the right directory, I guess I'll go try it
11:44 AM rue_mohr: https://paste.debian.net/1307982/
11:44 AM obfuscated_d: I nixed the prints entirely. and just stuck two leds on PB2 and PB3, with the polarities reversed. So I get a green light on forward and red on reverse haha
11:44 AM rue_mohr: mind its got my table and drive signal settings and stuff
11:45 AM rue_mohr: :) I think we should add a light for too much error
11:45 AM rue_mohr: comes on at like step*2?
11:45 AM obfuscated_d: yea, that might be a good idea
11:46 AM rue_mohr: I guess I'll go see if this works
11:48 AM rue_shop3: huh , dead
11:51 AM rue_shop3: oh oops, check of deadzone was backwards
11:56 AM rue_shop3: now just spinning out of control
11:56 AM rue_shop3: huh
12:01 PM obfuscated_d: yea... I'm getting so mixed up with the sign of the error
12:01 PM rue_shop3: :]
12:01 PM rue_shop3: well, and I'm not sure if my drive direction matches my encoder direction
12:01 PM rue_shop3: so at best I'm 50%
12:11 PM rue_shop3: huh
12:19 PM obfuscated_d: what's up
12:20 PM rue_shop3: its just not doing anything right
12:20 PM rue_shop3: debug led time...
12:25 PM rue_shop3: stuck in state 2
12:34 PM rue_shop3: huh, looks like nothing it working
12:39 PM rue_shop3: and its triggering on the wrong edge now to boot
12:40 PM rue_shop3: what the...
12:41 PM obfuscated_d: ah, the joys of programming
12:42 PM rue_shop3: It just all fell apart since yesterday
12:47 PM rue_shop3: ok, comparator code is right
12:49 PM obfuscated_d: only thing that should have changed is the code in the wile loop
12:49 PM obfuscated_d: all the encoder/interrupt is the same
12:49 PM rue_shop3: so, I'm going to try to get directions detemined
12:49 PM rue_shop3: with 5V on my motor, I want the encoder counting up, and its going down
12:50 PM obfuscated_d: hmm
12:50 PM obfuscated_d: could just swap encoder channels
12:50 PM rue_shop3: I did, fixed
12:51 PM rue_shop3: so next, I want to mark + on my motor driver
12:52 PM rue_shop3: ok, I defined it by dir + being forward
12:52 PM rue_shop3: high on dir = forward
12:53 PM rue_shop3: next, I want a bicolour led
12:53 PM rue_shop3: green when its forward
12:54 PM obfuscated_d: that's what I did
12:57 PM obfuscated_d: alright, just to be on the same page, i did the same checks. I have my motor forward corresponding to a + encoder count
12:58 PM obfuscated_d: that EncDisplay was handy
01:04 PM rue_shop3: :]
01:07 PM rue_shop3: ok, I even put an arrow on the motor
01:07 PM rue_shop3: so
01:08 PM rue_shop3: it should be noted that the control pulse will add to position if the DIR is high
01:08 PM rue_shop3: to correct that, the motor needs to move reverse
01:08 PM rue_shop3: I need some food...
01:13 PM rue_shop3: fixed3 still works for me, adjusted the trigger pin to PD7
01:13 PM rue_shop3: (chatters like crazy tho)
01:20 PM obfuscated_d: I'm changing some variable names, to help me think a little more clearly
01:22 PM rue_mohr: yup
01:22 PM rue_mohr: I agree, I was shuffling some of the names myself
01:25 PM rue_mohr: obfuscated_d, my comments on the pins seem to be wrong
01:26 PM rue_mohr: looks like 10 is pb2, 11 is pb3, and 12 is pb4
01:26 PM rue_mohr: I'm not sure how they got crossed up
01:26 PM obfuscated_d: yea, I have them on the correct spots
01:26 PM obfuscated_d: on my board, I didn't check the comments
01:27 PM rue_mohr: oh, you had a global v declared...
01:28 PM obfuscated_d: so, to help this make more sense to me, I have a currentPos, targetPos, stopPos and error. Each new commanded step increases the targetPos by step size, the encoder interrupts increment the currentPos,  the error is the targetPos - currentPos, and the stopPos is targetPos - VLUT[velocity]
01:29 PM rue_mohr: I went away from that because of rollover
01:29 PM obfuscated_d: away from what?
01:29 PM rue_mohr: its easier to add and subtract everything and try to keep a variable at 0
01:30 PM rue_mohr: yea, if your position is -30000 and your control is at 1, its gonna go crazy
01:30 PM rue_mohr: it helps that the system is just relative steps
01:30 PM rue_mohr: so, if its trying to always bring the system to 0, it still works great
01:31 PM rue_mohr: as that, the encoder and input command can both modify the same variable
01:31 PM rue_mohr: and compensate out for each other
01:31 PM rue_mohr: its like in 3d when your deciding to move the universe or yourself :]
01:32 PM obfuscated_d: ha
01:32 PM rue_mohr: (futurama joke in there somewhere)
01:34 PM rue_mohr: one of my versions, I think I overwrote ran into that rollover error. instead of trying to deal with it in absolute positioning I just switched to relative
01:34 PM rue_mohr: technically its entire world exists between +- 1 command step
01:35 PM obfuscated_d: I love futurama :) yea, that makes sense, if we recieve a lot of steps, the error may consistently stay lower than ~200 but, the target and current might roll over
01:42 PM rue_mohr: what I like about futurama is their non-commitment to explain things that dont make sense.
01:43 PM rue_mohr: and music with bells, gee whiz, who has bells in music, awesome
01:44 PM obfuscated_d: professor is my favorite character by far
01:44 PM rue_mohr: heh
01:45 PM rue_mohr: the backstories are great
01:48 PM rue_mohr: if those darn gecko drives were only $20 we wouldn't be here...
01:48 PM rue_mohr: even tho they aren't as good as EGMK
01:50 PM obfuscated_d: well, after all that fooling around, renaming, and refactoring. I'm basically right back where we started :)
01:50 PM rue_mohr: this new code I'm working on seems to have 2 issues, it gets stuck in state 2, and it keeps hitting state 7 (!?!?!?!?!?)
01:50 PM rue_mohr: oh, OR its going thru states really fast...
01:50 PM rue_mohr: hmmm
01:51 PM Tom_L: off today ehh
01:51 PM rue_mohr: and tommorow
01:51 PM rue_mohr: I should be doign things for people
01:51 PM Tom_L: no, do them for yourself
01:51 PM rue_mohr: I have a store that hasn't notified me to put their PA back togethor after some work
01:52 PM rue_mohr: and I should roll the truck up on one side and lube the universals
01:52 PM rue_mohr: its raining today, so that would be messy and suck (dirt driveway and all)
01:52 PM rue_mohr: and the 'guest' computer needs to be reinstalled without gnome
01:53 PM obfuscated_d: gnome issues?
01:53 PM rue_mohr: and I was poking with blender, its grown a lot since 1998, but they have made it crazy complex
01:53 PM rue_mohr: yea, I need a windows NT like environment and its now like a windows 12 tablet
01:54 PM rue_mohr: did you know that you need like 16G of ram for vrchat?
01:54 PM rue_mohr: wtf it do with all that ram!?!
01:55 PM rue_mohr: I also learned my new expensive laptop is fixed with 8G ram (more than enough for anything reasonable)
01:55 PM obfuscated_d: I believe 16. VR is heavy
01:55 PM rue_mohr: why tho? its not really anymore than halflife
01:55 PM obfuscated_d: the workstation I built has 64
01:55 PM rue_mohr: a few more polygons
01:56 PM rue_mohr: some extra kinematics, whatever
01:56 PM rue_mohr: yahoo chat in 2000 was cool
01:56 PM rue_mohr: drop your avatar on top of someone elses
01:57 PM rue_mohr: I can fit a whole OS in 2G, easy
01:57 PM obfuscated_d: I vaguely remember using aim chat when I was in middle school. feels like forever ago
01:57 PM rue_mohr: needing 16G for an app is insane
01:57 PM rue_mohr: in yahoo there were 2d avatars
01:57 PM rue_mohr: I think they were always square
01:57 PM rue_mohr: with no transparancy
01:57 PM rifraf: until you work with 3d assemblies
01:58 PM rue_mohr: hey rifraf
01:58 PM rifraf: morning rue
01:58 PM rue_mohr: I have a machine that never breaks over 2G with the models I make for 3d printing
01:58 PM rue_mohr: of ram
01:58 PM rue_mohr: this machine, I have 8G in it,
01:58 PM rue_mohr: most of it just gets used for file cache
01:58 PM obfuscated_d: also, I'm betting the avatars are seriously underoptimized
01:58 PM rifraf: i mean assemblies of complex machines with 1000's of parts
01:59 PM rue_mohr: zippo:/morfiles/programming/c/avr/atmega328/Servo328/enc_pwm_egmk_fixed5# free
01:59 PM rue_mohr: total used free shared buffers cached
01:59 PM rue_mohr: Mem: 8223612 3364084 4859528 0 328532 1626420
01:59 PM rue_mohr: -/+ buffers/cache: 1409132 6814480
01:59 PM rue_mohr: Swap: 20479996 9216 20470780
01:59 PM rue_mohr: ah
01:59 PM Tom_L: rifraf, what cad cam do you use?
01:59 PM rifraf: when doing that was solidedge
01:59 PM rifraf: but my CAM is more limitied now, am sitting here doing it in notepad
01:59 PM Tom_L: :)
02:00 PM rue_mohr: what!? why are you using ultrapad!? :]
02:00 PM Tom_L: my old old cad cam has a lathe package but i've only used it 2x
02:00 PM rifraf: ok notepad++
02:00 PM rue_mohr: hehe
02:00 PM rifraf: i really need to find some lathe cad
02:00 PM rifraf: cam
02:01 PM rue_mohr: I have a half written CAM program written in tk if you want to make soemthing
02:01 PM rifraf: i would try fusion, has anyone used it for a lathe?
02:01 PM rifraf: rue_mohr i use alot of the scripts and wizards in mach3
02:01 PM obfuscated_d: I've never used it for a lathe, but It's great for my mill
02:01 PM * rue_mohr raises his hand "no on the fusion"
02:01 PM rifraf: but no good for more organic design
02:01 PM rifraf: ok thanks for saving me time Tom_L
02:02 PM rue_mohr: obfuscated_d, did you see the pins I turned on my cnc mill?
02:02 PM rue_mohr: I feel a yes
02:02 PM rue_mohr: ...
02:02 PM obfuscated_d: yea, that clip of the pin in the spindle?
02:02 PM rue_mohr: yep
02:03 PM rifraf: ok and i would be lost now without ncviewer
02:03 PM obfuscated_d: I've been working on a 4th axis on and off for a while now, need to get on that more
02:03 PM rifraf: at least it give me some sanity checking and useful for final gcode tweaking
02:04 PM rue_mohr: .com, that aint gonna be free...
02:04 PM rue_mohr: oh its web,...
02:04 PM rue_mohr: hah
02:04 PM rifraf: total free and online
02:05 PM rue_mohr: just playing an random nc file in it now
02:05 PM rifraf: and my only real tool is called lazyturn, alpha version from 2008
02:06 PM rifraf: cannot believe there is not more like that out there, but only does outside turning, i need to massage alot to do boring cycles
02:06 PM rue_mohr: oh that rhombiod for the view select is cute
02:07 PM rue_mohr: yep, thats worth a bookmark
02:07 PM obfuscated_d: I'm off to do domestic responsibilities. I'll be back later on today
02:07 PM rue_mohr: yep
02:08 PM rue_mohr: I'm waking this code over and over trying to find the mistake
02:08 PM rue_mohr: (s)
02:08 PM rifraf: yes worth a bookmark for sure
02:08 PM rue_mohr: its implied that the system is not meeting the stop requirement
02:09 PM rue_mohr: rifraf, did I ever find a good pic of my big cnc to show you?
02:09 PM rue_mohr: its upright like a panel saw
02:09 PM rue_mohr: so all the dust will just fall off
02:10 PM rue_mohr: and its easier to get panels into
02:10 PM rifraf: have not seen a real good pic
02:10 PM rue_mohr: makes the Y axis a bit heavier ;]
02:10 PM rue_mohr: ah, I'll just take another then
02:12 PM rifraf: https://imgur.com/a/dF9TjGS
02:12 PM rifraf: thats a snap from lazyturn, i need to clean the paths still, to many fine passes
02:13 PM rue_mohr: http://ruemohr.org/~ircjunk/projects/cnc6/p1300800.jpg
02:13 PM rifraf: is clunky and you never quite know what its gonna give you
02:13 PM rifraf: heh i did not expect that
02:13 PM rifraf: i have seen those router tables like that
02:14 PM rue_mohr: fit it in 4'x8' or go home
02:14 PM rue_mohr: :]
02:14 PM rue_mohr: have you seen one upright like that?
02:14 PM rifraf: yep
02:14 PM rue_mohr: cool, so far I'm the only person I know to do that
02:14 PM rifraf: forget its name
02:15 PM rue_mohr: only ever seen that on a panel saw
02:15 PM rue_mohr: yay, I'm going the right direction
02:15 PM rue_mohr: its got a heavy duty router on it too
02:15 PM rue_mohr: that motor you see is the Z axis motor
02:15 PM rue_mohr: the orange box on the right will be the motor driver
02:16 PM rue_mohr: 170VDC, 15A 3 channels
02:16 PM rifraf: not a Y motor on its side?
02:16 PM rue_mohr: target is jog at 1m/s
02:16 PM rue_mohr: the Y motor will lift that along the vert rail
02:17 PM rue_mohr: the X motor will run that pulley at the top left
02:17 PM rue_mohr: still making the pullies
02:17 PM rifraf: https://makezine.com/projects/maslow-upright-cnc-router/
02:17 PM rue_mohr: oh a hangrouter
02:17 PM rue_mohr: hah, kinda
02:18 PM rifraf: pretty cheapand simple concept, not sure how well it went
02:18 PM rue_mohr: its come up a lot
02:19 PM rue_mohr: wow that must be slow with motors that small
02:20 PM rue_mohr: this machine I'm building was supposed to be a 1-afternoon project
02:20 PM rue_mohr: I failed
02:21 PM rifraf: afternoons go very fast
02:21 PM rue_mohr: yea, its a litnus test for me finishing a project
02:21 PM rifraf: anyways enjoy your arvo, off to work here, just 6.30
02:22 PM rue_mohr: me and obfuscated_d are going to revolutionalize the world of huge stepped position systems
02:22 PM rue_mohr: and maybe smaller ones
02:22 PM rifraf: good luck with that, no reason why you can't do it
02:23 PM rue_mohr: I'll tell you more when your back
02:26 PM rifraf: wow, got 2.5k views in a day in my first youtube short, donna how that works
02:27 PM rifraf: i call that varl :)
02:27 PM rue_mohr: Tom_L, he beat us...
02:27 PM rifraf: or viral
02:27 PM rue_mohr: silly videos category
02:27 PM Tom_L: that stupid spring has like 4-5k
02:27 PM rue_mohr: me and tom had some go crazy too
02:28 PM Tom_L: https://www.youtube.com/watch?v=dOFYApGVcQI
02:28 PM Tom_L: 5.1k
02:28 PM Tom_L: it's dumber than the others
02:29 PM rue_mohr: does add to the fun of having made the machine do it, tho doesn't it?
02:30 PM rue_mohr: I still dont have the feedback if they were right
02:30 PM rue_mohr: I have to do invoicing today for the sprayer stuff, and I should get more stock parts going
02:30 PM rue_mohr: I think I slotted all those latches
02:31 PM Tom_L: you tried your springs yet?
02:31 PM rue_mohr: they kinda all got mixed and I dont know yet
02:31 PM rue_mohr: sorta messed that one up
02:31 PM rue_mohr: having a hard time catching my breath and focusing latley
02:32 PM rue_mohr: life seems to be turning into a blizzard
02:32 PM rue_mohr: not sure if I'm going in the right direction, but for everything I can gather, I'm roughly correct
02:33 PM rue_mohr: cnc, new house, robot body
02:33 PM Tom_L: house seems like it should be more a priority
02:33 PM rue_mohr: the vr thing could be a great route on training an AI for reading EKG sensors and doing the mapping
02:34 PM rue_mohr: starting the house
02:34 PM rue_mohr: this year is to dig out the basement and remove the old septic tank
02:34 PM rue_mohr: and remove some other inner walls too
02:35 PM Tom_L: you have a basement or are making one?
02:35 PM Tom_L: i remember the trouble you had with the shop slab
03:41 PM rue_mohr: ok, at 6pm I'll do the bills and stuff
03:53 PM Tom_L: oh i didn't know it was under the house
03:53 PM Tom_L: generally that's a no no
03:54 PM rue_shop3: they put down the trailer, put the septic system beside it, then put an addition over it
03:55 PM rue_shop3: field and all
03:56 PM Tom_L: did you thank them?
03:56 PM rue_shop3: with all the other stuff I'v not had the chance!
03:57 PM rue_shop3: not glueing the septic pipe so it falls off, drilling holes thru the other drain lines
03:57 PM rue_shop3: the copper only recpeticles on the aluminum wire (which was burning back)
04:01 PM rue_shop3: its working? kinda but my logic is wrong somewhere
04:04 PM rue_shop3: https://paste.debian.net/1308012/
04:04 PM rue_shop3: soemthing is wrong with states 4 and 5
04:05 PM rue_shop3: I'll try removing the coasting support
04:06 PM rue_shop3: now its not working at all
04:13 PM rue_shop3: its in state 5, the direction is +
04:13 PM rue_shop3: it should have stopped the motor and moved to 6
04:24 PM rue_shop3: the polarity is backwards, which is impossible
04:34 PM rue_shop3: oh, the other thing I can derive from the timer data is that the absolute max step rate is 18Hz
04:34 PM rue_shop3: (for this system doing 36 degree steps)
04:51 PM aandrew: rue_shop3: you might like https://github.com/howerj/bit-serial
04:51 PM aandrew: 16-bit CPU with UART, pretty damn tiny
04:52 PM aandrew: also has a C simulator
04:52 PM rue_shop3: wait, state 5 is doing.... everything!?
04:52 PM rue_shop3: aandrew, this is a servo, cant stop to debug
04:52 PM rue_shop3: its getting into state 5 and never ever leaving
04:54 PM rue_shop3: caught it,
04:55 PM rue_shop3: state goes from 0->3->5
04:55 PM rue_shop3: and hangs there
04:55 PM rue_shop3: yea, 46.2ms, thats right for the forward pulse
04:58 PM rue_shop3: // show me your directions work on the motor...
04:58 PM rue_shop3: MotorForward();
04:58 PM rue_shop3: Delay(724637); // 2 second startup delay
04:58 PM rue_shop3: MotorReverse();
04:58 PM rue_shop3: Delay(724637);
04:58 PM rue_shop3: MotorOff();
04:58 PM rue_shop3: Delay(724637);
04:58 PM rue_shop3: Delay(724637);
04:58 PM rue_shop3: and it checks out
04:59 PM rue_shop3: state 0 is "Am I out of the deadzone?" and it is, so it goes to state 1
05:00 PM rue_shop3: and state 1 is "which way do we need to go, and lets turn the motor on to go there" and for this case it chose p>0, which it is, so, on to state 3
05:01 PM rue_shop3: and the motor is put in reverse
05:02 PM rue_shop3: oh
05:02 PM rue_shop3: so, hey wait
05:02 PM rue_shop3: no, wait
05:02 PM rue_shop3: the command pulse was +
05:02 PM rue_shop3: so at state 0, p was 1260
05:03 PM rue_shop3: yea, so the motor is put in reverse
05:03 PM rue_shop3: to get back to zero
05:03 PM rue_shop3: and on to state 3
05:03 PM rue_shop3: if (stopPos < 0)
05:04 PM rue_shop3: so, p is 1260
05:04 PM rue_shop3: and the motor is in reverse
05:04 PM rue_shop3: for 47ms were in state 3, which is correct
05:05 PM rue_shop3: state 3 sends us to state 5 as its done
05:05 PM rue_shop3: oh
05:06 PM rue_shop3: *sign correction*
05:06 PM rue_shop3: ok, the fixed state 5
05:07 PM rue_shop3: will see if the the stop position is going to be above or below zero
05:07 PM rue_shop3: if its above, it coasts, if its below, it applies forward drive
05:08 PM rue_shop3: if the direction goes foward, it stops and exits
05:10 PM rue_shop3: wtf, now its stuck in state 6
05:13 PM rue_shop3: what
05:14 PM rue_shop3: it went 0, 3, 6
05:15 PM rue_shop3: ah, higher rez helps
05:15 PM rue_shop3: 0, 1, 3, 5, 6
05:15 PM rue_shop3: but 5 is only .3us
05:15 PM rue_shop3: should be 7ms
05:28 PM rue_shop3: still falling thru state 5
05:29 PM rue_shop3: why is this being so hard?
05:29 PM rue_shop3: if the gains weren't crazy I'd have given up and used proportionate control
05:30 PM rue_shop3: ok, the position > 0, motor is in reverse, the estimated stop position is negative
05:30 PM rue_shop3: were in state 5
05:31 PM rue_shop3: the only exit is if direction is 0
05:33 PM rue_shop3: ok, lets screw coasting stops
05:34 PM rue_shop3: were moving reverse, were not gonna let go till were moving forward again
05:34 PM rue_shop3: so motor drive is full forward
05:35 PM rue_shop3: its in state 5, and the motor is in full forward, and its not stopping
05:36 PM rue_shop3: and even if I grab the shaft and force it the other way it wont quit
05:37 PM rue_shop3: else if (driveState == 5) { // decel rolling reverse
05:37 PM rue_shop3: PORTC = 5;
05:37 PM rue_shop3: if (direction == 1) { // are we done?
05:37 PM rue_shop3: motorDrive = 0; // coast
05:37 PM rue_shop3: driveState = 6; // maintain/idle
05:37 PM rue_shop3: // } else if (stopPos > 0) { // coast if it looks were going to stop short
05:37 PM rue_shop3: // motorDrive = 0; // coast
05:37 PM rue_shop3: } else {
05:37 PM rue_shop3: motorDrive = 1; // forward
05:37 PM rue_shop3: }
05:37 PM rue_shop3:
05:37 PM rue_shop3: }
05:37 PM rue_shop3: direction DOES = 1, driveState does = 5
05:37 PM rue_shop3: why isn't it going to state 6
05:52 PM rue_shop3: https://paste.debian.net/1308018/
05:52 PM rue_shop3: I'm confused as all hell
05:57 PM rue_shop3: why is direction always 0
05:58 PM rue_shop3: oh no where did static go?
05:59 PM rue_shop3: no wait, what!?
06:03 PM rue_shop3: ohhh
06:05 PM rue_shop3: if ((direction == t) || (direction == 0)) { // if the direction is the same as last time
06:05 PM rue_shop3: moveTicks = TCNT1;
06:05 PM rue_shop3: } else {
06:05 PM rue_shop3: moveTicks = 60000; // "0" if we changed direction and dont have a new reading yet.
06:05 PM rue_shop3: t = 0; // set direction to zero. (average, we just turned around)
06:05 PM rue_shop3: }
06:05 PM rue_shop3: oops (fixed)
06:10 PM rue_shop3: OMG
06:10 PM rue_shop3: flag |= 2 ; .... if (IsHigh(2, flag)) driveState = 0 ;
06:10 PM rue_shop3: CMON RUE!!!
06:11 PM rue_shop3: stuck in state 0?
06:12 PM Tom_L: that's a black hole
06:13 PM rue_shop3: ugh, this is painfull
06:14 PM rue_shop3: and if someone described it to me, I'd be like "yea, I can code that up in, like, an hour!"
06:15 PM rue_shop3: the thing is, you CANT get stuck in state 0
06:15 PM rue_shop3: ANY event takes you out of state 0
06:15 PM rue_shop3: ANY
06:15 PM Tom_L: you got yer self a problem sir
06:16 PM rue_shop3: 16MHz sampling confirms, stuck in state 0
06:29 PM rue_shop3: ok, the interrupt is working
06:29 PM rue_shop3: so its incrementing the flag
06:36 PM rue_shop3: ah, it does see the flag
06:37 PM rue_shop3: if (driveState == 0) { // new step precheck
06:37 PM rue_shop3: PORTC = 0;
06:37 PM rue_shop3: if (ABS(p) > DEADZONE) {
06:37 PM rue_shop3: driveState = 1; // start accel
06:37 PM rue_shop3: } else {
06:37 PM rue_shop3: driveState = 6; // maintain / idle // if were moving faster than X, should we go to state 3 or 4 instead? // maybe this would mean the incomming velocity is too high?
06:37 PM rue_shop3: }
06:38 PM rue_shop3: }
06:38 PM rue_shop3: tell me how that code doesn't get to state 1 or 6
06:38 PM rue_shop3: please
06:39 PM obfuscated_d: aren't we setting the position as negative? so it won't ever be greater than Deadzone
06:39 PM rue_shop3: ABS
06:39 PM obfuscated_d: oh duh haha
06:39 PM rue_shop3: np
06:40 PM obfuscated_d: okay, so a step will set drivestate to 0 now?
06:40 PM rue_shop3: well, I'm trying to get anything out of it
06:40 PM rue_shop3: so I'm giving it some crazy stuff
06:41 PM rue_shop3: its setting the state to 0
06:41 PM rue_shop3: but its not changing
06:41 PM rue_shop3: oh
06:41 PM rue_shop3: the elses
06:41 PM rue_shop3: ok thats on me
06:42 PM rue_shop3: ah!
06:42 PM obfuscated_d: can you paste me what you have? hard with no context
06:42 PM rue_shop3: np
06:42 PM rue_shop3: this is working with chatter!
06:43 PM rue_shop3: https://paste.debian.net/1308022/
06:43 PM rue_shop3: I have to go unbreak some things
06:43 PM obfuscated_d: alrighty
06:46 PM rue_shop3: so, from hooking up the function gen, I inadvertently proofed the system for up to 18Hz max for 36 degree steps
06:47 PM rue_shop3: ugh, eek, this isn't right
06:47 PM rue_shop3: its working, but not properly...
06:47 PM obfuscated_d: I'm not getting any jitter!
06:48 PM rue_shop3: the logic analizer is saving this
06:48 PM rue_shop3: its not locking into the states properly
06:48 PM obfuscated_d: I am getting erratic steps though
06:48 PM rue_shop3: interesting
06:49 PM obfuscated_d: I think the erratic steps are noisy steps from this encoder knob
06:49 PM obfuscated_d: it's actually working quite good with my setup
06:49 PM rue_shop3: ok what I'm seeing is a lot of transitions from 0 to 6, which is when its in the deadband
06:49 PM rue_shop3: but
06:49 PM rue_shop3: the machine shouldn't be resetting
06:50 PM rue_shop3: if ((flag | 2) != 0) driveState = 0;
06:50 PM rue_shop3: omg
06:50 PM rue_shop3: someone shoot me
06:51 PM rue_shop3: is bit 2 set? let me make sure before I test for it
06:51 PM rue_shop3: there, no chatter
06:51 PM rue_shop3: yes! ok!
06:51 PM rue_shop3: its locking in the states
06:51 PM rue_shop3: 46ms forward drive, 8ms reverse
06:52 PM rue_shop3: yes!!
06:52 PM rue_shop3: want an update?
06:52 PM obfuscated_d: sure!
06:52 PM obfuscated_d: I just need the main function
06:52 PM rue_shop3: https://paste.debian.net/1308023/
06:52 PM rue_shop3: oh yea
06:52 PM rue_shop3: we should probably move the custom stuff out of main eh?
06:53 PM rue_shop3: and maybe make a file for the other per-system profile data
06:54 PM rue_shop3: wow, this might be close
06:54 PM rue_shop3: its doing the steps just right
06:54 PM rue_shop3: *but* when its done the step, state 6 does nothing to hold it
06:55 PM rue_shop3: but, its state 6
06:55 PM rue_shop3: <apply code>
06:59 PM rue_shop3: http://ruemohr.org/%7Eircjunk/tempimage/screenshot.png
06:59 PM rue_shop3: the top 3 traces are the state number
07:00 PM rue_shop3: the bottom trace is the step command
07:00 PM rue_shop3: the 3rd trace down is the main drive signal
07:00 PM rue_shop3: the 2nd trace down shows the braking time
07:01 PM rue_shop3: the top trace kinda showing the idle time before the next control pulse
07:01 PM obfuscated_d: it seems like it's ignoring steps, at least on my setup
07:02 PM rue_shop3: pin 7?
07:02 PM obfuscated_d: yup
07:02 PM rue_shop3: oh
07:02 PM rue_shop3: oh oh oh
07:02 PM rue_shop3: I had to change the interurpt functions
07:02 PM rue_shop3: the encoder and step interrupt are different
07:02 PM obfuscated_d: ahh
07:02 PM rue_shop3: there was an error in the encoder function that didn't allow the direction to be anything other than 0
07:02 PM rue_shop3: that was a head scratcher
07:03 PM rue_shop3: ooo there was just a few glitches tho
07:04 PM obfuscated_d: which pins did you change to?
07:05 PM rue_shop3: the motor outputs are arduino 10/11 with 10 being dir and 11 being pwm, but your functions for that are different
07:06 PM rue_shop3: step is arduino 7 and dir is arduino 6
07:06 PM rue_shop3: maybe put a pullup on arduino 6
07:06 PM rue_shop3: it'll do both directions
07:06 PM rue_shop3: oh
07:06 PM obfuscated_d: yeah, all that's the same
07:07 PM rue_shop3: on startup, I have it go forward 1 sec, then reverse 1 sec, then stop for 2
07:07 PM obfuscated_d: I am  missing the | in the interrupt though, oh
07:07 PM rue_shop3: so you can make sure the motor is running right
07:07 PM obfuscated_d: yeah that's working correctly
07:07 PM rue_shop3: I had a bunch of "well is the motor drive signal working???"
07:07 PM rue_shop3: your code wont be the same as mine tho
07:07 PM rue_shop3: right?
07:08 PM rue_shop3: #define MotorForward() SetBit(2, PORTB) ; SetBit(3, PORTB)
07:08 PM rue_shop3: #define MotorReverse() ClearBit(2, PORTB); SetBit(3, PORTB)
07:08 PM rue_shop3: #define MotorOff() ClearBit(2, PORTB) ; ClearBit(3, PORTB)
07:08 PM rue_shop3: thats mine
07:08 PM rue_shop3: you should have forward different
07:08 PM rue_shop3: set and clear
07:08 PM rue_shop3: not set and set
07:08 PM obfuscated_d: It's working now
07:08 PM rue_shop3: ok
07:09 PM obfuscated_d: nice work sir!
07:09 PM rue_shop3: hah, its killing me
07:09 PM rue_shop3: not sure why this should be simple!!!
07:09 PM rue_shop3: so
07:09 PM obfuscated_d: simple != easy
07:09 PM Tom_L: cause you like confuzion?
07:09 PM rue_shop3: haha
07:10 PM rue_shop3: I kinda ran the whole day on a pack of noodles
07:10 PM rue_shop3: I'm gonna take a break and get more food
07:10 PM rue_shop3: obfuscated_d,
07:10 PM Tom_L: better before it affects your brain
07:11 PM rue_shop3: how could we make a 'timed pulse' profiler?
07:11 PM obfuscated_d: hmmm
07:11 PM rue_shop3: so, for steps down to deadband
07:11 PM rue_shop3: er, from deadband to 0
07:11 PM rue_shop3: well 1
07:11 PM rue_shop3: er, from deadband to 1
07:12 PM rue_shop3: we want to know the timed pulses that result in moves of 1 line, 2 lines, etc...
07:12 PM rue_shop3: and result in a stop ** (the hard bit)
07:12 PM obfuscated_d: we have a way to measure velocity, and nice interrupts on the encoder. we have another timer available on the 328 right?
07:12 PM rue_shop3: yes
07:12 PM rue_shop3: but
07:12 PM rue_shop3: well, yes
07:13 PM rue_shop3: you thinking we just know if were stopped by watching the encoder for a while and seeing if there is lingering motion?
07:13 PM obfuscated_d: we could change the compare register in the loop , set an interrupt to toggle the motor on and off, keep increasing or decreasing the interval
07:14 PM rue_shop3: I think the times will be in the order of 1ms max
07:14 PM rue_shop3: to shed light on the timer requirements
07:14 PM obfuscated_d: so we need a resolution of 1ms?
07:15 PM obfuscated_d: that's doable
07:15 PM obfuscated_d: go eat!
07:17 PM rue_shop3: not resolution, upper range
07:20 PM rue_mohr: http://ruemohr.org/~ircjunk/projects/cnc6/p1300800.jpg
07:20 PM rue_mohr: did you see that imge?
07:22 PM obfuscated_d: yeah, pretty neat. I've seen some panel saw cnc router conversions a while back
07:23 PM obfuscated_d: it's a nice space savefr
07:23 PM obfuscated_d: saver
07:24 PM obfuscated_d: putsch sells a 6000lb behemoth version of one, insanely expensive
07:32 PM obfuscated_d: welp, I need to shower and spend time with the mrs. Didn't have a ton of free time today. I'll do some tinkering on the timed pulse profiling in the am
07:32 PM rue_mohr: np
07:32 PM rue_mohr: I'm gonna work on cleaning up that code in a way that doesn't break it
07:32 PM rue_mohr: and play with the tables and deadzone
07:33 PM rue_mohr: its doing the right thing tho, so thats cool
08:50 PM rue_mohr: so
08:50 PM rue_mohr: as the system speeds up, if a new pulse comes in while its already moving, it would take less time to get there
08:51 PM rue_mohr: so, I it should be able to keep up with more than 18 steps/second
08:56 PM rue_mohr: so Tom_L blender might be able to help me do some of the organic mods to models
08:56 PM rue_mohr: like that sprayer handle
09:01 PM Tom_L: ?
09:04 PM Tom_L: you need help changing something?
09:05 PM Tom_L: i was having trouble with that drive but i think it was the port
09:26 PM rue_shop3: I was just poking around with blender yesterday
09:27 PM rue_shop3: its come a long way since 1998
09:27 PM rue_shop3: 98? I think so, used to laugh cause it was so crashy
09:30 PM Tom_L: i've been testing the new port arrangement for a week or so now with linux
09:30 PM Tom_L: seems better but i think there's a bug in the bios or MB when filling all the ports
09:30 PM rue_shop3: hmm
09:30 PM Tom_L: but now i have 2 ports but 3 ssd to use
09:31 PM rue_shop3: heh
09:31 PM Tom_L: all the stuff for cad on the sprayer is on the one that's unplugged atm
09:32 PM Tom_L: you were wanting to adjust hole for the tube tips..
09:46 PM rue_shop3: no, I was thinking I could make the handle a bit more organic
09:47 PM rue_shop3: but I need to do billing and make more first
09:47 PM rue_shop3: not set up yet for this years orders
09:47 PM rue_shop3: really need to do that
09:52 PM rue_shop3: with a step size of 63 and a dead zone of 2, I can pull off over 300Hz stepping
09:52 PM rue_shop3: oo thats 1.8 degrees
10:49 PM VanUnamed: rue_shop3:
10:49 PM VanUnamed: https://yahoo241003.autodesk360.com/g/shares/SH512d4QTec90decfa6ed3b0969dede0c122