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 Download Package Now!
  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 here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

New XPID software for Arduino UNO/Mega and Sabertooth (with LCD !!)

Discussion in 'SimTools compatible interfaces' started by vthinsel, Apr 1, 2015.

  1. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Thanks @vthinsel for clearing out that. I think we are on the way, by sorting out these small issues the Sabertooth will become better and better. Still the annoying behavior mentioned in my thread should be solved and then nothing will stop anymore *optimistic* lol
    • Like Like x 1
  2. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    I'll double check that but I do not have specific directions. I'll try to reproduce it, so I can fix it.
    Meanwhile I have an almost ready-to-release version, with TFT.
    In this short video you can see it in action, and how tweaking the K (same as P, but wider scope) affects the motor response. You can even hear it : with a low K (0,1) the motor moves slowly and silently, and with K=1, the motor moves more quickly with more noise. You can also see that on the graphs (sorry for bad quality of the filming)
    3 lines are graphed per motor : RED = motor power, GREEN = current position, BLACK= target
    Of course, displaying the graphs has a small impact on responsiveness (graphing takes 4ms) but can help in tuning/troubleshooting : you can actually see noise on pots input. Maybe I'll make some zoom/autoscale and add graphs pages as per your requests :)
    • Informative Informative x 1
    • Creative Creative x 1
  3. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    @Pit , I have a possible improvement for your outstanding issue: in ParseCommand() can you replace the following code portion (use a constrain instead of a map which I thought would provide more accurate results)

    if (commandbuffer[0] == 'L') //Set motor 1 position to High and Low value 0 to 1023
    {
    M1.setTarget ( (commandbuffer[1] * 256) + commandbuffer[2]);
    //M1.setTarget(map(M1.getTarget(), 0, 1023, M1.getMin(), M1.getMax()));
    M1.setTarget(constrain(M1.getTarget(), M1.getMin(), M1.getMax()));
    disable = 0;
    return;
    }
    if (commandbuffer[0] == 'R') //Set motor 2 position to High and Low value 0 to 1023
    {
    M2.setTarget((commandbuffer[1] * 256) + commandbuffer[2]);
    //M2.setTarget(map(M2.getTarget(), 0, 1023, M2.getMin(), M2.getMax()));
    M2.setTarget(constrain(M2.getTarget(), M2.getMin(), M2.getMax()));
    disable = 0;
    return;
    }

    And also change the SetPWM with that one

    void SetPWM()
    {
    M1.PIDUpdate();
    M2.PIDUpdate();
    if (disable == 0) {
    ST.motor(1, M1.getPower());
    ST.motor(2, M2.getPower());
    }
    else {
    ST.motor(1, 0);
    ST.motor(2, 0);
    }
    }

    Of course, be carefull ;) with the walls.
    • Useful Useful x 2
    Last edited: Oct 30, 2015
  4. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @vthinsel any updates on your code? In the meantime I tried the SMC3 code however without success (no power output on the ST). Today I wanted to flash back the Ard and I got some strange behaviors, f.eg. the M1/M2 deadzone is 256 by default (?), I cannot save any new values...every time when I change the value it increases about 256 after saving. Ard UNo and MEGA are both "affected".
    Other values I can set as usually.
    Resetting the Ard does not change any values.
    Global values same behavior, these are the standard values after flashing:
    Read analog = 256(?)
    Feedback Max = 4281(?)
    Feedback Min = 255(?)
    etc.
    Either I got crazy or both Ards are damaged or whatever else happened. So I ask you kindly if there is any update. Or you would kindly bundle all the newest files because the first posting is out of date so other members will run into any issues about that as well.
    Thank you.
  5. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    Strange. The values have always been stored in the EEPROM at the same location. Maybe the values are out of the normal range, due to some other code and as I check for value range upon update...
    Did you try the reset function, in the global settings menu ? This should put default values in allowed range.
    • Informative Informative x 1
  6. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Hi, this works for me, now all values are within the standard range.
    • Like Like x 1
  7. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    hmm, I uploaded XPID 311, updating now with 313 gives me the following error:

  8. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    I'll have to write a user guide someday..... I'll also update the code to address those strange values to make it more robust in such cases
    • Like Like x 1
  9. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    Hummm. I'm still running version 1.6.5
    I guess you upgraded to v1.6.6 recently. Maybe you should re-install libs, including the menubackend justto make sure.
  10. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    By the way, I have updated the first post with the latest version 1.13 (sorry, I didn't do it earlier).
    This version will be the last one to support LCD : next versions will be only for TFT+touchscreen and Arduino Mega. I will not add new features to this version; I'll only provide support and eventually bugfix it if needed (1.13a, 1.13b, ....)
    TFT dev is going smooth and I should have something ready soon. Get a TFT+LCD, it will be of some use soon :rolleyes:
    • Like Like x 1
  11. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Which model you would propose to buy?
    Thank your for the suggestions, I will downgrade the Arduino software and follow your steps.
    Apropos support - in case of new inexperienced Sabertooth users I could relieve you a little bit like I did on SMC3.
  12. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    Aren't you already running 1.13 ?
    Thanks for the support :)
  13. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
  14. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Version is 311...I am confused...the newest is 313, isn't it?
  15. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
  16. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Update: Arduino 1.6.5 did the job. Waiting for TFT touch screen...
  17. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
  18. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    373
    Location:
    FRANCE
    Balance:
    4,889Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    Hum. This will be interesting. The one I use is 320*240. Yours is 240*400. So hopefully the last 80 lines will not be used (I use it in portait mode). I just hope it uses the same lib and has the same chipset....
  19. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    OMG I am stupid - the libraries! I forgot that point.
    PS: i canceled the order.
    Last edited: Nov 23, 2015
  20. Pit

    Pit - - - - - - - - - - - - - - - - Staff Member Moderator Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    2,999
    Location:
    Switzerland
    Balance:
    29,417Coins
    Ratings:
    +3,007 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @vthinsel yuppie :)
    20151204_104940.jpg
    BTW the display is not really sticked on the shield ?!? I have to fix it before the display will snap