Go to Post [Programming a swerve drive] It's really really simple, unless you actually do it. - Ether [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 28-02-2002, 17:46
K. Skontrianos's Avatar
K. Skontrianos K. Skontrianos is offline
Registered User
FRC #0102 (Dexterous Gearheads)
Team Role: Alumni
 
Join Date: Nov 2001
Rookie Year: 2000
Location: Somerville, NJ
Posts: 100
K. Skontrianos is an unknown quantity at this point
Inverse Trig

Now that the main robot is done, some of my friends and I have begun to work on a side project involving GPS tracking. We would like to use a PBASIC controller, since we have experience programming it, but we are unsure as to how to program inverse trig functions. Through some internet research we have found some equations that can be used to calculate inverse tangent, but we fear that PBASIC may round the angle measures. Since our robot will drive itself, we feel that we need to be accurate to at least 2-3 decimal places. If anyone has experience with programming inverse trig functions, most importanly inverse tangent, please contact me.
Thanks,
Kostas Skontrianos
scottoulli5@netzero.net
Go Gearheads!!! 102!!!!
  #2   Spotlight this post!  
Unread 01-03-2002, 18:32
Skabana159's Avatar
Skabana159 Skabana159 is offline
Robotics and Field Hockey
AKA: Jesse C. Owens
#0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2000
Location: Ft. Collins, CO
Posts: 92
Skabana159 is on a distinguished road
Send a message via AIM to Skabana159
I predict that you may have some trouble accomplishing this.

First, the two trig functions available for use in the BASIC stamp, SIN and COS, are tricky in and of themselves. Due to the fact that the BASIC stamp functions on relatively rudimentary binary, it uses completely different units than what you may be used to. Let us draw comparisons between the Stamp's trig and normal trig. While, in most situations, we divide a circle into 2*pi radians, or 360 degrees, neither of these units are of much use in binary. So, the stamp uses a unit call the binary radian (brad). This unit is defined in two ways: there are 255 brads in a circle, and one brad is about 1.406 degrees. In addition, we are used to sin giving us the y component of a point on the unit circle (where the radius of a circle is 1). In PBASIC, however, you will find that sin gives the y component of a point on the 127-unit circle.

Second, you may have trouble interpreting the values returned by trig functions. All unary operators (those that have 1 argument, like square root, sine, absolute value) on the BASIC stamp are performed in the space of a word. This means 16 bits, 2 bytes, or in base-10, 0 to 65535. But this is not nesecarily the value you will find. You have to make sure that the variable you are storing it in is a word.

Third, that word is an unsigned integer. It is in a format that I do not completely understand called the two's complement. Someone else will have to tell you what this means because I really have no idea. It will be a positive integer, but there is some way to tell if it is a negative value.

Hope I have been of some help. You can read about all of this in the PBASIC Programming Manual available from Parallax, Inc. In short, it is possible, but it will be a terribly difficult task.

-Jesse, Team 159
__________________
"What most people do not understand is that the Buddha, the Godhead, resides just as comfortably in gears and circuits as in hills and trees. To believe otherwise is to dilute the Godhead."
-Robert Pirsig, Zen and the Art of Motorcycle Maintenance
  #3   Spotlight this post!  
Unread 01-03-2002, 18:38
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
check out this thread
__________________
Brandon Martus
e-mail
  #4   Spotlight this post!  
Unread 02-03-2002, 17:34
Ameya's Avatar
Ameya Ameya is offline
Freelance Goon
FRC #0293 (SPIKE Robotics)
Team Role: Alumni
 
Join Date: May 2001
Rookie Year: 2000
Location: Pennington, NJ
Posts: 67
Ameya is on a distinguished road
Send a message via ICQ to Ameya Send a message via AIM to Ameya
Quote:
Originally posted by Skabana159
Third, that word is an unsigned integer. It is in a format that I do not completely understand called the two's complement. Someone else will have to tell you what this means because I really have no idea. It will be a positive integer, but there is some way to tell if it is a negative value.
In two's complement, the first bit of a number represents the opposite of what it normally would. So, in a two's complement byte, 10000000 would represent -128 instead of +128. All of the other bits count as positive values.

Another example:

10000001 in two's complement is 1 + -128 = -127, while as an unsigned integer it would be 1 + 128 = 129.
__________________
Ameya Agaskar
Team 293 alumnus

Last edited by Ameya : 02-03-2002 at 17:38.
  #5   Spotlight this post!  
Unread 04-03-2002, 20:09
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Here is a succesful implementation of the inverse function that was posted earlier by LeoM for this years robot

The function is in the Sidestep program it is taking the joystick and finding the angle for our 4 wheel steering

Thanks again LEO!!!
Attached Files
File Type: zip pegasus.zip (20.5 KB, 68 views)
  #6   Spotlight this post!  
Unread 13-03-2002, 15:33
Leo M Leo M is offline
Registered User
#0384 (Tucker Tigers)
 
Join Date: Jun 2001
Location: Richmond, VA
Posts: 70
Leo M is just really niceLeo M is just really niceLeo M is just really niceLeo M is just really niceLeo M is just really nice
Matt -

You actually USED it! Great!

How is it working?

I am so glad someone picked up on this - it was just "intellectual exercise" to get me in shape for competition during the fall - but to see someone actually put it in their code! WOW! I'm impressed.

You just never know who will be able to make something useful from your "idle doodling".

Leave it to the FIRST addicts.......
__________________
Leo M.
  #7   Spotlight this post!  
Unread 13-03-2002, 23:27
K. Skontrianos's Avatar
K. Skontrianos K. Skontrianos is offline
Registered User
FRC #0102 (Dexterous Gearheads)
Team Role: Alumni
 
Join Date: Nov 2001
Rookie Year: 2000
Location: Somerville, NJ
Posts: 100
K. Skontrianos is an unknown quantity at this point
Using inverse trig is one of the possible ways we plan to guide our GPS bot. If we do decide to use it, it will be a very good implementation of the inverse algorithm. When its all done, I'll make sure to post clips of the bot in action and some of the methods we used to get it to work. Thanks for the inverse suggestions so far.
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
Inverse Tangent D.Viddy Programming 10 25-01-2003 22:24
Trig archiver 2001 4 23-06-2002 23:14
Return of the Inverse Trig Functions Leo M Programming 3 24-01-2002 08:12
Vector Mathematics in PBASIC Adrian Wong Programming 10 06-12-2001 17:31


All times are GMT -5. The time now is 17:42.

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