Shop OBEX P1 Docs P2 Docs Learn Events
Feedback360 Servo with Raspberry Pi4 - Inputsignal vs. Outputsignal — Parallax Forums

Feedback360 Servo with Raspberry Pi4 - Inputsignal vs. Outputsignal

Hey y'all,

I try to record and playback the Inputsignal of my Parallax360° Feedback Servo, using a Raspberry Pi4, Python and the pigpio library. The idea is that I move the wheel of the servo manually and record the pwm signals. Then I want to replay the signals automatically.

My problem is to convert the Inputsignal that is recorded with 910Hz to the Output signal which is transmitted with only 50Hz. The pigpio library offers a "piscope", which is a realtime digital oscilloscope. With the piscope I was able to see that my recordig and transmition of the signals works pretty precise, in general.


I tried to convert the inputsignal to the output signal with this approach:
I'm writing the time (in microseconds) of each high signal with the frequency of 910Hz to a file. Then I sum up 18 highlevels and transmit it to the inpput of the servo with a frequency of 50Hz (910Hz / 50Hz ~ 18). I do that in a row, until all recorded values are trasmitted to the servo.

Now the problem: The motion of the servo by recording is very different to the replayed motion. I'm pretty sure that my basic idea is wright, but there's a secret behind the conversion of the input- to the output signal.
Does anybody know this secret and can anybody please help me?

Thank you very much and best regards from Germany - Marcel

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2020-09-07 21:16
    The 360 servo outputs position information. The (servo) input pulses are speed commands.

    To need to figure out which output pulses will drive the servo the position you previously recorded. The pulses to the servo will need to be constantly changed as the target position approaches.

    First you should figure out how to drive the servo to a set position. This will require constantly monitoring the servo's position while adjusting the speed commands. RPi output pulses to the servo do not correspond to positions. Pulses to the servo control speed.
  • Hi Duane Degn,

    thanks for your quick response!!! I knew that the pulses are a kind of speed commands.
    And from a physical point of view - if I record different speeds over time, in their "time-slots" (=frequency) and I send out these speed commands again over the same "time-slots" it should end in exactly the same motion?!

    The challenge is that the Parallax Servo records with 910Hz and is controlled with 50Hz. So I added always 18 highvalues to convert from 910 to 50 Hz.

    Where's my mistake? I don't get it... I'm grateful for any help!

    Thanks Marcel

  • The pulses to the servo aren't really speed commands; they're power/torque commands. How they convert to speed is dependent on the mechanical load. So it's not possible to record those commands and expect to arrive at the same position every time when they're played back. You really need to record the position feedbacks from the encoder, then send pulses to reach those positions, while monitoring the encoder, using a PID control loop.

    -Phil
  • If I understand what you are doing, you are operating the servo open-loop. You are recording the signal that controls the servo through one "procedure", and then playing back the same set of signals to control it manually. If that is a correct summation, then you needn't use the feedback signal at all.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2020-09-08 20:07
    The signal FROM the servo indicates position.
    The signal TO the servo commands speed.

    You can record the position information from the servo but to reproduce these positions, you'll need a control algorithm which monitors the new positions and provides appropriate speed commands to move the servo to the desired positions.

    If you're only interested in recreated the speed of the original servo, you can record the pulses to the servo and then send identical pulses to attempt to recreate the motion. This can be done with any continuous rotation servo. I used this technique in this robot.

    If you can not record the pulses to the robot and you want to recreate the speed of the robot, you'll need to compute the speed from the position information. Measuring speed from the feedback is kind of tricky because you need to account for the transition from max position to min position (and visa versa). I've done this with Spin but the code to do this does not look pretty.

  • If you want more information about this servo than you want, look at this.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-09-09 03:13
    Duane Degn wrote:
    The signal TO the servo commands speed.
    I think it's better to say that it commands torque. The actual speed or acceleration that results will also be a function of the static and inertial rotational loads. That's why a properly-designed PID loop is so necessary for success with these servos.

    -Phil
  • Duane DegnDuane Degn Posts: 10,588
    edited 2020-09-09 04:14
    So it's not possible to record those commands and expect to arrive at the same position every time when they're played back.

    It's not exact but you can come pretty close. The video below show a radio controlled PropBOE-Bot playing back the previously pulses. The second path is pretty darn close to the first one. Sorry for the poor audio (it was one of the first YouTube videos I made).



    This isn't a good way of doing this but it does kind of work.
Sign In or Register to comment.