> On 09 May 2017, at 04:30, Brian Schousek <[email protected]> wrote: > > I'm having good luck achieving microsecond resolution pulse trains using DMA > on a Raspberry Pi at near real-time rates, and I'm confident that with some > optimization this will be workable for step generation with low cpu usage. I > currently have this step generation hacked into a Machinekit configuration > which monitors the trajectory planner position pins. When a loop in Python > detects a change in axis.0.motor-pos-cmd, for example, it queries > axis.0.joint-vel-cmd and creates a stream of n steps at the proper frequency > where n is the number of steps that will fit into my millisecond servo loop.
Python is probably not the right vehicle for realtime tasks (That’s what I always understood). I’m not really sure I understand what you’re trying to accomplish here. Are you developing a hardware driver? Are you making a planner? > > The DMA library I am using is capable of synchronizing sequential waveforms, > so I would like to be able to look ahead in the trajectory planner queue a > step or two and construct the waveforms in advance where possible, which > should help solve some latency issues. I have a few questions towards > achieving this: > > 1) Is there a better mechanism to detect a new trajectory step than > monitoring changes in the position-commanded HAL pin? You could write a component where you add these samples of axis.0.motor-pos-cmd and axis.0.joint-vel-cmd to a ringbuffer. (see delayline component where you can add a number of different type of pins to a ringbuffer). Inspect the ringbuffer samples to detect these changes and calculate your special stuff. Perhaps it’s easier to create a 2nd ringbuffer (than modifying the rinbuffer samples) for playout. > 2) Is there visibility into the trajectory planning queue somewhere? see links below > 3) Perhaps these are not exposed in the current Python bindings; if not, is > there a good example of accessing it via C calls? I’m not deep enough into that, good starting point I guess would be these: https://youtu.be/Bg38894LPPg https://youtu.be/ev_RI4xgzF8 Bas > 4) Are there any other tips on source code areas I should investigate as > resources in putting this together? > > Brian -- website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit --- You received this message because you are subscribed to the Google Groups "Machinekit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/machinekit. For more options, visit https://groups.google.com/d/optout.
