Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Help with my Omni Code? (http://www.chiefdelphi.com/forums/showthread.php?t=126304)

mozrila 12-02-2014 11:10

[FTC]: Help with my Omni Code?
 
This isn't so much for competition as much as it is for personal reference. What am I missing here as it does not work... Am I blind?

Code:

#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,    none)
#pragma config(Sensor, S1,    ,                    sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,    BackRight,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,    BackLeft,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,    FrontRight,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,    FrontLeft,    tmotorTetrix, openLoop)

#include "JoystickDriver.c"

// Translates values relative to a joystick to values relative to a motor
int scaleForMotor(int joyVal) {
  // The range of values returned from the joystick that should be interpreted as noise
  const int DEADZONE = 5;

  if (abs(joyVal) < DEADZONE) {
        return 0;
  }
 
  return joyVal; //for now, will scale out of max 256
}


task main()
{
  while (true)
  {
          getJoystickSettings(joystick);
         
          motor[BackRight] = scaleForMotor(-joy1_y2 - joy1_x2);
          motor[BackLeft] = scaleForMotor(joy1_y1 + joy1_x1);
          motor[FrontRight] = scaleForMotor(-joy1_y1 + joy1_x1);
          motor[FrontLeft] = scaleForMotor(joy1_y2 - joy1_x2);


  }
}


maths222 12-02-2014 11:15

Re: [FTC]: Help with my Omni Code?
 
Code:

joystick.joy1_y1
and so on

mozrila 12-02-2014 12:21

Re: [FTC]: Help with my Omni Code?
 
*facepalm*

Thanks a bunch... I am a complete dope for not seeing that...


All times are GMT -5. The time now is 18:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi