Go Down

Topic: Android Bluetooth joystick (Read 379181 times) previous topic - next topic

fullspool

The calibration was actually done with it on and with turbo button off as I tried every combination I could think of.  I still didn't get the result we were looking for . Let me make the changes to the code , thanks kas your intellect is mind blowing.

woodygb

#631
Mar 10, 2016, 05:32 pm Last Edit: Mar 10, 2016, 07:54 pm by woodygb
Rather than using....

  joyX = joyX/turbo;                                                  // turbo (button #2)
  joyY = joyY/turbo;



Would it not be better to redefine the map and constrain depending on wether Turbo mode is ON/OFF?

Perhaps something like this ....

if(joyY >-10)  {                                                    // differential steering
    servo_L = (joyY - (3*joyX)/4);
    servo_R = (joyY + (3*joyX)/4);
  }
  else
  {
    servo_L = (joyY + (3*joyX)/4);
    servo_R = (joyY - (3*joyX)/4);
  }
  if ( turbo == 1 ) { // FULL SPEED
  servo_L = map(servo_L, -100, 100, 0, 180);   //         << adjust to change motor direction
  servo_R = map(servo_R, -100, 100, 0, 180);
  servo_L = constrain(servo_L, 0, 180);
  servo_R = constrain(servo_R, 0, 180);
  }
  else // HALF SPEED
  { 
  servo_L = map(servo_L, -100, 100, 45, 135);   //         << adjust to change motor direction
  servo_R = map(servo_R, -100, 100, 45, 135);
  servo_L = constrain(servo_L, 45, 135);
  servo_R = constrain(servo_R, 45, 135);
}
}

kas

Quote
Would it not be better to redefine the map and constrain depending on wether Turbo mode is ON/OFF?
Hi Woody   ;)

This code implementation should deliver identical values
Did I miss something ??



@fullspool
Did you try changing the code as per my last message ??


woodygb

#633
Mar 10, 2016, 10:59 pm Last Edit: Mar 10, 2016, 11:21 pm by woodygb
Hi Kas,

I'm unsure if anything is wrong with your code ... dividing the X,Y values by 2 ...making them -50 /50 rather than -100/100 should work and give the same results as my rather longer method .

I'd need to program an Arduino and monitor the outputs to be sure.

woodygb

#634
Mar 12, 2016, 11:54 am Last Edit: Mar 12, 2016, 12:25 pm by woodygb
Well I've programmed and run both versions ... no appreciable difference other than the Turbo OFF values for servo L/R mix @ 100 / 100 +-  are  101/168 for Kas's version and 101/135 for mine ... and no out of range / weird numbers for the servo values.

I altered the code so that the servo values would display on the phone.

Code: [Select]
mySerial.print((char)STX);                                             // Start of Transmission
    mySerial.print(getButtonStatusString());  mySerial.print((char)0x1);     // buttons status feedback
    mySerial.print(servo_R);               mySerial.print((char)0x4);     // datafield #1 = battery level
    mySerial.print(servo_L);                 mySerial.print((char)0x5);     // datafield #2 = milli Amps
    mySerial.print(displayStatus);                                         // datafield #3 = status display
    mySerial.print((char)ETX);                                             // End of Transmission
  }

kas

Thanks for the test,
obviously the variation is coming from the differential steering calculation


fullspool

#636
Mar 15, 2016, 01:24 am Last Edit: Mar 15, 2016, 03:27 am by fullspool
@fullspool
Did you try changing the code as per my last message ??


I haven't had any success with the turbo button working correctly, when I change the values to 4 and re-calibrate the ESC the bot still freaks out when I try to use the turbo function. The video is uploading on youtube. It reflects the unmodified 1.6 code.

The problem is when it reads (0,82ish) it goes from forward to reverse.

On a side note, I got the AMP installed and working. Is there a way for it to read and transfer the data? It seems to lag a bit.

edit: video link
https://www.youtube.com/watch?v=aRiParYii1o&feature=em-upload_owner

kas

#637
Mar 15, 2016, 10:27 am Last Edit: Mar 15, 2016, 11:59 am by kas
Quote
The problem is when it reads (0,82ish) it goes from forward to reverse
Same effect with (0,-82) ??


