Go to Post May we always remember those who have shaped our lives for through us they shape those around us. - mechanicalbrain [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
  #4   Spotlight this post!  
Unread 26-01-2008, 22:39
Steve_Alaniz Steve_Alaniz is offline
Registered User
FRC #2848 (All Sparks)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 1997
Location: Dallas
Posts: 211
Steve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond repute
Re: 2008 Omni Drive Code Help

First uses this:

pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);

They Add 2000 to prevent a negative value and when they call LIMIT_MIX ()
It evaluates the result and subtract out the 2000. I think your code could be changed to

motor_fl_1 = Limit_Mix(2000 + drive_ly + drive_lx - 127);

motor_fr_1 = Limit_Mix(2000 + 127 - drive_ly + drive_lx);

motor_br_1 = Limit_Mix(2000 + 382 - drive_ly - drive_lx);

motor_bl_1 = Limit_Mix(2000+ 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;

This should prevent any over runs even if your joystick is doing something weird. Are you using a chicket?
Although I must admit I don't understand the "382 - drive_ly - drive_lx" but I'll assume you know the formula to be correct and that the problem you're having is from a violation in a positive integer math problem.

Hope that helps

Steve
 


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 01: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