|
Page 1 of 1
|
[ 9 posts ] |
|
Logitech Game Controller Issues
| Author |
Message |
|
quinn149
Rookie
Joined: Mon Dec 14, 2009 8:29 pm Posts: 6
|
 Logitech Game Controller Issues
Right now im having two big issues with getting my robot. First of all, I'm trying to get a motor to spin a kicker at the press of a button. I had coded that and it actually worked perfectly but two days later the same program with no alteration at all refuses to work. The motor itself is fine because if I directly give that motor powere it runs fine, but as soon as I add in the joystick it stops working. My second problem is when i enter this code: the complier gives me an error saying "unkown variable type mplLeft. Short assumed" (or something to that extent anyway, I do not have access to the compluter I use for programming right now unfortunatly) and refuses to compile. I have even tried the sample program, joystick2 in the FTC folder, which includes a very similar sample of code, setting joytick.joy1_y1 to a variable and the same thing happens. If anyone has any suggestions for fixing this it would be greatly apreciated. My full code is below.  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none) #pragma config(Motor, mtr_S1_C1_1, Kicker, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNone, openLoop) #pragma config(Motor, mtr_S1_C2_1, RightMotor, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_2, LeftMotor, tmotorNormal, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
void initializeRobot() { nMotorEncoder[Kicker] = 0; //sets the encouter count back to zero return; }
task main() { initializeRobot(); //calls funtion to initalise encoders and sensors
waitForStart(); // wait for start of tele-op phase
while (true) //telop phase = true { int mplLeft = joystick.joy1_y1; int mplRight = joystick.joy1_y2; motor[LeftMotor] = mplLeft; motor[RightMotor] = mplRight; if (joy1Btn(6)) //button one on logitech controller { nMotorEncoderTarget[Kicker] = 2000; //has motor run for 2 turns motor[Kicker] = 100; //at 100% powe } } }
|  |  |  |  |
|
| Mon Dec 14, 2009 8:42 pm |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
 Re: Logitech Game Controller Issues
I just tried compiling your source and it worked fine. I'm using version 2.01 +; i.e. a development version because that's what I have conveniently open on my computer.
Have your tried installing the recently released 2.01 version? Do you get compiler errors with it? If so, post again
|
| Tue Dec 15, 2009 12:33 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
 Re: Logitech Game Controller Issues
Another suggestion. Take a look at your code and make sure you haven't mistyped '1' (one) and 'l' (letter L) in the use of variable mplLeft.
|
| Tue Dec 15, 2009 12:35 am |
|
 |
|
quinn149
Rookie
Joined: Mon Dec 14, 2009 8:29 pm Posts: 6
|
 Re: Logitech Game Controller Issues
Hi. Right now we only have robotC 2.00 and because of the schools harsh security measures we won't be able to upgrade for a couple days and winter vacation is in four.
Another odd thing just started happening as well. The compiler keeps spitting out warning about "unrefrenced funtions" in the joystickdriver file. I'm basically sold on the thought that RobotC is the problem but is there any other reason this might be happening?
|
| Tue Dec 15, 2009 3:24 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2904 Location: Rotterdam, The Netherlands
|
 Re: Logitech Game Controller Issues
Unreferenced functions are not a problem. It just means they're there but not being used. It's inherent to libraries, you never really use all of them, just some of them. Think of it as a normal library where you can borrow books; you don't read/need all of the books in there, either.
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Tue Dec 15, 2009 3:58 pm |
|
 |
|
quinn149
Rookie
Joined: Mon Dec 14, 2009 8:29 pm Posts: 6
|
 Re: Logitech Game Controller Issues
Ok thanks. I thought there was actually a funtion in the joystickdriver file that actually said to ignore unrefrenced funtions which was why i was worried something was wrong.
The IT guy should have the software updated by tomorrow i hope so I should be able try testing again.
|
| Tue Dec 15, 2009 7:41 pm |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Logitech Game Controller Issues
It may not be related but sometimes I also get some weird compiler errors or warnings that did not happen a moment ago. No matter how hard I tried, they will not go away until I totally exited RobotC and restarted it. Then my program compiles fine again. I can't reproduce this scenario at will but it has happened a few times to me.
For example, the "unreferenced functions" warning should not occur because there should be a "#pragma systemFile" line at the beginning that should disable this warning.
|
| Wed Dec 16, 2009 1:42 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2904 Location: Rotterdam, The Netherlands
|
 Re: Logitech Game Controller Issues
Then the unreferenced functions are probably in your normal code.
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Wed Dec 16, 2009 3:01 am |
|
 |
|
quinn149
Rookie
Joined: Mon Dec 14, 2009 8:29 pm Posts: 6
|
 Re: Logitech Game Controller Issues
2.01 seems to have fixed all my problems, at least for now. I haven't done any extensive testing but at least now my code will compile. Thank you for your help.
|
| Fri Dec 18, 2009 11:30 am |
|
|
|
Page 1 of 1
|
[ 9 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 4 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|