no pwm pins, no dir pins, and no encoder pins left on the Arduino any more, everything already in use.
( 2 motors = 2 pwm pins plus 4 encoder pins plus 4 regular digital pins)
and then for odometry the data transfer is to slow.
yes, that's what I meant to say: the Arduino just gets "high level commands" from the Raspi for all over 6 motors: on/off, fwd/reverse by pwm, rotate relative degrees, rotate to encoder target and then stop, optionally then coast, optionally then hold position, the rest of the functionality is alrea...
ps, the problem for external hardware controllers is: I ALWAYS need to have the values all at once for further processing on the related computing platform, e.g., for odometric position calculation (drive wheel motors) or for quick PID loops for exact and quick robot arm positioning. 6 motors on the...
I tried already, but the Arduino code is designed for timer interrupts (at 50µs, 100µs, or 250µs intervals) and this polls all pins at constant intervals using sort of bit and-ing/shifting algorithm. I tried to mimic that on my Raspi by a constant time loop in an extra pthread task, but too many cou...
to be honest, I don't see through this code, it's a little (actually quite) confusing to me. I need just the encoder reading and calculation in the background or by 1 dedicated pthread task, and then an extra task or loop in main() which displays the values on the screen like for (;;) { if (counter ...
thank you very much, I'll try then this one next! // encoder.c // Test code for incremental rotary encoder on Raspberry Pi //tested on B R2 Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux // http://www.sparkfun.com/products/10982 // No licence, no warranty, free ...
thanks for your input. Of course I see that that a Raspi has severe performance problems to handle this, but 360/rev for 2-3 motors is indispensible to use the Raspi at all. ( I am controlling another 6 encoder motors already remotely by an attached DUE via UART, aditionally, but there are all over ...
I have optical encoders, there are no significant bouncings at all (you perhaps missed that detail), and on Arduino I can read up to (tested) 7*720 = 5000 encoder counts per second , by double resolution (7 revolutions at 720 counts/revolution, per 1 sec), for all over 8 encoder motors simultaneousl...
thanks for your input! so what would you suggest for 360° (1/2) instead of 180° (1/4) resolution which would work perfectly then (360 counts for 1 rev for calculating is accurate enough and makes calculations easier for odometry as 1 encoder count == 1 dregree, not 2 degrees, and not 0.5 degrees in ...
Davenull, I have received several complaints about your behavior, do I have to close this thread too? please behave better! you seem to act as that what you claim to hate! I'm just reacting to OT spamming and trolling posts, and I have already reported the spam and troll posts to be removed. Anyway...
(edited:) yes, I am, and yes, it's an optical encoder. I removed the debounce and now it's counting about 180° per revolution, not 360° , but even for quicker rotations, mostly accurate, but NOT for higher speed at >=3 rev. /sec. . If so for faster rotations, then again counter ticks are missing. ac...
thank you Gordon, I tried that immediatly, but it's also counting not quick enough. By your coding, for a whole revolution at 1° resolution instead of 360° now just 220° can be detected, even at a very slow rotation speed (1 revol./sec) , which is even less than by my pthread and bitshifting approac...
yes, thank you, the volatile thing once was established during a longer development period from my first attempts of Arduino codings (which also are gpp C/C++ based nevertheless, and on that platform everything compiled fine). Perhaps, apearently, it's outdated and obsolete now. FTM I just exchanged...
in short words, yes, I have tons of code written for Arduino Sketch targeting both AVR (Uno, Mega) and ARM cpus (Due, partially Zero) and the Arduino language plus it's 3rd party libs are partially designed peculiarly quite strange. Finally Arduino language IS not C but USES C, by gpp C/C++ and a lo...
thank you, Paeryn, that was very helpful, especially about -pthread and -lpthread. The other references are more complicated than I expected them to be but at least give me a guidance to keywords I have to look at more closely, maybe I will then see more clear. Finally for me as a former programmer ...
now this code seperating the pin reading task from the values screen-writing task is still too slow. When 360° should have been read, it's just < 300. using usleep(20) instead of 50 doesn't make it better. // encoder test // #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <math.h...
please do it, the earlier, the better! you do not know how much I hate nitpickers, pedants, and sticklers ! (or perhaps you even do, but I don't care...) I keep stuck to what I said the binary thing is fine and I want to keep the code compatible to my Arduino code which works absolutely perfect and ...
no ideas by anyone? I just needed the answers to the 3 questions (2-4), very quick, very short, and very simple, would this not be possible ? 2) is it useful to link by -D_REENTRANT additionally for Raspberry Pi? 3) how is it possible to immediately stop or kill 1 task by main() or by another task ?...
for Arduino the cross compiler is as simple like a walk in the park, and even for the EV3 running TI daVinci Linux the BCC cross compiler is peanuts to work with, both running on Windows, both for compiling, linking, building, uploading, remotely start running, just by a 70ct USB cable... it's just ...
jamesh, to me just code compatibility to my own code was my demand, I didn't expect to be taught in a lecturing attitude - and didn't ask for that - about theoretical compatibilities or portabilities which do not affect me. I just wanted to make my Arduino code work by B00001100 or sth quite similar...
hell, what a mess with C++
one should be able to configure this issue by compiler settings to ignore this nitpicking mess but instead making it work like for ANSI C and just compile, either with or without warning .