View Full Version : NEED HELP WITH PROGRAMMING
OMAR_567
31-01-2008, 13:08
HEY
WE ARE A ROOKIE TEAM AND WE HAVE NO IDEA WHAT TO DO AND WE WANT TO SEE A SAMPLE CODE IN TELEOPARATED MODE ANY HELP????
iwin2000
31-01-2008, 13:38
Maybe you shouldn't yell and people would help.
But are you programming in EasyC or MPLAB?
OMAR_567
31-01-2008, 13:40
MY BAD WASNT TRYING TO YELL
WELL WE ARE USING MPLAB
kevin.li.rit
31-01-2008, 13:44
MY BAD WASNT TRYING TO YELL
WELL WE ARE USING MPLAB
Go download the default code. Open up user_routines and read the comments. It should have enough code to get your robot driving as is.
CardcaptorRLH85
31-01-2008, 14:11
In general when 'speaking' on the internet, using ALL CAPS is considered yelling. That's what iwin2000 was probably getting at.
By the way, the default code can be found near the bottom of the this page (http://www.ifirobotics.com/rc.shtml). It's labeled '2007 RC Code'. If I remember correctly, IFI hasn't released any different code for the 2008 season. If I'm wrong, someone will almost definitely correct me ^_^
OMAR_567
31-01-2008, 14:52
We have gone through the default code, but we are missing what the code means. We have someone to help us with C programming, but how do we define things so that they match up with physical layout on the robot control. Is there some manual that helps explain some of this. For example:
pwm01 = p1_y;
pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
pwm05 = p1_x;
pwm06 = p2_x;
pwm07 = p3_x;
pwm08 = p4_x;
pwm09 = p1_wheel;
pwm10 = p2_wheel;
pwm11 = p3_wheel;
pwm12 = p4_wheel;
The comments help in the program, but we need some more direction.
Mark McLeod
31-01-2008, 14:57
Take a look at the IFI user guide to the default code: http://www.ifirobotics.com/docs/legacy/frc-rc-default-software-ref-guide-2004-1-7.pdf
Also see http://www.ifirobotics.com/docs/legacy/2004-programming-reference-guide-12-apr-2004.pdf
Both are linked from the IFI webpage that CardcaptorRLH85 refered to.
Programming reference guide:
http://www.ifirobotics.com/docs/legacy/2004-programming-reference-guide-12-apr-2004.pdf
Default code reference guide:
http://www.ifirobotics.com/docs/legacy/frc-rc-default-software-ref-guide-2004-1-7.pdf
kevin.li.rit
31-01-2008, 15:06
We have gone through the default code, but we are missing what the code means. We have someone to help us with C programming, but how do we define things so that they match up with physical layout on the robot control. Is there some manual that helps explain some of this. For example:
pwm01 = p1_y;
pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
pwm05 = p1_x;
pwm06 = p2_x;
pwm07 = p3_x;
pwm08 = p4_x;
pwm09 = p1_wheel;
pwm10 = p2_wheel;
pwm11 = p3_wheel;
pwm12 = p4_wheel;
The comments help in the program, but we need some more direction.
Basically what's going down below is that the pwm outputs on the robot controller are being mapped to the joystick inputs on the OI. So if you plug in a joystick to port 1 of the OI, and push it foward all the way, p1_y will be 255. This 255 on the Pwm01 will tell the speed controller to go +12V across the motor. Pulling it all the way back would give you a 0 on pwm01. This is a signal to go -12V for the speed controller(running a motor in reverse). When the joystick is at rest it is at a neutral value of 127.
So with what's setup below if you plug in joysticks to the OI in ports 1 and 2. Then plug in your speed controllers for your drive into PWMs 1 and 2. Then you should be able to drive your robot with 2 joysticks.
pwm01 = p1_y; //Map the y axis of joystick 1 to pwm01
pwm02 = p2_y; //Map the y axis of joystick 1 to pwm02
pwm05 = p1_x; //Map the x axis of joystick 1 to pwm01
pwm06 = p2_x; //Map the x axis of joystick 1 to pwm02
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.