Integrated Motion
Items : 0
Subtotal : 0,00 
View CartCheck Out

Speeding Up Serial Encoder Service

Home Forums SOMANET Software Motor control software Speeding Up Serial Encoder Service

This topic contains 1 reply, has 2 voices, and was last updated by  Jauri Gofre 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #16410


    Currently I am reading an SPI sensor that is used as feedback for my motor controller. When I request the position feedback from the sensor, it calls read_position from serial_encoder_service which then calls readRotarySensorAngleWithoutCompensation from rem_14_encoder_service. I’ve modified the rem14 encoder service to communicate with my SPI encoder.

    This works, but the problem is, it slows down my control loop. Each iteration of my control loop it has to wait until 3 bytes are sent/received between my encoder, which causes delays. Instead, I would like to have the service updating the feedback as fast as possible, and upon request from the position feedback service, I can get the latest encoder value. That would allow my control loop to run a lot faster and more deterministically.

    I’m struggling with the implementation. Should I use the par{} feature on the rem_14_encoder_service side, and split the execution into two tasks (task1 continually polls the sensor and updates the position, task 2 has an event structure for returning the latest position)?

    Any help would be appreciated


    Jauri Gofre

    This issue was followed up by our support team directly with you.
    We answered then that using a par{} structure would not solve the problem, as the two processes would still share the resources, so the control loop would still have to wait for the SPI communication to end.
    Instead, we proposed to take a look at the UpstreamControlData structure, where the position variables of the position feedback tasks are updating a shared memory.
    This structure is always updated with the latest position measured.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.