![]() |
Joystick Programming
Hello. Does the FRC default code allow 2 joysticks to be used? Also, is there any way to adjust the sensitivity of the controllers, or the speed of the motors?
|
Re: Joystick Programming
Hi, and yes there is. The controllers (I'm going to guess that you mean the Victors) are pretty much un-programmable. The motors, however, are programmable by way of the Victors that run them. Now I'm not sure what you are using for the programming tool but we used the free ROBOTC software that can be downloaded from one of these forums(try searching FREE ROBOTC, that's what I did). Let me know if it's a different programming language and I'll help you. You could also PM me if you need any more help.:)
|
Re: Joystick Programming
also, if you're new at this and dont have anyone else who knows what they're doing, avoid using MPLab....try EasyC or robotC instead. i dont have any experience with these, but they're supposed to be easier!
|
Re: Joystick Programming
Quote:
|
Re: Joystick Programming
i just avoid them because they have 'easy' in them (well, just easyC) :p
|
Re: Joystick Programming
I'm sorry, I should have been a bit clearer: By controllers, I meant the joysticks.
Where in the code does it allow you to adjust motor sensitivity? Looking at the default code, I have no idea where I can adjust that. |
Re: Joystick Programming
if you look in the default code you will see lines like
Code:
pwm01 = p1_yI will give you a link to a thread I posted in a couple of weeks ago on this. Edit: http://www.chiefdelphi.com/forums/sh...ad.php?t=61929 |
Re: Joystick Programming
I'm sorry what programming tool are you using? That code that wt200999 posted may be the code that works for EasyC only (i don't know really). There are other codes that work with other systems.
|
Re: Joystick Programming
Sorry about any confusion, that thread was about how to do it in easyC, the example I posted in there I wrote in MPlab. Someone else had posted code in that thread that works in easyC if you are using that.
|
Re: Joystick Programming
OK...thanks for the info.
I have another question: What kind of algorithm or math should I use to reduce joystick sensitivity? I am really new to this programming thing... |
Re: Joystick Programming
Hi there.
ROBOTC makes using the joystick very easy. If you wanted to use the joysticks to drive your robot you could the following code: while(true){ motor[port1] = frcRF[p1_y]; //maps pwm port 1 to the Y axis of Joy1 motor[port2] = frcRF[p2_y]; //maps pwm port 2 to the Y axis of Joy2 { You can in exchange slow down the motors and still retain the joystick "movement" by dividing the values you're getting from the joystick... like in this example: while(true){ motor[port1] = (frcRF[p1_y] / 2); //maps pwm port 1 to half the value of the Y axis of Joy1 motor[port2] = (frcRF[p2_y] / 2); //maps pwm port 2 to half the value of the Y axis of Joy2 { |
Re: Joystick Programming
I posted here about what we do. It gives us maximum speed (something dividing doesn't) and reduces sensitivity at low speeds. If you are using RobotC or EasyC, I don't know how you would implement it, but I assume that it is possible (I mean, if those tools don't allow working with arrays, I would be very disappointed).
|
| All times are GMT -5. The time now is 13:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi