--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/528D020F.3010708%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
You get one (or more?) Ground Control Stations making it easy to configure, monitor, etc. wirelessly
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/257e58f8-2b74-4abb-a383-9d1298285d9a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/6c18af01-7bbe-404a-addc-3a1b44a1aa9d%40googlegroups.com.
Yes, but what's the fun in that?
For me, the whole point of the AVC is not to compete against others (although that's fun, too), it's to have a reason to experiment with and learn new things.

On Wed, Nov 20, 2013 at 10:40 AM, Michael Shimniok <shim...@gmail.com> wrote:
Have you started thinking about / working on your AVC entry?
Are you going to use APM:Rover (ArduRover) ?
If you already have code like me, why not switch?
APM:Rover has a lot to offer. You get MAVlink telemetry. You get one (or more?) Ground Control Stations making it easy to configure, monitor, etc. wirelessly. I think you get Hardware-In-Loop and Software-In-Loop testing ? Lots of support. Probably a bunch of stuff I'm forgetting.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/528D020F.3010708%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAB%2BjonDKauVj6ejwW3m9ytAxTfo0RqsZKtToJDhN4LDR62CLjA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/a24c486d-23d6-411e-aea5-5b9f7146719b%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/528F9011.5080203%40gmail.com.
Another nice board at the Cortex-M3 level is the OpenCM9.04. Its most amazing feature: It's only $10!And while it doesn't have hardware floating point, it can still do almost a thousand full IK solutions for my four-legged walker per second, which is more than I need :-)
The board uses the STM32F3.
Another nice board at the Cortex-M3 level is the OpenCM9.04. Its most amazing feature: It's only $10!And while it doesn't have hardware floating point, it can still do almost a thousand full IK solutions for my four-legged walker per second, which is more than I need :-)The board uses the STM32F3.The F4 / M4 level is nice, with its FPU, I have to admit, if you have a need to use it. But, if you have those needs, the step up to the gigahertz/multi-core/linux based boards really isn't that far... and then you lose the real-time microsecond timing. I think that the "two computers" solution of something beefy, and something real-time, is a pattern that will stay with us for a long time.Sincerely,jw
OpenCM9.04 however is a STM32F103
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/ea5cf2c0-f7af-4091-b72e-af5cac5f4dba%40googlegroups.com.
Yes, I've been looking at the APM:Rover code and it is very sophisticated (I'm surprised that it fits on an arduino -- there's a LOT of code there!). I've already found some things that I want to borrow from their code.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/f393b214-cd90-4396-b742-a7a2594c2471%40googlegroups.com.
Being the newbie here ... Pixhawk does not seem to be cost effective. For $199 you get A Gyro/Accel/Compare system with a Cortex-M4 (the rest is not that useful for rovers). That is about the same as you get off the STM32F303 Discovery board, or the newer STM32F401 Discovery board (each less than $15).
On Tuesday, November 26, 2013 11:36:22 AM UTC-7, JP B wrote:I say this from a purely ignorant point of view - interested in benefits any other hardware platform may offer over the forthcoming 3DR pixhawk platform, which I can see the community taking forward with new software features whilst fixing the offering able to run on current APM hardware. Looking ahead, going with the pixhawk which will attract an existing developer base is an attraction.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/1a27fa66-c40d-4c5d-9696-af5e2b65406b%40googlegroups.com.
Also been thinking about QRE1113 breakout boards with Schmitt triggers.
Or maybe the Schmitt triggers would go on the quad decoder board. Can't
decide.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/5295259A.5040809%40gmail.com.
Why DIP? Because I'm not tooled for surface mount. No hit air, no parts bin, and what solder paste I have in the fridge is way over date...
I have actually built a six-channel "step direction" decoder based on an Atmega, and it can do about 170 kHz doing just polled I/O and serial output. I've also done a Tiny-based decoder, but it is more finicky because of the lack of hardware peripherals (the USI isn't exactly "low maintenance.")
More importantly, the signal conditioning needed would be nice to get on-a-chip. Take a look at this output from the quadrature encoder on the Pololu 37D gearmotors:
The spikes are after filtering with a 4.7 uF ceramic capacitor, and are in phase with the PWM driving the motor. The encoder electronics itself are driven by a well regulated 5V rail with 470 uF reservoir capacitor.


