Go to Post The world has never seen a group of people who have taken such interest and delight in being rickrolled. - StevenB [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-01-2007, 13:12
DylanRoss DylanRoss is offline
Registered User
FRC #1987
 
Join Date: Jan 2007
Location: Lee's Summit, MO
Posts: 4
DylanRoss is an unknown quantity at this point
Axes in Default Code?

Hi, I've been looking over the 2007 default code and making adjustments where necessary; however, I've encountered something that doesn't seem right to me. Under the one-joystick drive section, I see this code:

p1_x = 255 - p1_y;
p1_y = 255 - pwm05;

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


I haven't actually downloaded the code to the robot, but it seems like the first two lines would switch the X and Y axes. I made a simple program that allowed me to input joystick values and it gave me the right/left drive values, and it gave me the backwards output I expected. It seems to me like removing those first two lines should solve the problem. Is this normal? Are the axes switched? Should I go ahead and remove those two lines?


Thanks,
Dylan
  #2   Spotlight this post!  
Unread 17-01-2007, 15:32
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: Axes in Default Code?

Haven't seen those first 2 lines you wrote, but if you connect the PWM13 to the right motor(victor) and PWM15 to the left, it will all work.
  #3   Spotlight this post!  
Unread 19-01-2007, 23:31
slloyd slloyd is offline
Registered User
AKA: Sonny
FRC #1221 (Nerbotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: CANADA -eh?
Posts: 20
slloyd is an unknown quantity at this point
Re: Axes in Default Code?

hey, that code is assuming that the shaft of the two motors are facing each other...

if you mount your motors with the shafts pointing away from each other then your motors will run backwards (up on joystick means drive backwards, left on joystick causes robot to turn right).

you need to invert the signal in the code to support the motors aligned with shafts facing away.

try this modification:

p1_x = p1_y- 255 ;
p1_y = pwm05 - 255;

slloyd
  #4   Spotlight this post!  
Unread 19-01-2007, 23:37
slloyd slloyd is offline
Registered User
AKA: Sonny
FRC #1221 (Nerbotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: CANADA -eh?
Posts: 20
slloyd is an unknown quantity at this point
Re: Axes in Default Code?

now here's a question for you...

what does pwm05 have to do with the joystick? on our robot nothing is even plugged into pwm05... why is this part of the single joystick X/Y mixing operation code?

i have no idea..

slloyd
  #5   Spotlight this post!  
Unread 20-01-2007, 19:06
DylanRoss DylanRoss is offline
Registered User
FRC #1987
 
Join Date: Jan 2007
Location: Lee's Summit, MO
Posts: 4
DylanRoss is an unknown quantity at this point
Re: Axes in Default Code?

Before that bit of code, the program sets p1_y to pwm06 and p1_x to pwm05.
  #6   Spotlight this post!  
Unread 21-01-2007, 14:21
slloyd slloyd is offline
Registered User
AKA: Sonny
FRC #1221 (Nerbotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: CANADA -eh?
Posts: 20
slloyd is an unknown quantity at this point
Re: Axes in Default Code?

thx for the clarification

i wonder if that is safe? i mean, what if i connected something to PWM05?

maybe the single joystick control code should default to:

p1_x_unmodified = p1_x;

p1_x = 255 - p1_y;
p1_y = 255 - p1_x_unmodified;


eh?
Closed Thread


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
Modified default code gives "code violation" scottmso Programming 8 10-02-2006 23:17
problems using gyro/adc code with camera default code tanstaafl Programming 7 22-01-2006 23:09
user code to default code phoenixomega001 Programming 5 09-01-2005 00:09
Inserting Naviagation code into Default code? actorindp Programming 3 28-01-2004 18:12
default code archiver 2001 2 23-06-2002 22:53


All times are GMT -5. The time now is 20:47.

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