Joystick servo control using BOE

2»

Comments

  • Tom:

    Just to be clear on the edits, can you summarize what I have to change in the program between the 2 responses you provided?

    Regards,

    Alex
  • Replace the RCTIME(s) with no joystick with a PAUSE 1. The corresponding axis will follow the joystick read previously.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
    Cool, CA, USA 95614
  • The problem with RCTIME with no joystick (or RC network) is that it takes a more or less arbitrary time to execute and returns a more or less random value. That confuses the rest of the program, as well as making it no longer real time responsive.

    So here is a version that enables axis 1 and 2 and disables axis 3 and 4. It also has the gain cranked up to 7.5. Note it is for bs2px, just change to bs2p.

    As it is, it should run axis 1 and 2 with your joystick just fine. You can modify AxnPSMid individually for each axis to center the servo with the joystick neutral, and you can modify AxnGain to get full limit-to-limit movement of the servo. Each axis has both values individually. If you have servo three and/or four connected, they should go to about mid-potion and stay there.

    Once everything is nice and smooth and you get your other joystick wired, you can fire up axis three and four. I would do this one axis at a time.

    For each of axis three and four, uncomment the RCTIME and comment out the PAUSE and the JoyValue = . When you have done this, they should look like axis one or two. Once they are working you can adjust the center position and the gain like you did for one and two.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
    Cool, CA, USA 95614
  • Excellent! Thanks Tom, will give it a try!

    Regards,

    Alex
  • Hello Tom

    Everything worked very well! I got ports 14 and 15 working as well. I setup (2) slide pots as a substitute for the joystick until I receive it which should be early next week. I have attached a picture of the setup so far. I am using 23 turn 1K trim pots as well so I can match the speed of the thruster for parallel units (real fine tuning of speed). I will be replacing the servos with Phoenix EDGE HV60 ESC's which will be connected to the thruster motors for thrust control. I should have everything next week for testing with the actual ESC's and thrusters.

    The only question I have on the code (which is brilliant by the way) is adjusting the gain in Hex..is there a standard formula for changing the hex values? The gain you added is a VERY helpful feature and will allow me to fine tune the max thrust speed via this setup vs. the firmware on the ESC's.

    [img][/img]



    1328 x 747 - 313K
    1328 x 747 - 423K
    1328 x 747 - 441K
  • Glad to hear it is working.

    The AxnGain constant can be though of as a real number. The first two digits are an integer; the second two digits are a fraction whose denominator is 256. They are both hexadecimal. Thus $0780 is 7 plus 128/256 equals 7.5. $0781 would be 7 plus 129/256, $077F would be 7 plus 127/256. I'm thinking "cut and try" is how I would look for the best number.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
    Cool, CA, USA 95614
  • Thanks Tom. I will try that. And thanks again for the great code :) I will test it next week with the thruster/ESC combo and report back. Have a great weekend.

    Best Regards,

    Alex
  • Hello Tom:

    I connected the Phoenix EDGE HV60 ESC to port 12, substituting the servo that was plugged into that port. Everything worked perfectly! :) I ran out of connecting clips to connect the other motors/ESC's to the other 3 ports to configure the entire thruster system but should pick up some in the next few days. Thanks again for your help Tom as I very much appreciate your time and effort with the coding. I will place progress reports here with pics as I progress the control system and UROV.

    Best Regards,

    Alex
  • :thumb:
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
    Cool, CA, USA 95614
  • ercoerco Posts: 18,077
    @tomcrawford: Way to dive in and git 'er done. You're a rock star!
    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
Sign In or Register to comment.