1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

News Open source force feed back

Discussion in 'DIY peripherals' started by Hoantv, Oct 2, 2019.

  1. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Joined:
    Jul 6, 2017
    Messages:
    1,002
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,949Coins
    Ratings:
    +832 / 8 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    Hmm. That could work if I had a logitech g27 wheel... but all I have is the g27 shifter and pedals, and they attach and work via MMOS on the stm32f4...
  2. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    @OZHEAT
    PWM and DAC of mode 0..50..100 was fixed in V0.19.2
  3. llluis

    llluis Active Member Gold Contributor

    Joined:
    Mar 30, 2017
    Messages:
    131
    Location:
    Quebec
    Balance:
    1,548Coins
    Ratings:
    +97 / 1 / -0
    My Motion Simulator:
    6DOF

    Yes I can confirm this works. No power supply needed. I was doing this right before selling my G27.
  4. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    Great, thanks for the update.
    I will test and get back to you.
    Not having support for native g25/g27 shifter is not a big deal breaker and getting the fundamentals of the wheelbase workng is more important anyway.
    • Like Like x 1
  5. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    yes. the hardest is the wheelbase. other is easier :)!
  6. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    I have been testing 0-50-100% mode
    Analog
    PA4 0.048-1.471-2.900
    PA5 1.460-1.463-1.466
    It is working ok maybe PA4 50% is not the same value as PA5 2048?
    PA5 drifts a bit but we are talking 6mV, maybe just set the value once instead of at each cycle.

    Digital
    PE9 0.002-1.467-1.434 but there is a definite glitch in the calc as:-
    ccw is ok as 0.002-1.467 (0-50%)
    cw is incorrect as it gets 1.467 (50%) - 1.520 (~51%) 0.002 (~52%) 1.434 (100%)

    It seems that you haven't implemented stop force yet, when wheel travels past wheel limits it looks like it just sets 0.048 on either limit.
    While it is ok in pulse and pwm mode as the wheel just goes in to freewheeling(0.048) it would be dangerous in 0-50-100% mode as if you over travel in cw it would command full cw and you it could cause someone to break their wrists, think of it like you are resisting the CW direction then over travel and then all the sudden the wheel goes in to full ccw(0.048) ouch!!. The correct command would be full CW (2.900).

    Also think about implementing in configuration setup to either have digital or Analog selection, no need to have both at the same time.
    It maybe causing the analog drifting.

    Anyway keep up the good work, you are definitely getting there.
  7. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @sedesa tatasa
    I guess I should say DXforce value.
    Out of a +/-10000 force value MMOS only utilises around +/-3000 any more and it will just clamp the output.
    Look at the clip LED connected to PD15
    Last edited: Jul 22, 2020
  8. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    Hmm, that is strangle :
    1) Digitial:
    Found problem in a formula => Solved in V 0.19.3.
    2) Analog:
    dacTotalForce = map(dutyCycle, -pwmPeriod, pwmPeriod, -4096, 4096); => calculate DAC value.
    Same as digital, only mapping from [-4096, 4096] to [0, 4096]
    HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, (uint32_t) map(dacTotalForce, -4096, 4096, 0, 4096));
    HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R,
    2048);
    So if torque = 0 => it is mapped to 2048, same value as PA5.
    =>Which is max value in CCW and CW? maybe i misunderstood this.
    At the Stopforce:
    stopforce = (current encoder - max encoder)/(encoder ppr /9) * Stopforce configuration in GUI (around 10 degree)
    Totalforce += stopforce
    So it doesnt increase suddenly to maximum value. Stop force is configured in GUI.

    "Also think about implementing in configuration setup to either have digital or Analog selection, no need to have both at the same time.
    It maybe causing the analog drifting." => Yes, as i said before i will make 2 option. only choose one => after configuration DAC, PA5 is set outside loop, maybe value it does not change to much :)!
    Last edited: Jul 22, 2020
  9. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    I will add enhance to the firmware but display on LCD to show which effect is clipping.
  10. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    When I go past wheelcheck +/-10000 position the output will go to 0.048v

    To tell you the truth I don't see the function of the clipping as it shouldn't clip, the controller should be able to handle effect values +/- 10000, game clipping is different
  11. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    => increase sudently to maximum value?
    stopForce = setupWheelbaseConfig_Report.stopForce
    * (abs(motor.encoder.currentPosition)
    - motor.encoder.maxPosition)
    / (motor.encoder.PPR / 9);
    totalForce = wheelController.ffbEngine.ForceCalculator(
    motor.encoder)
    + stopForce * (motor.encoder.currentPosition)
    / abs(motor.encoder.currentPosition);
    This is the formular. It only increase suddenly if you rotate the wheel too fast more than update freq. but the update freq is 30kHz. So it can not increase suddenly.

    To tell you the truth I don't see the function of the clipping as it shouldn't clip, the controller should be able to handle effect values +/- 10000, game clipping is different
    => in firmware, it already handle ffb in [-10000,+10000]. you said game clipping is different from clipping in firmware?
  12. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    Now 0-50-100 digital is working properly and will stay at max when overtraveled, not in analog still goes to 0.048
    In force configuration-stop force it makes no change when wheel over traveled.
  13. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    I have rewriten endstop maybe fix the issue, the current version is v0.19.4
    • Like Like x 1
  14. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,389Coins
    Ratings:
    +102 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    Great, will try it out and report back.
    cheers
    • Like Like x 1
  15. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    107
    Balance:
    873Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    • Like Like x 1