|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Absolute Value of Joystick position
The joysticks I have are somewhat off center slightly so the drive motors are constantly running at like .05 as an example.
This is what I am trying to do below but I think the Abs() function converts it to an Integer. How can I use it on a float (or should I resort to more "or's" in the "if's" Code:
if(abs(J_stick1.GetY()) <= .05 || abs(J_stick2.GetY()) <= .05)
R_myRobot.Drive(0.0, 0.0);
|
|
#2
|
||||
|
||||
|
Re: Absolute Value of Joystick position
Quote:
* fabs() = floating point absolute value |
|
#3
|
|||
|
|||
|
Re: Absolute Value of Joystick position
Quote:
|
|
#4
|
|||
|
|||
|
Re: Absolute Value of Joystick position
Quote:
Code:
#include "Math.h" |
|
#5
|
|||
|
|||
|
Re: Absolute Value of Joystick position
Thanks, I built it and it didn't produce an error. I will have to wait to test in a week because we sealed the bot and we are making an extra bot.
I will see if i can test it on this 1 scrap bot some day before then hopefully. Thanks, Davis |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|