Quote
On a side note, I got the AMP installed and working. Is there a way for it to read and transfer the data? It seems to lag a bit.
V1.6 send Amp values every 750ms
To make it faster replace
 long sendInterval = 750;                            // interval between Buttons status transmission (milliseconds)
with
  long sendInterval = 500;                            // interval between Buttons status transmission (milliseconds)



EDIT:
Quote
when I change the values to 4 and re-calibrate the ESC the bot still freaks out when I try to use the turbo function
With turbo = 4, Button #2 <ON> is now a low speed mode
ESC should be calibrated with Button #2 OFF
(calibration using fastest position)
Please confirm


fullspool

Same effect with (0,-82) ??
from 0,-82ish is the bot functions correctly, it's whenever the stick is pushed further forward
the bot will jerk and go into the reverse. If you watch the ESC in the video you can see a green led light
indicating forward position then when it goes past the -82ish mark it jumps straight in to reverse and you
see the red led light on the esc.


V1.6 send Amp values every 750ms
To make it faster replace
 long sendInterval = 750;                            // interval between Buttons status transmission (milliseconds)
with
  long sendInterval = 500;                            // interval between Buttons status transmission (milliseconds)
Thank you so much, I will try this.

EDIT:With turbo = 4, Button #2 <ON> is now a low speed mode
ESC should be calibrated with Button #2 OFF
(calibration using fastest position)
Please confirm

I've tried this and the bot moves slowly forward and backwards (with button 2 off and  ALOT slower with button 2 on) and then jumps forward to reverse when you put the joy stick in each of the quadrants.

Thanks,
Justin

woodygb

#639
Mar 15, 2016, 08:49 pm Last Edit: Mar 15, 2016, 10:28 pm by woodygb
I've looked back up the the thread and noticed that your using a Scorpion XL .
http://www.robotpower.com/downloads/RobotPower_Scorpion_XL_quickstart.pdf

I'm assuming that you have the jumpers set on option 4 = TANK steering and NOT option 1 = MIX?
You'd get some weird things happening with 2 mixes!

I would however think that it would be much easier to allow the Scorpion to mix the signal and do away with the mix algo in the Arduino program.



Note that TURBO MODE is simply FULL SPEED whilst NO TURBO is 1/2 speed.


albertak

thanks guys<a onclick="_gaq.push(['_trackEvent', 'Outgoing', '.', '']);" rel="nofollow" href="http://golkala.com" target="_blank">http://golkala.com</a>i used the informations

fullspool

I've looked back up the the thread and noticed that your using a Scorpion XL .
http://www.robotpower.com/downloads/RobotPower_Scorpion_XL_quickstart.pdf

I'm assuming that you have the jumpers set on option 4 = TANK steering and NOT option 1 = MIX?
You'd get some weird things happening with 2 mixes!

I would however think that it would be much easier to allow the Scorpion to mix the signal and do away with the mix algo in the Arduino program.



Note that TURBO MODE is simply FULL SPEED whilst NO TURBO is 1/2 speed.


Yes sir, my jumpers are configured in the option 4 for tank mode as I haven't changed the jumpers since we started this project. I am going to revert to a previous program that didn't have the turbo function to try and see if everything still works as it should.

kas

#642
Mar 17, 2016, 04:15 pm Last Edit: Mar 17, 2016, 05:02 pm by kas
Quote
I am going to revert to a previous program that didn't have the turbo function to try and see if everything still works as it should
Test this one
// V1.6A Test, no turbo

Output:
-100  0  +100    >>>   0  90  180

EDIT:    Datafields #1 & #2  will display servo_L  &  servo_R values


fullspool

I tried that code and it produced same results. Something has went wrong after version 1.3 as I uploaded this code attached and re-calibrated my ESC and everything wrong perfectly however it does not have the amp monitoring feature or turbo.

Thanks,
Justin

fullspool

On a side note I built a larger radio control bot with sabertooth 2x60  and it works perfect with traditional radio control but I tried to hook the uno,  hc05,  and Bluetooth app and I only get forward movement  ???

Here it is under radio control guidance,  it's alot of fun .

http://youtu.be/gKVBrUyCepA

Go Up