Go to Post it isn't about the technology but about the teams working together. Sneaky GDC has done it again. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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 26-01-2008, 15:21
Vasily Zaitsev's Avatar
Vasily Zaitsev Vasily Zaitsev is offline
Registered User
FRC #1111 (Power Hawks)
Team Role: Electrical
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Maryland
Posts: 3
Vasily Zaitsev is an unknown quantity at this point
Send a message via AIM to Vasily Zaitsev
2008 Omni Drive Code Help

Our robot is using a four wheel, four motor omni drive system. Our code gives good output except for sometimes it swaps outputs. Instead of giving a 250, it gives a 4.

drive_ly and drive_lx are our drive joystick.
motor_fl_1 and all the others are the variables we send to the motors. fl=front left.
pwm_drive_fl are the actual motors.

Heres the code:
Code:
  if ( (drive_ly + drive_lx - 127) > 254 )
    motor_fl_1 = 254;
  else if ( ( drive_ly + drive_lx - 127) < 0 )
    motor_fl_1 = 0;
  else motor_fl_1 = drive_ly + drive_lx - 127;

  if ( ( 127 - drive_ly + drive_lx ) > 254 )
    motor_fr_1 = 254;
  else if ( (  127 - drive_ly + drive_lx ) < 0 )
    motor_fr_1 = 0;
  else motor_fr_1 =  127 - drive_ly + drive_lx;

  if ( ( 382 - drive_ly - drive_lx ) > 254 )
    motor_br_1 = 254;
  else if ( (  382 - drive_ly - drive_lx ) < 0 )
    motor_br_1 = 0;
  else motor_br_1 =  382 - drive_ly - drive_lx;

  if ( ( 127 + drive_ly - drive_lx ) > 254 )
    motor_bl_1 = 254;
  else if ( (  127 + drive_ly - drive_lx ) < 0 )
    motor_bl_1 = 0;
  else motor_bl_1 =  127 + drive_ly - drive_lx;



  if ( (motor_fl_1 < 137) && ( motor_fl_1 > 117 ) )
    pwm_drive_fl = 127;
  else  pwm_drive_fl = motor_fl_1;

  if ( (motor_fr_1 < 137) && ( motor_fr_1 > 117 ) )
    pwm_drive_fr = 127;
  else  pwm_drive_fr = motor_fr_1;

  if ( (motor_br_1 < 137) && ( motor_br_1 > 117 ) )
    pwm_drive_br = 127;
  else  pwm_drive_br = motor_br_1;

  if ( (motor_bl_1 < 137) && ( motor_bl_1 > 117 ) )
    pwm_drive_bl = 127;
  else  pwm_drive_bl = motor_bl_1;
we're pretty sure its an overflow error, but this code should make up for that.

can anybody help please?
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in Kevin's 2008 default code robotrobot2 Programming 5 20-01-2008 14:36
Lego Omni Drive Synergy1848 Robot Showcase 19 03-01-2007 11:51
pic: vex omni drive 1902_Battery_SGT FIRST Tech Challenge 6 28-05-2006 17:55
omni drive vs tank |20807 61|2|_ Technical Discussion 49 17-01-2006 13:54
Omni-drive autonomous questions Andrew Schuetze Programming 6 17-01-2006 12:15


All times are GMT -5. The time now is 14:26.

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