View unanswered posts | View active topics It is currently Fri Aug 22, 2014 2:14 pm






Reply to topic  [ 5 posts ] 
Joystick 2 
Author Message
Rookie

Joined: Fri Dec 02, 2011 6:21 pm
Posts: 5
Post Joystick 2
Hello. We're using RobotC v.3.02 and firmware 9.01 for the FTC competition, but we're having a hard time using the second joystick controller. When we bring up the FTC Joystick Controller window we supposedly enable the second joystick, and the pictures of the joysticks on-screen show that they are interacting with the computer. However, when we upload the program to the NXT brick, we can't use the second controller. Furthurmore, any time we use the second joystick (joystick.joy2_y2) in our program, the motors being controlled by the first joystick (joystick.joy1_y1 and joystick.joy1_y2) start jerking, resembling the symptoms of power spikes, even though the batteries and the power/data connections have all been checked and rechecked. Thanks in advance. (Code below)

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  HTMotor,  HTMotor)
#pragma config(Sensor, S1,     ,                    sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     tread_left,    tmotorNormal, openLoop, reversed, encoder)
#pragma config(Motor,  mtr_S1_C1_2,     belt_left,     tmotorNormal, PIDControl, encoder)
#pragma config(Motor,  mtr_S1_C3_1,     tread_right,   tmotorNormal, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C3_2,     belt_right,    tmotorNormal, PIDControl, reversed, encoder)
#pragma config(Motor,  mtr_S1_C4_1,     crane_arm,     tmotorNormal, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C4_2,     crane_lift,    tmotorNormal, openLoop, encoder)
#pragma config(Servo,  srvo_S1_C2_1,    tray_top,             tServoStandard)
#pragma config(Servo,  srvo_S1_C2_2,    extender_right,       tServoStandard)
#pragma config(Servo,  srvo_S1_C2_3,    extender_left,        tServoStandard)
#pragma config(Servo,  srvo_S1_C2_4,    magnetic,             tServoStandard)
#pragma config(Servo,  srvo_S1_C2_5,    crane,                tServoStandard)
#pragma config(Servo,  srvo_S1_C2_6,    unused,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
  while(true)
  {
    getJoystickSettings(joystick);
    motor[tread_left] = (joystick.joy1_y1/2);
    motor[tread_right] = (joystick.joy1_y2/2);
    motor[belt_left] = (joystick.joy2_y1/2);
    motor[belt_right] = (joystick.joy2_y2/2);
  }
}


Fri Dec 02, 2011 6:37 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Joystick 2
Are you sure, you have the two joysticks associated correctly? In the joystick dialog, there should be a drop down menu for you to select which joystick is which. Make sure the two joysticks are associated with different physical joystick.


Fri Dec 02, 2011 8:54 pm
Profile
Rookie

Joined: Fri Apr 15, 2011 10:29 am
Posts: 37
Post Re: Joystick 2
piedmont wrote:
Furthurmore, any time we use the second joystick (joystick.joy2_y2) in our program, the motors being controlled by the first joystick (joystick.joy1_y1 and joystick.joy1_y2) start jerking, resembling the symptoms of power spikes, even though the batteries and the power/data connections have all been checked and rechecked. Thanks in advance. (Code below)


Humor me for a second. Bring up the debugger windows, and verify that there is only one "Joystick" window enable. (Make sure that both Joystick - Basic and Joystick - FTC) aren't both selected.

Note, due to bugs in RobotC, the joystick window may not show up on the screen. When both joystick debug windows are selected, they 'fight' each other.

Nate - Student of the hard-knocks school of knowledge.


Tue Dec 06, 2011 9:43 pm
Profile
Rookie

Joined: Fri Dec 02, 2011 6:21 pm
Posts: 5
Post Re: Joystick 2
Thank you very much! That was the problem.


Wed Dec 07, 2011 1:58 pm
Profile
Rookie

Joined: Fri Apr 15, 2011 10:29 am
Posts: 37
Post Re: Joystick 2
piedmont wrote:
Thank you very much! That was the problem.


Glad it worked out for you!


Thu Dec 08, 2011 1:58 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.