Joystick to Drive calculations for RS232
- JB
- Topic Author
17 years 5 months ago #7661602
by JB
Joystick to Drive calculations for RS232 was created by JB
Hi all,
I am sending joystick information from a laptop over a wireless network to a computer that is connected to the Roboteq by RS232.
I am sending X and Y coordinates plus the limits of the joystick. What is the most popular way to convert the X and Y coordinates to the proper !ANN and !BNN commands?
Thanks
I am sending joystick information from a laptop over a wireless network to a computer that is connected to the Roboteq by RS232.
I am sending X and Y coordinates plus the limits of the joystick. What is the most popular way to convert the X and Y coordinates to the proper !ANN and !BNN commands?
Thanks
Please Log in or Create an account to join the conversation.
- cosma
17 years 5 months ago #7699615
by cosma
Replied by cosma on topic Re:Joystick to Drive calculations for RS232
<P style="MARGIN: 0px">The easiest is to use Roborun on the host PC and Roboserver on the PC that is on the robot. Roborun interfaces to joysticks and will do the conversion into commands the controller understands. These commandes are sent via the wireless LAN on a TCP/IP socket. The Roboserver program on the robot takes these commands and sends them to the controller via the serial port and back.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">If you want to roll your own software, we can suggest that you use Visual Basic and install the JKJoy OCX to interface to the joystick. See <A href="www.shareup.net/Development/Components-L...rol-review-2264.html" target=_blank>www.shareup.net/Development/Components-L...rol-review-2264.html
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Once you have the X & Y coordinates, you can use some of the code contained in the sample code shown at <A href="dev.roboteq.com/dev1/download/vb-ax2550com.zip" target=_blank>www.roboteq.com/download/vb-ax2550com.zip to generate the commands.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">If you want to roll your own software, we can suggest that you use Visual Basic and install the JKJoy OCX to interface to the joystick. See <A href="www.shareup.net/Development/Components-L...rol-review-2264.html" target=_blank>www.shareup.net/Development/Components-L...rol-review-2264.html
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Once you have the X & Y coordinates, you can use some of the code contained in the sample code shown at <A href="dev.roboteq.com/dev1/download/vb-ax2550com.zip" target=_blank>www.roboteq.com/download/vb-ax2550com.zip to generate the commands.
Please Log in or Create an account to join the conversation.
- JB
- Topic Author
17 years 5 months ago #7707068
by JB
Replied by JB on topic Re:Joystick to Drive calculations for RS232
<P style="MARGIN: 0px">Thanks, but it isn't want I need.
<P style="MARGIN: 0px">I just want an X and Y to DriveA and DriveB calculation.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Example:
<P style="MARGIN: 0px">Let's say that the joystick has its limits set at -1000 and +1000.
<P style="MARGIN: 0px">A reading is taken from the joystick for example: y = 250 and x = 100.
<P style="MARGIN: 0px">These values are entered into the calculation producing "!ANN" and "!BNN".
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">I saw one person was using:
<P style="MARGIN: 0px"> DriveA = Y + X
<P style="MARGIN: 0px"> DriveB = Y - X
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">The above would cause undesirable wheel reversals when X is greater than Y.
<P style="MARGIN: 0px">I don't want the wheels to reverse unless the joystick crosses over a Y of zero.
<P style="MARGIN: 0px">I am assuming that <FONT face="Times New Roman" size=3>Trigonometry </FONT>would be needed for calculating the values.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Please help.
<P style="MARGIN: 0px">Thanks.
<P style="MARGIN: 0px">I just want an X and Y to DriveA and DriveB calculation.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Example:
<P style="MARGIN: 0px">Let's say that the joystick has its limits set at -1000 and +1000.
<P style="MARGIN: 0px">A reading is taken from the joystick for example: y = 250 and x = 100.
<P style="MARGIN: 0px">These values are entered into the calculation producing "!ANN" and "!BNN".
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">I saw one person was using:
<P style="MARGIN: 0px"> DriveA = Y + X
<P style="MARGIN: 0px"> DriveB = Y - X
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">The above would cause undesirable wheel reversals when X is greater than Y.
<P style="MARGIN: 0px">I don't want the wheels to reverse unless the joystick crosses over a Y of zero.
<P style="MARGIN: 0px">I am assuming that <FONT face="Times New Roman" size=3>Trigonometry </FONT>would be needed for calculating the values.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Please help.
<P style="MARGIN: 0px">Thanks.
Please Log in or Create an account to join the conversation.
- cosma
17 years 5 months ago #7714914
by cosma
Replied by cosma on topic Re:Joystick to Drive calculations for RS232
<P style="MARGIN: 0px">The Y+X/Y-X algorithm is what is commonly used. We use a similar one in our controllers.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">If you need to prevent reversal at all costs when Y is no 0, you can cap X to not be larger than Y. However, this would mean that you would be able to barely steer at slow speed, and when Y=0 violent turns would be allowed.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">If you need to prevent reversal at all costs when Y is no 0, you can cap X to not be larger than Y. However, this would mean that you would be able to barely steer at slow speed, and when Y=0 violent turns would be allowed.
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
Time to create page: 0.062 seconds