View unanswered posts | View active topics It is currently Wed Nov 13, 2019 10:40 am






Reply to topic  [ 4 posts ] 
Teleop code 
Author Message
Rookie

Joined: Sun Oct 12, 2014 3:29 pm
Posts: 4
Location: Western Center Academy
Post Teleop code
Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Hubs,  S2, HTMotor,  none,     none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     RightDrive,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     LeftDrive,         tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_1,     empty,     tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S2_C2_2,     empty,         tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"
void initializeRobot()
{
   return;
}

task main()
{
   initializeRobot();
   
   waitForStart();

    while(true)
       {
          
          int threshold = 10;
          {
          if(abs(joystick.joy1_y2) > threshold)
             {
                motor[RightDrive] = joystick.joy1_y2;
             }
          else
             {
                motor[RightDrive] = 0;
             }
             
          if(abs(joystick.joy1_y1) > threshold)
             {
                motor[LeftDrive] = joystick.joy1_y1;
             }
          else
             {
                motor[LeftDrive] = 0;
             }
          }
       }
}

Teleop code broke. Please help, its tank drive,

_________________
We are the NANOSLUGS! FTC Team number 5755!


Thu Oct 30, 2014 7:07 pm
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: Teleop code
Well, you forgot to put getJoystickSettings(joystick) in your main code loop. So if your code is broken as in your robot doesn't move, that would be a reason why.

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Thu Oct 30, 2014 7:28 pm
Profile
Rookie

Joined: Sun Oct 12, 2014 3:29 pm
Posts: 4
Location: Western Center Academy
Post Re: Teleop code
BurningLights wrote:
Well, you forgot to put getJoystickSettings(joystick) in your main code loop. So if your code is broken as in your robot doesn't move, that would be a reason why.


So whenever I put it in my task main(), which is I imagine you mean, I get this error message. "**Error*:Expected->';'. Found 'initializeRobot'"

_________________
We are the NANOSLUGS! FTC Team number 5755!


Sat Nov 01, 2014 1:02 pm
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: Teleop code
Okay, here's what it looks like in code. This is inside your task main, after initializeRobot() and waitForStart():
Code:
while (true)
{
  getJoystickSettings(joystick);
  // Your stuff using the joysticks stays here
}

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Sun Nov 02, 2014 12:37 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.