Go to Post Let's Just say i am the one that gives Firefighters, paramedics, and law enforcement a job - Tytus Gerrish [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 02-18-2002, 03:02 PM
gthakore gthakore is offline
Registered User
#0843 (WOSS Wyverns)
 
Join Date: Jan 2002
Location: Oakville, ON
Posts: 11
gthakore is an unknown quantity at this point
programming problem

the x-axis have been switched and i want a way to reverse them

basically right now < make the robot go right(>)
and > makes it go (<)

how do i switch it

gaurav email at gthakore@hotmail.com
__________________
gthakore
  #2   Spotlight this post!  
Unread 02-18-2002, 04:37 PM
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 785
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
255 - (x-axis)
  #3   Spotlight this post!  
Unread 02-19-2002, 07:11 AM
GreenDice GreenDice is offline
Registered User
#0891
 
Join Date: Jan 2002
Location: Syracuse, NY
Posts: 33
GreenDice is an unknown quantity at this point
I think you better use 254 - x instead.
__________________
Peter Liu
  #4   Spotlight this post!  
Unread 02-19-2002, 07:58 AM
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
i had this problem with my y-axis, and tried some elaborate solution, but this is much easier. figures, you never think of the easy thing first. oh well, at least the code for the robot is stupidly easy to change.
  #5   Spotlight this post!  
Unread 02-19-2002, 09:40 AM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 7,819
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
I think you would be better off with 255 - x max 254, unless you guarantee that x is never greater then 254 before that.

This will help to keep from outputing two 255's in a row which will reset the data packet and cause all kinds of interesting things to happen.
  #6   Spotlight this post!  
Unread 04-12-2002, 11:05 AM
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
We use some robot reversal code:

Code:
'--------------------------------------------------------------------------
'|	The following code reverses joystick directoin				  |
'|	p1_sw_top[reverse jdriection];pwm1,pwm2[motor speed/direction]
'--------------------------------------------------------------------------
' it'll be confusing as hell
' but oh well
' =)

'How to Swap the Iinformation in Two Variables Without Using a Third Variable!:
'or: XOR is Your Friend =)

if p3_sw_top then forwards:
'---swap right and left pwms
	PWM1 = PWM1 ^ PWM2
	PWM2 = PWM1 ^ PWM2
	PWM1 = PWM1 ^ PWM2
'---invert values of joysticks around 127
'------Thanks to Joe Ross from team 340! :D
	PWM1 = ( 254 - PWM1 )
	PWM2 = ( 254 - PWM2 )
forwards:
It's not elaborate, or even too important, but I'm really proud of it...
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos
  #7   Spotlight this post!  
Unread 04-15-2002, 09:36 AM
VanWEric VanWEric is offline
Registered User
#0250 (Dynamos)
 
Join Date: Feb 2002
Location: NY
Posts: 86
VanWEric is an unknown quantity at this point
impressive

I like the whole xor thing. However, i think it is easiest to just say variable = (!variable). I think that works. If you want to see some really fun manipulation of variables, take a look at one of my previous posts (one line power??). i'll have it bit optimized for next year
  #8   Spotlight this post!  
Unread 04-16-2002, 11:20 PM
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Quote:
Originally posted by Joe Ross
I think you would be better off with 255 - x max 254, unless you guarantee that x is never greater then 254 before that.

This will help to keep from outputing two 255's in a row which will reset the data packet and cause all kinds of interesting things to happen.
The guarantee comes from Innovation First's code which will not allow a reading of a joystick or other pot to become more than 254.

254-x works fine, as shown in this table (in monospaced type font):

x value in :...0........127.........254 (max)
254 - x....: 254........127...........0
255 - x....: 255 ** ...128...........1
  #9   Spotlight this post!  
Unread 04-18-2002, 02:27 PM
jeremy562 jeremy562 is offline
Engineer
#0562 (SPARK 562)
 
Join Date: Feb 2002
Location: Fitchburg, MA
Posts: 74
jeremy562 is an unknown quantity at this point
Send a message via AIM to jeremy562
Here's the REALLY easy solution

