View unanswered posts | View active topics It is currently Wed Apr 16, 2014 3:46 pm






Reply to topic  [ 4 posts ] 
Sample Joystick program 
Author Message
Rookie

Joined: Fri Oct 23, 2009 2:48 pm
Posts: 3
Post Sample Joystick program
We are attempting to use the Joystick1.c sample program, but the robot is not responding. It compiles and downloads to the NXT, we open the joystick debugger window (simple) and see x and y values, but after starting the program, no response from the motors. Which platform type should be selected? Do we need to use a template, or should the program run as-is? Just getting started......

Thanks, Will

PS..Just noticed that the NXT brick window displays a line about wait for start, even after we click Start in the debugger window??


Fri Oct 23, 2009 3:02 pm
Profile
Rookie
User avatar

Joined: Wed Feb 25, 2009 7:00 pm
Posts: 10
Post Re: Sample Joystick program
The easiest way to ensure that your robot isn't waiting for start is to comment out or not include waitForStart(); until late in your development curve. If it still doesn't respond, that's not your problem. You can also try:
    Connecting by USB instead of bluetooth
    Use joystick debug (game) instead of simple
    If all else fails, erase everything on the robot and re-download the latest firmware.


Fri Oct 23, 2009 7:38 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 137
Post Re: Sample Joystick program
vonpod3 wrote:
We are attempting to use the Joystick1.c sample program, but the robot is not responding. It compiles and downloads to the NXT, we open the joystick debugger window (simple) and see x and y values, but after starting the program, no response from the motors.

Unfortunately, I think that particular sample file needs to be deleted. For one, it has the motor control lines commented out which is why you do not see any response from the motors.
Here is a better basic example:
Code:
#pragma config(Hubs,   S1, HTMotor,   HTServo,   none,         none)
#pragma config(Motor,    mtr_S1_C1_1,         leftMotor,       tmotorNormal, openLoop)
#pragma config(Motor,    mtr_S1_C1_2,         rightMotor,       tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard                      !!*//

#include "JoystickDriver.c"

task main()
{
   while (true)
   {
      getJoystickSettings(joystick);

      motor[rightMotor] = joystick.joy1_y1;
      motor[leftMotor]   = joystick.joy1_y2;

   }
}

This code should do what you were expecting from Joystick1.c, but is pretty trivial and limited in usefulness. For example, it does not properly scale the joystick analog stick values (-127 to 128) to the motor range (-100 to 100).
vonpod3 wrote:
Which platform type should be selected?

Assuming you are in fact competing in FTC: Lego Mindstorms NXT + Tetrix
vonpod3 wrote:
Do we need to use a template, or should the program run as-is?

You can run the program as is for now, but will need to use the autonomous and teleop templates available at http://www.ftctraining.com to be competition legal.


What I would recommend is to watch the videos and read the documentation available at:
http://www.ftctraining.com
http://www.robotc.net/content/webinar/index.html
http://www.education.rec.ri.cmu.edu/content/lego/index.htm
That should answer a lot of your initial questions to help get you up and running.


Fri Oct 23, 2009 10:03 pm
Profile
Rookie

Joined: Fri Oct 23, 2009 2:48 pm
Posts: 3
Post Re: Sample Joystick program
Thanks for the help. As it turns out, I needed to set the joystick control panel to TeleOp Run, I did not notice those radio buttons........Problem solved though!

Will


Mon Oct 26, 2009 6:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.