Go to Post I've always thought that what makes an average person exceptional is not their inability to make mistakes, but rather their ability to recognise, rectify, and learn from them. - artdutra04 [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

 
Reply
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread 12-02-2014, 11:15
maths222 maths222 is offline
FTC FTA
AKA: Jacob Burroughs
no team
 
Join Date: Nov 2011
Rookie Year: 2010
Location: United States
Posts: 148
maths222 is a splendid one to beholdmaths222 is a splendid one to beholdmaths222 is a splendid one to beholdmaths222 is a splendid one to beholdmaths222 is a splendid one to beholdmaths222 is a splendid one to beholdmaths222 is a splendid one to behold
Re: [FTC]: Help with my Omni Code?

Code:
joystick.joy1_y1
and so on
__________________
--Jacob
Illinois FTC FTA
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2014, 12:21
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
Re: [FTC]: Help with my Omni Code?

*facepalm*

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


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 07:59.

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