Reverse the wires from the speed controller to the motor. Problem solved!
__________________
SPARK 562: Students Pursuing Applied Robotics Knowledge

2006 BAE Granite State Regional: Finalists with 319 and 176
2006 BAE Granite State Regional: Winners of Motorola Quality Award
2004 BAE Granite State Regional: 7th Seed
2004 Mayhem on the Merrimack Champions! Thanks, 61 and 1289!
  #10   Spotlight this post!  
Unread 04-18-2002, 02:54 PM
Greg McCoy's Avatar
Greg McCoy Greg McCoy is offline
boiler up!
FRC #3940 (CyberTooth)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Kokomo, IN
Posts: 484
Greg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond repute
Send a message via AIM to Greg McCoy
Yep, that's the fastest and most efficient way of doing it. Why make your software think more then it has to?

Fast code = good code
  #11   Spotlight this post!  
Unread 04-18-2002, 04:37 PM
jeremy562 jeremy562 is offline
Engineer
#0562 (SPARK 562)
 
Join Date: Feb 2002
Location: Fitchburg, MA
Posts: 74
jeremy562 is an unknown quantity at this point
Send a message via AIM to jeremy562
hehe it would work in a simple situation where you only care about one axis.. but since in this case he also cares about the y-axis it wouldn't be that simple because swapping the motor wires would reverse both axes. He does need to do something in the software.. in this case
__________________
SPARK 562: Students Pursuing Applied Robotics Knowledge

2006 BAE Granite State Regional: Finalists with 319 and 176
2006 BAE Granite State Regional: Winners of Motorola Quality Award
2004 BAE Granite State Regional: 7th Seed
2004 Mayhem on the Merrimack Champions! Thanks, 61 and 1289!
  #12   Spotlight this post!  
Unread 04-18-2002, 04:58 PM
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
At the beginning of my code, I set up a bunch of aliases for variables. (ie leftDrive VAR PWM1, etc). Then, when I run into a problem like this, I just have to change the aliases and everything else in the code changes automatically. Not easy to do for code that's already written, but something to think about next year....
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #13   Spotlight this post!  
Unread 04-18-2002, 05:17 PM
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Quote:
Originally posted by FotoPlasma
We use some robot reversal code:

It's not elaborate, or even too important, but I'm really proud of it...
Or you can just write it to scratch pad ram...

Swap:
put 0, PWM1
PWM1 = PWM2
get 0, PWM2

Inverse:
PWM1 = ~PWM1
PWM2 = ~PWM2
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.

Last edited by Jnadke : 04-18-2002 at 05:23 PM.
  #14   Spotlight this post!  
Unread 04-19-2002, 09:34 AM
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Using 254-x Max 254 is better, but it can still cause errors. For example, if x=255, then 254-x will evaluate to -1, which in PBASIC is approx 65,000. You then take the max and get 255. While this will prevent basic run errors, it can still cause run-time logic problems.

While it's not likely that x will be 255, its still a possibility I don't like leaving. Therefore, I would reccomend the following code:

x=2254-x Min 2000 Max 2254 - 2000
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #15   Spotlight this post!  
Unread 04-19-2002, 09:46 AM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 7,819
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Quote:
Originally posted by Lloyd Burns
The guarantee comes from Innovation First's code which will not allow a reading of a joystick or other pot to become more than 254.
Can someone else confirm this, because I can swear that I have seen 255 come from a joystick.
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
Victor problem Andy Baker Electrical 15 06-24-2003 08:49 AM
multi-bank programming problem GregC Programming 3 02-14-2003 03:13 PM
The problem with scouting... archiver 2001 10 06-23-2002 10:49 PM
Major problem with chipphua motors aka Scott White Motors 18 03-19-2002 06:44 PM
Error found in programming for the pump and pressure switch sjharobotics Programming 4 02-06-2002 04:46 PM


All times are GMT -5. The time now is 10:10 AM.

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


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