View unanswered posts | View active topics It is currently Thu Sep 18, 2014 10:10 am






Reply to topic  [ 9 posts ] 
Logitech Game Controller Issues 
Author Message
Rookie

Joined: Mon Dec 14, 2009 8:29 pm
Posts: 6
Post 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:
Code:
int mplLeft = joystick.joy1_y1;
    int mplRight = joystick.joy1_y2;
   
    motor[LeftMotor] = mplLeft;
    motor[RightMotor] = mplRight;

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
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 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
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 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
Profile
Rookie

Joined: Mon Dec 14, 2009 8:29 pm
Posts: 6
Post 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
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Dec 15, 2009 3:58 pm
Profile WWW
Rookie

Joined: Mon Dec 14, 2009 8:29 pm
Posts: 6
Post 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
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: Logitech Game Controller Issues
Then the unreferenced functions are probably in your normal code.

Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Dec 16, 2009 3:01 am
Profile WWW
Rookie

Joined: Mon Dec 14, 2009 8:29 pm
Posts: 6
Post 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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.