Go to Post Six robots no one has ever heard of playing the finals on Einstein field. That's my dream matchup. - Tetraman [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 12-02-2014, 11:10
mozrila mozrila is offline
Registered User
AKA: Ben
FTC #3415 (Lancer Robotics)
Team Role: CAD
 
Join Date: Apr 2012
Rookie Year: 2008
Location: United States
Posts: 12
mozrila is an unknown quantity at this point
[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);


  }
}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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