|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
Atlantisbase
Expert
Joined: Tue Oct 14, 2008 7:16 pm Posts: 171 Location: Investigating an unidentified ship sighted in Sector 31428
|
 Compass sensor modes?
I know that based on the documentation provided with the compass sensor that it has both a absolute heading mode and a relative heading mode. Is there a way to access these modes from with in C?
_________________Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
|
| Tue Oct 21, 2008 7:32 pm |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
 Re: Compass sensor modes?
The actual compass hardware only supports an "asbolute" heading mode which has the range 0 to 360.
You can "create" your own relative heading by remembering the heading at the start of your program and then subtracting it from the current absolute heading. You'll need to do a simple adjustment if you want to avoid negative numbers. I suspect this is done in the "NXT-G" blocks
|
| Wed Oct 22, 2008 6:39 am |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Compass sensor modes?
You might find this function helpful:
_________________ Jeff McBride Benson Robotics Club
|
| Wed Oct 22, 2008 9:49 am |
|
 |
|
10nisman94
Novice
Joined: Mon Oct 13, 2008 6:29 pm Posts: 75 Location: Florida, USA
|
 Re: Compass sensor modes?
is there a way to have a program remember a heading by say setting a constant at the beginning of a match, and using that constant as the benchmark for your code?
_________________ PHUHS Robotics Team 516 FTW
Daytona Robofest Winning Alliance Captain Daytona Robofest Inspire Award
|
| Wed Oct 22, 2008 7:54 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Compass sensor modes?
Yes. just use a global variable. For example:
_________________ Jeff McBride Benson Robotics Club
|
| Wed Oct 22, 2008 8:43 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|