That's been a challenge when I've rolled my own. Using what's built into the RoboClaw motor controllers seems to work for me, though.
It took a bit to get my A2D board's I2C via USI going
where do you think the spikes are coming from? Something to do with flyback from the motor?
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/52962809.5010906%40gmail.com.
It took a bit to get my A2D board's I2C via USI going
The main annoying thing is that you'll likely lose pulses with a software implementation.
where do you think the spikes are coming from? Something to do with flyback from the motor?
I don't know!
In the start, it's the same battery, but the power is split off to motor controller+capacitor on the one hand, and regulator+capacitor on the other hand. When the motor controller drives the motor with PWM, I see those spikes. It may be a ground reference problem, perhaps... or some coupling somewhere.
The actual connections are in a small wiring board I made (very thick traces), so battery into roboclaw, roboclaw motor back out to board; to motor/encoder connector motor power; separately on the same board battery into 5V regulator, to motor/encoder connector encoder power; encoder outputs back to RoboClaw.There is a shared ground between RoboClaw and battery and encoder, because of the encoder channel ground reference, and this is the same as battery ground.
That is an issue but... I looked into this just now and it appears solved for the ATtiny. I think I can build this without losing a single pulse count at least within certain limits. Wayne, Jon, others, see what you think of this:On 11/27/2013 12:19 PM, Jon Watte wrote:
main annoying thing is that you'll likely lose pulses with a software implementation.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/52965829.50909%40gmail.com.
For an ATTiny running at 8 MHz, that leaves 80 clocks cycles per interrupt to handle the interrupt, which is far mor than you'd need to count the tick in a well-coded assembly language function. And, that's absolute worst case.
Now, you could use the USP peripheral to send the data to the main CPU, but it's not necessary, IMO. SPI is a completely asynchronous protocol, as everything is relative to the clock transition. So, it doesn't really matter if the shift out gets interrupted by the quadrature ticks. The data will get through anyway.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAB%2BjonAE%3DCmHwuiUf58cTAZ-zDZ6CEFZCxc2p%2BwsWrguzxKXaA%40mail.gmail.com.
Hey, that's not a bad idea! You would lose some resolution though. Don't you need to check both rising and falling edges? Say your encoding is: 00, 01, 11, 10 [, 00, 01, ...]. And you are watching the second bit and it is at 01. Going forward it next rises when it wraps all the way around to 01. But it could also have dropped back to 00 and then forward to 01. You can't tell which, unless you watch for falling edges.
Probably everyone knows this, but if you are coding in Arduino, don't use the digitalRead (or digitalWrite) functions, they take something like 60 clock cycles when the same operation can be done in 2 cycles. It is ridiculous. But they don't seem to have any interest in fixing it -- probably because it would make the code a little harder to read.
How are you doing the polling? How do you avoid missing state changes (ie, when USI interrupts fire)?
with interrupts the hardware syncs to the clock, so 62.5ns at 16MHz
I kind of have to if I'm going to try selling 'em. I'm forced to fret over $0.20 on my designs. :)
If the Mega32 (or other megas) have dual external event capture
Michael
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/5297E25D.2070707%40gmail.com.
How are you doing the polling? How do you avoid missing state changes (ie, when USI interrupts fire)?It is *all* polled. No interrupts. Poll everything once during the main loop, with a state machine for the serial communication.
with interrupts the hardware syncs to the clock, so 62.5ns at 16MHz
The actual interrupt latency is higher, because the CPU needs to save registers. Arduino library does a lot more work in the interrupt handlers, and thus has much suckier latencies than this, btw.)
--On Thu, Nov 28, 2013 at 4:39 PM, Michael Shimniok <shim...@gmail.com> wrote:On 11/28/2013 04:08 PM, Jon Watte wrote:How are you doing the polling? How do you avoid missing state changes (ie, when USI interrupts fire)?
My goal is to read 8 channels (4 quadratures.) If I use interrupts for each transition, and the interrupt-handle-return time is 4 microseconds, then the maximum rate I can run at is 30 kHz or so, not counting communications. With polled input, I get closer to 200 kHz because I lose the overhead.
It's only necessary to have interrupts on half the channels. For each quadrature pair, interrupt on rising edge of one channel and check the state of the other channel in the handler to get direction.
I was thinking along the lines of using one ATtiny?? board per wheel or at best one board per pair of wheels.
At 200kHz, timing resolution is 5usec whereas with interrupts the hardware syncs to the clock, so 62.5ns at 16MHz. I bring this up because I found that speed calculations worked better when comparing intervals between edges.Not necessarily. True, the only thing you have to go on, really, is that the master is "supposed" to send a NACK on the last requested byte. The code I'm using checks for that in the overflow interrupt handler, and resets the hardware to wait for start. So it expects the master to behave itself. :)
The USI is also annoying because it doesn't have a stop condition detector for slaves. Thus, there's nothing that will tell you that the master is "done" sending. Thus, too, means you have to start doing polled USI.
Undestood :) I kind of have to if I'm going to try selling 'em. I'm forced to fret over $0.20 on my designs. :)
The Mega32 is only a little bit taller than the Tiny84, and only a buck more expensive, and has peripherals for all of the communications, so I'd probably save myself the hassle of cost optimizing this :-)
If the Mega32 (or other megas) have dual external event capture tied in with 16 bit timers (like the Tiny841 I ran across) and they also have TWI that'd be ideal. If not there's probably a PIC or ARM or something out there that can do this. I am pretty sure the LPC1769 has multiple input capture pins so I would probably continue to do this on the main MCU in my preferred design.To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/5297E25D.2070707%40gmail.com.
Michael
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAJgyHGPVwQf7dwMXv1SGFjfahkyyU0bWOVGOUMHQLTHRB6izQg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/1B83E1F5-D4FD-4B3D-9FF8-5CEBEA1BBDFC%40gmail.com.
Michael
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/5297E25D.2070707%40gmail.com.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAJgyHGPVwQf7dwMXv1SGFjfahkyyU0bWOVGOUMHQLTHRB6izQg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/cc4692c9-2f42-4dcd-b5f7-b63a2e29b591%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/6b6d4c4f-3407-4275-9cdb-b78320587872%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/16E96F51-F849-434F-8481-EDCFA8C839F9%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CANqFZg3XBJG61AZNHCT-F_AjPRfRJLDqEWh2Jdt%2BgZ2WK92UGA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/85f85c57-96d1-473a-a8b0-d4fc0bc4a38a%40googlegroups.com.
any error in reading the quadrature pulses, either a missed pulse edge or noise on the line, causes the quadrature algorithm to flip direction and start counting backward.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/46661F76-2AE9-4248-8F00-9CEBA9CD5E84%40gmail.com.
any error in reading the quadrature pulses, either a missed pulse edge or noise on the line, causes the quadrature algorithm to flip direction and start counting backward.That doesn't make sense to me. The direction is encoded in each individual state transition, so if you miss something once, you may back up for that count, but then keep counting forward again. There is no "state" other than "what was the previous quadrature output?"So, given that there are two bits of previous output, and two bits of current output, there are only 16 possible transitions; 4 of those are no-ops (no change,) 4 are "backwards," 4 are "forwards," and 4 are "impossible" (as in both bits flip at the same time.)Even if you get a wrong flip once, because you read the state of the encoders and keep that as the "previous state," you will immediately re-synchronize.You can only lose "direction" if you had a systemic error that gave the same glitch for each increment, which seems like a bigger problem than just a glitch :-)
Interesting. Thanks for the great explanation.I had reduced my quadrature state machine to one with only two states and four transitions, which could be implemented using only pin change interrupts without ever reading the actual value of the encoder outputs. Worked great, and i still think it is technically correct, but I now see that it is highly intolerant of errors.If implemented in the standard way as you describe, with the value of the encoder outputs read on each interrupt, the correct state would indeed quickly re-sync after an error. Much nicer. So yea, I was doing it wrong.
Okay, so I've done something similar, and had a concern that something could go wrong when not actually ever reading the pins, but I never stopped to figure out what the problem was exactly. Thanks for the explanation. This is what I had:void ISR_LA() {if (la_state == lb_state) left_count--; else left_count++;la_state = !la_state;}void ISR_LB() {if (la_state == lb_state) left_count++; else left_count--;lb_state = !lb_state;}void ISR_RA() {if (ra_state == rb_state) right_count--; else right_count++;ra_state = !ra_state;}void ISR_RB() {if (ra_state == rb_state) right_count++; else right_count--;rb_state = !rb_state;}Ted
I don't have my code in front of me, but I think this is exactly what I was doing. On startup, you read the encoder outputs to "sync" the initial states so it starts counting in the correct direction, but never again after that. The problem I experienced is that any errors cause the state machine to lose sync, and start counting in reverse. Fun!Still, I don't really like the idea of having to read the encoder outputs in the interrupt, both for performance reasons and for the possible race condition. Can this be done without a read? Maybe using two pins/output line and and interrupting separately on rise and fall?
Still, I don't really like the idea of having to read the encoder outputs in the interrupt, both for performance reasons and for the possible race condition. Can this be done without a read? Maybe using two pins/output line and and interrupting separately on rise and fall?
Still, I don't really like the idea of having to read the encoder outputs in the interrupt, both for performance reasons and for the possible race condition.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/a3dc933c-141f-4018-b549-c7ba88730731%40googlegroups.com.
Still, I don't really like the idea of having to read the encoder outputs in the interrupt, both for performance reasons and for the possible race condition. Can this be done without a read? Maybe using two pins/output line and and interrupting separately on rise and fall?Reading the pins isn't a huge time waster on AVR (or probably same on most MCUs). You can use the test/skip instructions for testing bits in IO registers, something like this (for determining direction):ldi r24, lo8(0) /* r24 = 0; 1 clock */sbic PINB, 1 /* testing bit 1 of PINB, PB1, 2 clocks */ldi r24, lo8(1) /* r24 = 1, 1 clock */sts direction, r24 /* direction = r24, 2 clocks */The longest path through this is 4 instructions, 6 clock cycles 0.375µsec at 16MHz (62.5ns/clock). The time required to figure out what state you're in and change that state to the next one is probably similar.Incrementing a 16 bit value takes 5 instructions:lds r24,counterlds r25,(counter)+1adiw r24,1sts (counter)+1,r25sts counter,r24There's time required to push/pop values... you can minimize that I think.
I can't seem to think of a race condition that could occur on a single channel. Did you mean on multiple channels?
Still, I don't really like the idea of having to read the encoder outputs in the interrupt, both for performance reasons and for the possible race condition.The read is a single instruction. The race condition isn't appreciably worse than you get from the interrupt latency anyway. Any encoder reader will have an upper frequency beyond which it cannot keep up. When you read the input bits, this will show up as an "impossible" transition, which you can detect and do something about (turn down speed, emit a fault, etc.) When you just count interrupts, you will not detect when the encoder runs too fast, so no possibility of recovery.That being said, with typical interrupt latencies, you'll have to run at a speed of over 10 million steps per minute to get to the point where you start seeing this, which is unlikely with most motor/encoder combinations. The Pololu 37D motors, with 64 transitions per motor turn and overdriving the motor to 10,000 rpm, you'll only do 640,000 transitions per minute, so a headroom of about 93% is good enough for that case :-)Regarding using single encoder channels: You get a "tick" (a k a an "index") but you can't reliably use this for things like PID controllers. For example, if you command the robot to stand still, but it's on a slope, you will not know whether the ticks are coming in because it's sloping forwards or backwards.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/004edad5-e606-432c-9704-66746e5b5206%40googlegroups.com.