View unanswered posts | View active topics It is currently Tue Dec 18, 2018 9:07 pm

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
HiTechnic Compass Sensor value out of limits
Author Message
Rookie

Joined: Thu Nov 05, 2015 8:02 pm
Posts: 2
Re: HiTechnic Compass Sensor value out of limits
Hi therobotmaster.
Your problem is just a simple maths error.
In simple speak, the compass sensor reads values in a circle. This circle ending at 359 degrees.
But because its a circle, each value has another value that is the same point.
e.g. 20 degrees is the same as 380 degrees, because its one entire loop of the circle.
The problem with this is that 380 is outside the range of values the compass sensor can process.
Luckily there is a simple solution.
Because the circle loops like I described before, if your value is above 359 degrees (the max compass value), all you have to do is subtract 359 degrees to bring the value down one whole loop and back into the range for the compass sensor, which is, as I explained before, still the same point.

so your code would look something like this:

Hope that helps.

Thu Nov 05, 2015 8:28 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 1 post ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning