![]() |
using easyC to give more control to the joysticks
I have two ideas:
1. make the input and output relationship a cubic function - no clue how to do that tho i would prefer a look up table to save processing power... 2. use a divide function when a button is held down to give control - i am confused since 127 would not be 127 and things could go wrong...i don't know how to spread out the limited output over the whole joystick axis with 127 still being 127... P.S. If you could leave your email, so that I could ask some more newbie question...that would be much appreciated :D |
Re: using easyC to give more control to the joysticks
I apologize in advance because my knowledge of EasyC functions is limited. In both cases I think you should use the FourWheelDrive() or TwoWheelDrive() functions (depending on what you are using). The you can use the Drive(int speed, int direction) function to control the robot. Keep in mind that Drive how drive works
Quote:
Quote:
Code:
rom const char lookup[256] = { 0th char, ..., 255th char};Code:
Drive(lookup[y-axis of joystick], lookup[x-axis of joystick]);Quote:
However since EasyC's Drive is centered around 0, you can just: Code:
Drive((y-axis of joystick-127)/(factor), (x-axis of joystick-127)/(factor));I hope this helps. There may be a few minor difficulties with EasyC. I am trying to learn EasyC this year for Team 1495, but I don't have my own license. I'll PM you an email address. |
Re: using easyC to give more control to the joysticks
1075 has implemented a cubic function based drive for several years. Well, not so much cubic as sticking the positive and negative quadratic functions together, but you get the idea.
|
Re: using easyC to give more control to the joysticks
Well, I've pasting this everywhere, so it might as well be here as well:
Code:
long ramping (unsigned char ramp)http://www.chiefdelphi.com/forums/at...9&d=1201127844 And in previous years we have used a 'half inputs' button. Just subtract 127 before halving and add it back later. (Assuming neutral is 127) It works fairly well when you need precision, but no one ever remebered to use it. Maybe with decent driver training. |
Re: using easyC to give more control to the joysticks
Quote:
I don't get "long ramping (unsigned char ramp) Also if i typed the code u posted into easyC along with some other blocks, will it work? Thanks |
Re: using easyC to give more control to the joysticks
Alright, I guess EasyC doesn't use function syntax like that. Sorry, I'm really not familiar with it.
In the code given, only 'answer' and 'ramp' are variables. The function's name is 'ramping.' When you call ramping(ramp) where var is an unsigned char, it returns the long 'answer.' This would be how to use it in any code, I guess: Code:
answer = ((long)ramp - 127); |
| All times are GMT -5. The time now is 23:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi