1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. 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!
  3. 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
  4. 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,346
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    2,693Coins
    Ratings:
    +1,043 / 9 / -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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    164
    Location:
    Quebec
    Balance:
    1,630Coins
    Ratings:
    +103 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 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:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 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:
    117
    Balance:
    981Coins
    Ratings:
    +74 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    • Like Like x 1
  16. Shadow Nightmares

    Shadow Nightmares New Member

    Joined:
    Jul 8, 2020
    Messages:
    5
    Balance:
    41Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino
  17. fzxj520

    fzxj520 Active Member

    Joined:
    May 14, 2015
    Messages:
    176
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,341Coins
    Ratings:
    +87 / 1 / -0
    My Motion Simulator:
    2DOF
    Thank you very much!
    Who can publish the details of vnm + odrive?
    [​IMG]
    [​IMG]
  18. Vitor_vtrx

    Vitor_vtrx New Member

    Joined:
    Jan 30, 2022
    Messages:
    2
    Balance:
    23Coins
    Ratings:
    +0 / 0 / -0
    Can I get support for the ForceFeedback-core-library project here?
    I want to use the project with the Keil/Stm32f103 compiler.
    I already have the whole project, but I don't understand how to use the FfbGetFeedbackValue function.
    I didn't understand the parameters.
  19. Vitor_vtrx

    Vitor_vtrx New Member

    Joined:
    Jan 30, 2022
    Messages:
    2
    Balance:
    23Coins
    Ratings:
    +0 / 0 / -0
    solved.