#robotics Logs

Jan 05 2018

#robotics Calendar

12:06 AM mrdata: not so bad a price, https://www.digikey.ca/product-detail/en/yageo/CC0402KRX7R8BB222/311-1714-1-ND/5195616
12:16 AM rue_mohr: 3 hours of looking for a 2.2nF smt cap
12:16 AM rue_mohr: I'm buying a sample kit
12:16 AM rue_mohr: I needed _5_ parts for my project
12:16 AM rue_mohr: I have everything but two 2.2nf caps
12:17 AM rue_mohr: @#!$%#$%^@$@^&@$&@$^@%@#$
12:21 AM anonnumberanon: http://www.avrfreaks.net/forum/avr32-vs-stm32-toe-toe
12:22 AM rue_mohr: easy, avr32 is not a standard arch, it loses
12:22 AM rue_mohr: arm for the win
12:23 AM rue_mohr: https://www.aliexpress.com/item/Free-Shopping-200PCS-Ceramic-capacitors-0805-1uf-1000nf-x7r-10-50v-CL21B105KBFNNNE/592923241.html
12:23 AM rue_mohr: THERE! fixed!
12:24 AM anonnumberanon: http://electronut.in/stm32-start/
12:26 AM rue_mohr: oh no, your... going to try to write an OS for an stm32 in assembler
12:26 AM anonnumberanon: lol
12:27 AM rue_mohr: I could help you set up with libopencm and gcc with the makefiles etc I made
12:27 AM rue_mohr: but you wouldn't do it and itd be a waste of time, so I'm going to have to just sit back and try to not slit my throat while you do whatever it is your gonna do :)
12:28 AM rue_mohr: I STILL CANT BELEIVE THAT IN 3 HOURS I COULD NOT FIND TWO 2.2NF SMT CAPACITORS
12:28 AM * rue_mohr excersizes the brick wall for a while
12:28 AM anonnumberanon: now that we've got that out of the way, I can start working
12:32 AM anonnumberanon: there's not really any more challenge now
12:32 AM anonnumberanon: though
12:32 AM anonnumberanon: it will be straight forward
12:32 AM anonnumberanon: i can focus more on building and coding algorithms
12:32 AM rue_mohr: hopefully not for the servos you dont know how to work yet... |:/
12:32 AM rue_mohr: rue_mohr, your being negitive
12:32 AM rue_mohr: yea
12:32 AM rue_mohr: its rude
12:32 AM rue_mohr: sorry, I'm having issues
12:32 AM rue_mohr: dont discourage anonnumberanon, hes applying effort
12:32 AM rue_mohr: yes but,
12:32 AM rue_mohr: its effort, leave him to it
12:32 AM rue_mohr: but
12:32 AM rue_mohr: he has his own way
12:32 AM rue_mohr: but in 2 weeks, he's gonna come back and say that the stm32 dosn't work and isn't powerfull enough to operate 16 servos
12:32 AM rue_mohr: so?
12:33 AM rue_mohr: but it can run 88
12:33 AM rue_mohr: YOU can make it do 88, maybe your ways just arent for him
12:33 AM rue_mohr: but
12:33 AM rue_mohr: work on your fft
12:33 AM rue_mohr: but
12:33 AM rue_mohr: fft!
12:33 AM rue_mohr: ok, fft, but this fft stuff isn't as easy as it was made out to be...
12:39 AM anonnumberanon: i could use the atmega328p to run 16 servos with a 5 us pulse minimum resolution
12:39 AM anonnumberanon: or overclock it to 24 mhz and have a minimum resolution of 1 us
12:40 AM anonnumberanon: no anonnumberanon let's not make the rue_mohr mad again
12:40 AM anonnumberanon: but he asked for it!
12:40 AM rue_mohr: why was I able to achive .08us then?
12:40 AM anonnumberanon: lies
12:41 AM anonnumberanon: you have to understand my constraints but you're not ready for that
12:41 AM anonnumberanon: or should I say you all are not ready for that
12:41 AM anonnumberanon: 1 pin from a port, another pin from another port, with 1 us space between the both
12:41 AM rue_mohr: it dosn't matter anyhow, when youhave that much time resolution, people just say your stupid and that its pointless
12:41 AM rue_mohr: most people would be happy with a resolution of 1ms
12:42 AM anonnumberanon: most people are sheep
12:42 AM anonnumberanon: so sheep would be happy with that? fine
12:42 AM rue_mohr: atleast we agree on something
12:43 AM rue_mohr: so, the stm32, 88 servos, with same timing .08us
12:43 AM anonnumberanon: people who do humanoid biped robots buy their servo controllers, if not (they're very good), they are surely NOT happy with anything more than 5us
12:44 AM anonnumberanon: my statement was not totally accurate if we consider the fact many of them just talk to the servo with communication protocols, not PWMs
12:44 AM anonnumberanon: but then you'd have to benchmark the communication protocol and see how fast you can use it
12:46 AM anonnumberanon: the whole point of this mister rue_mohr is that when you have software to balance a robot by relying on an MPU that is not perfect, robot joints that are not perfect, a walking surface that is not perfect, you want your servo orders to be as good as you can make them, so whatever algorithms you use for the balancing works better
12:47 AM rue_mohr: and you dont beleive me about compliant systems
12:47 AM anonnumberanon: ultimately, when you robot gets punched or makes a bad step while moving, this all will help it not fall and not lose a point for the game
12:47 AM rue_mohr: passive compliance
12:47 AM rue_mohr: maybe you should watcha neat youtube video
12:48 AM rue_mohr: https://www.youtube.com/watch?v=K926HAKRFvw
12:51 AM anonnumberanon: I'm glad i did the asm exercise. I was able to measure by how much I would not reach 1us resolution. i can do a resolution of 18 cycles, target being 16 (16 is 1 microsecond)
12:51 AM rue_mohr: that cuase your not using the hardware
12:52 AM rue_mohr: on small systems learn to bend the hardware to do things for you
12:52 AM anonnumberanon: using the hardware would give me a resolution of like 30 cycles, that's about 2.5 microseconds
12:52 AM rue_mohr: anonnumberanon, here is a challange for you, try it in asm
12:52 AM anonnumberanon: i did it
12:52 AM anonnumberanon: even in assembly
12:52 AM anonnumberanon: i did
12:52 AM rue_mohr: reverse an 8 bit byte
12:53 AM rue_mohr: 0b00001111 into 11110000
12:53 AM anonnumberanon: the interrupt servicing alone takes up like more than 10 cycles
12:53 AM rue_mohr: not the fixed value, but switching all the bytes around
12:53 AM rue_mohr: I can do it in 3 instructions
12:53 AM mrdata: use a lookup table
12:53 AM rue_mohr: see if you can figure it out
12:53 AM rue_mohr: hah, ok
12:54 AM rue_mohr: I should have said without using a lookup table
12:54 AM mrdata: lol
12:54 AM rue_mohr: cause thats 256 bytes you wont ever see again
12:54 AM mrdata: processor-dependent; but you can rotate thru carry left from one register and right into another
12:55 AM anonnumberanon: the exercise is to toggle all the bits?
12:55 AM rue_mohr: tho, memory wise, 2x 4 bit lookup tables is quite reasonable
12:55 AM rue_mohr: anonnumberanon, no
12:55 AM rue_mohr: reverse their positions
12:55 AM rue_mohr: aka01234567 into 76543210
12:55 AM rue_mohr: 0b10000000 -> 00000001
12:56 AM rue_mohr: I think you cant pull it off in less than 16 instructions
12:57 AM rue_mohr: mrdata, would it be more or less than 3 to do it in a lookp tho?
12:57 AM rue_mohr: load base address, load offset +-math, and the read
12:57 AM mrdata: rue_mohr, with a lookup table it would be a single instruction
12:57 AM rue_mohr: anonnumberanon, shall I leave you with that puzzle for a bit?
12:57 AM anonnumberanon: rue_mohr, what is that used for
12:58 AM anonnumberanon: and no I don't have a use for this right now
12:58 AM anonnumberanon: gonna watch that vid
12:58 AM rue_mohr: mrdata, is there a relative address mode? read table+register ?
12:58 AM mrdata: in c, it's just v1 = table[v0];
12:58 AM rue_mohr: no, I'm talking assember commands
12:59 AM rue_mohr: _3_ assembler commands
12:59 AM rue_mohr: instuctions for that matter
12:59 AM mrdata: which cpu?
12:59 AM rue_mohr: m328
12:59 AM mrdata: idk
12:59 AM rue_mohr: m32 would work too
01:00 AM mrdata: i would just compile the c code and see what it spits out
01:00 AM rue_mohr: well, yea, but the point of it is a pointless educational excersize
01:00 AM rue_mohr: that makes ya think
01:01 AM mrdata: thats how i studied assembler; i would try to optimize the compiler's output
01:02 AM rue_mohr: https://github.com/bradley219/avr_fft/blob/master/ffft.S
01:02 AM rue_mohr: this code is neat, he used macros to make new instructions
01:04 AM rue_mohr: but he dosnt' know things like the xor technique for swapping memory locations
01:06 AM rue_mohr: but I need to understand fft code waaay better to grasp half the stuff going on there
01:08 AM mrdata: hmm
01:09 AM mrdata: that's a zany piece of code
01:09 AM mrdata: it's all encrypted
01:09 AM mrdata: best single-step thru it for a small window
01:09 AM anonnumberanon: rue_mohr, may I suggest a degree in EE ?
01:10 AM anonnumberanon: oh gotta put the pasta to cook
01:11 AM mrdata: FFT essentials: a signal may be transformed without loss from time domain to frequency domain. in frequency domain, each harmonic has a phase. you transform a window of a fixed size number of sampels at a time
01:11 AM mrdata: the window size is best a power of 2
01:12 AM mrdata: correction, each harmonic has a phase and an amplitude
01:12 AM rue_mohr: I know what
01:12 AM rue_mohr: that
01:12 AM rue_mohr: mrdata, you just reading of ya know
01:13 AM rue_mohr: cause from what I know right now, the fft itself only does manipulation of an array of complex numbers
01:13 AM mrdata: yes
01:13 AM rue_mohr: so to put a time domain disngla in, and get a freq domain signal out,
01:13 AM rue_mohr: you need 'manipulators' on either side of the fft calculation
01:13 AM mrdata: theyre complex because amplitude and phase are orthogonal
01:14 AM rue_mohr: the 'result' of the fft, you take the sqrt of the real and complex values for your intensity
01:14 AM rue_mohr: but I dont know what they are doing to the input,
01:14 AM rue_mohr: something about mixing up the order of the input samples?
01:15 AM rue_mohr: and I dont understand why were looking at 1 arrayin and out instead of two
01:15 AM rue_mohr: but I could be wrong (about any of it)
01:15 AM mrdata: some fft implementations ignore the phase part; those arent invertible
01:16 AM rue_mohr: that ok, I'm only interseted in the freq domain amplitudes
01:17 AM rue_mohr: https://rosettacode.org/wiki/Fast_Fourier_transform#BBC_BASIC
01:17 AM rue_mohr: I find this readable
01:18 AM rue_mohr: so, are all the time domain input values set to 0 imaginary?
01:18 AM rue_mohr: I dont understand the meaning of imaginary component of a time domain array anyhow
01:18 AM mrdata: yes
01:18 AM rue_mohr: ok
01:19 AM rue_mohr: so the function that does the alg, could just use 0 instead of reading one from an array of them?
01:19 AM rue_mohr: or is the input array also the output array
01:21 AM mrdata: idk but that would make sense for a compact implementation maybe
01:22 AM rue_mohr: do you know what the byte order manipulation is all about?
01:22 AM mrdata: so if you see it mixing up the input samples, thats probably whats going on
01:23 AM rue_mohr: its for arrays of mixed real and complex values?
01:23 AM mrdata: the byte order manipulation, idk. is there an big vs little endian problem to solve?
01:24 AM rue_mohr: no, I thought thats what they were up to, but its not, the text I saw was them moving aroundt he values in the input array
01:24 AM mrdata: arranging the harmonics?
01:24 AM rue_mohr: idk
01:25 AM rue_mohr: http://www.drdobbs.com/cpp/a-simple-and-efficient-fft-implementatio/199500857
01:25 AM rue_mohr: / reverse-binary reindexing
01:25 AM rue_mohr: The Cooley-Tukey algorithm uses the fact that if the elements of the original length N signal x are given a certain "bit-scrambling" permutation, then the FFT can be carried out with convenient nested loops.
01:26 AM rue_mohr: oh I could read into it more
01:27 AM rue_mohr: oh it says more every time I read it
01:28 AM rue_mohr: wtemp = sin(0.5*theta);
01:28 AM rue_mohr: wpr = -2.0*wtemp*wtemp;
01:28 AM rue_mohr: wpi = sin(theta);
01:28 AM rue_mohr: I think the 0.5*theta is wrong tho
01:28 AM rue_mohr: I think it should be threta+Pi
01:29 AM rue_mohr: hah, les the typo
01:29 AM mrdata: no
01:30 AM rue_mohr: k
01:30 AM rue_mohr: cause one is supposed to be sin and the other cos, no?
01:30 AM mrdata: but theres that squared operation to give wpr
01:31 AM mrdata: it's funny trig but iirc correct
01:31 AM rue_mohr: ok
01:31 AM mrdata: need to check math texts
01:31 AM rue_mohr: its funny
01:31 AM rue_mohr: I have whole book on fourier, and they have one little chapter on fft where they dont really say anything
01:32 AM anonnumberanon: "Programming AVRs was a walk in the park. Just download avrdude + avr-gcc, get a cheap USB programmer, and you were set. Compared to that, developing for ARM is like trying to stroll in the middle of a raging battlefield."
01:32 AM rue_mohr: yea, but I was forged in the says when developing for avrs was that same battlefield
01:32 AM rue_mohr: so it wasn't that bad
01:33 AM * mrdata hits anonnumberanon with an artillery barrage
01:33 AM rue_mohr: AND I put everything togethor to make it easy, cause I knew how after the avr thing
01:33 AM rue_mohr: anonnumberanon, thats why you could be coding stm32 in a few short hours with my help
01:34 AM rue_mohr: rue_mohr "few short hours"
01:34 AM rue_mohr: well, you know how hours go when your not looking...
01:34 AM rue_mohr: crap, its 11:30pm already
01:34 AM rue_mohr: damnit
01:34 AM rue_mohr: I wanted to play
01:36 AM mrdata: 3hrs later here
01:37 AM anonnumberanon: i are too also
01:38 AM anonnumberanon: last time we worked on avr rue_mohr you were too slow for me
01:38 AM rue_mohr: anonnumberanon, 3 instructions, think outside the box
01:39 AM rue_mohr: well I have a dayjob
01:39 AM anonnumberanon: i would google things frantically, finally find it, make it work, and then you quickly come out with the correct sequence of info that i needed
01:39 AM anonnumberanon: i.e the avrdude stuff
01:39 AM rue_mohr: yea, you never did justget the makefile I had posted did you?
01:39 AM anonnumberanon: nope
01:40 AM rue_mohr: it would have made things really easy for you
01:40 AM rue_mohr: sure I told ya twice
01:40 AM anonnumberanon: sure
01:40 AM anonnumberanon: i remember you did too
01:41 AM rue_mohr: just make; make install
01:41 AM anonnumberanon: i made a choice back then to rather understand the compilation steps
01:41 AM rue_mohr: its all in the makefile
01:41 AM anonnumberanon: not understanding stuff and using it kinda makes me mad sometimes
01:41 AM rue_mohr: their not binary
01:42 AM anonnumberanon: alright gonna watch you robot salamander video let's see what that's about
01:58 AM anonnumberanon: cool vid
01:58 AM rue_mohr: do you care about passive compliance now?
02:12 AM anonnumberanon: i still need to make it work for a humanoid
02:13 AM anonnumberanon: you're basically asking me whether or not i care about having shock absorbers on my car =)
02:14 AM anonnumberanon: we can setup a play session on stm32 this weekend if you have time
02:18 AM rue_mohr: I'm asking if you would like the ones you have now, of ones comtrolled by a celleron 500 running windows 10
02:19 AM rue_mohr: "dude, your cars been parked in the driveway running for 2 hours now" "yea, I told it to shut down and its doing an update"
02:40 AM anonnumberanon: my car is still running because of a remote start system i installed on it
02:41 AM anonnumberanon: don't know what chip it uses
02:41 AM anonnumberanon: but i enjoy the remote range of about 500 meters
02:42 AM anonnumberanon: obstacles and walls are its worse enemies
03:46 AM rue_bed: mask = 0x01 << (bits-1);
03:46 AM rue_bed: while (mask) {
03:46 AM rue_bed: if (data & 0x01) result |= mask;
03:46 AM rue_bed: mask >>= 1;
03:46 AM rue_bed: data >>= 1;
03:46 AM rue_bed: }
03:46 AM rue_bed: is pretty good, but not 3 instructions
03:47 AM rue_bed: you know
03:47 AM rue_bed: I suppose if there is no more data, there is no more to do
03:47 AM rue_bed: so, it could be while(data)
03:48 AM rue_bed: ok
04:02 AM mrdata: but if it's while(data), then wont you shift different number of times for leading or trailing 0s?
04:03 AM rue_bed: l00k, it dosn't need to
04:03 AM rue_bed: result is not shifted
04:04 AM rue_bed: (me checks his 2am logic)
04:04 AM mrdata: oh, different problem from earlier?
04:04 AM mrdata: for(i=0; i< nbits; i++) { result = (data & 0x01) ; data >>= 1; }
04:05 AM mrdata: um, wait
04:05 AM rue_bed: no
04:05 AM mrdata: oh i see
04:06 AM rue_bed: you missed, maybe in more than one way
04:06 AM rue_bed: I could claim I didn't need an i, but I have mask, so...
04:06 AM rue_bed: but mine will also cut short if there are no more 1's to be set
04:07 AM rue_bed: and comparing against zero is faster...
04:07 AM mrdata: yeah
04:10 AM rue_bed: #define swapValues(A,B) (A)^=(B); (B)^=(A);(A)^=(B)
04:11 AM rue_bed: if any of my macros are unsafe, thats prolly it.
04:31 AM rue_bed: so, unless I can figure out a way of counting with the bits reversed in the first place
04:31 AM rue_bed: then I think thats the end of that alley
04:34 AM rue_bed: xor with the right shift of the last data?
04:34 AM rue_bed: wtf
04:34 AM rue_bed: WHY CANT I JUST GO TO SLEEP LIKE NORMAL PEOPLE
07:14 PM rue_mohr: orlock, so, I was at the hospital today
07:14 PM rue_mohr: fixing doors
07:14 PM rue_mohr: the instrument tech was in
07:14 PM rue_mohr: asked him if there was an old centerfuge that I could get for a high speed brushless motor
07:15 PM rue_mohr: the pause said a lot
07:15 PM rue_mohr: TURNS OUT
07:15 PM rue_mohr: that he has one, thats about to be changed, he's been putting it off for a while now
07:59 PM Tom_L: rue_mohr gonna get a new spindle motor?
10:28 PM rue_mohr: we will see
10:34 PM anonnumberanon: be like the cool kids get one it's worth the money
11:02 PM rue_mohr: and its free
11:02 PM rue_mohr: matter a fact, the front deck grew 2 inkjet printers today
11:02 PM Tom_L: free is good
11:03 PM Tom_L: stop bringing home junk you have no place for
11:03 PM Tom_L: the place is for a new cnc!
11:03 PM rue_mohr: thats the best part I didn't bring them
11:10 PM rue_mohr: numerical recipies in C, I dont think I'v seen a book this thick, this heavy, be this interesting.
11:26 PM Tom_L: are you baking a numerical cake?
11:33 PM rue_mohr: its helpfull for things like writing fft code
11:33 PM Tom_L: what sort of stuff does the book have?
11:34 PM rue_mohr: programming maths algs
11:34 PM rue_mohr: for all sorts of things
11:37 PM Tom_L: i must have a bug
11:38 PM Tom_L: took a ~4hr nap now i'm ready for bed
11:38 PM rue_mohr: hmm
11:38 PM rue_mohr: I slept thru my alarmclock this morning
11:38 PM rue_mohr: USUALLY means I'm ill
11:38 PM Tom_L: mine never goes off
11:38 PM rue_mohr: (otherwise I feel fine)
11:40 PM Tom_L: incidentally i did _nothing_ on the mill tonight
11:46 PM rue_mohr: :/
11:47 PM rue_mohr: whats next on the schedule?