[C++] proposal needed: ramp up/down for smooth acceleration/deceleration?

we would probably need then a scalable linearized list of motors and a motor structure providing a thread ID, eg.:

typedef struc {
   pthread_t tid;
   int  rampupaccel;
   int  rampdndecel;
   int32_t   setpoint;
   int  maxspeed;
   //...a.s.o.
} tEncMotor ;

tEncMotor motor[MAXMOTORS];

void * PID_ramp (void *arg) ; // (forward)

pthread_create( & motor[nr].tid,      // store ID in the related Array-Element
                0,                    // Default Attribute (threads to be canceled)
                PID_ramp,             // Name of the PID-calculation routine
                (void *) nr);         // Index of Array-Elements for a  PID structure,
                                          // identcal to Motorindex 
   
// run pthread task in detached mode, then auto-cleanup                                   

pthread_detach(motor[nr].tid);

Hell, that would end up in a source code long enough to sink the USS Nimitzā€¦ :-/

Iā€™m pretty sure you can do it all in one loop, and the loop doesnā€™t even need to be dedicated to updating the motors (as long as the loop runs maybe 25+ times per second). That means you donā€™t need multi-threading to control the motors similar to how I described, even if there are 10 motors that simultaneously need to be limited (ramp up/down).

tbh, that entire task with PID and ramp and multiple motor control is too complicated to me, I think Iā€™ll wait until itā€™s implemented to the SAMD firmware, something similar like EV3Basic or LeJOS do it or did it for Mindstorms.

is there meanwhile an update to ramp-up/down, something similar like EV3Basic or LeJOS do it or did it for Mindstorms NXT and EV3 (X3, NXT-G, NXC) ?

There is no update on this. The feature might get implemented into the firmware at some point, but itā€™s not a priority since the functionality can be achieved in user code.

no, it actually canā€™t be achieved - the only way I could imagine are complicated detached threads for each single motor, thatā€™s way too cumbersome. In all Mindstorms firmwares for NXT and EV3 (even 3rd party OS like leJos or ev3dev) this feature is integrated from the start, it works out of the box, and is indispensible for BrickPi3, tooā€¦