Skip to content

Smoothing of servo PWM - take different loop() speeds into account #7

@falue

Description

@falue

TX sends:
95,100,105,110
-> one integer per 30ms/loop(), but the RX receives each 2ms/loop():
95,95,95,95,100,100,100,100,100,100,105,105,105,105,105,110,110,110,110
-> this will be interpolated as
98,98,98,100,100,100,100,100,103,105,105,105,105,108,108,108
(small steep curves, stair like result) instead of a big curve:
97,98,99,101,102,103,104,105,106,107,108,109110

Solution:
loop of TX takes around 30ms, loop of RX only around 2ms.
either:

  • add ~28ms delay in TX loop (poor choice)
    or
  • only interpolate values every 15 loops() fo the RX
    or
  • only interpolate values when the oldValue != currentValue
    or
  • use time-insensitive smoothing function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions