
Algebra PreAlgebra and Basic Algebra Math Forum 
 LinkBack  Thread Tools  Display Modes 
May 10th, 2009, 09:16 PM  #1 
Newbie Joined: Feb 2009 Posts: 5 Thanks: 0  Question about calculating xy values...
Hey everyone, Please see the attached image! Basically, I have a robot car that drives in a square from 1) to 2) to 3) to 4) and then back to 1). On its first iteration, each side of the "square" is 12 inches. On the second iteration, each side is 24 inches, and so on and so on. The robot has a sweeping sensor that sweeps from the right to the left, 180 degrees (with the right being 0, the left being 180). The sensor is able to detect if there is an object in front of it, and how far it is away. In my picture, this distance is represented as 'a'. On its first sweep at 1. (this is before it drives anywhere), I have the robot successfully mapping the object using : Code: x = (a * cos[angle]) y = (a * sin[angle]) I have tried adding 90 degrees to the angles in the rest of the states, but that doesn't work either. I have also tried adding the robot's current position (x and y) to the above formula, and that doesn't seem to provide correct results either. My question is, how should I change my x and y calculations to be correct in states 2, 3, and 4? Please help, thanks! 
May 11th, 2009, 06:23 AM  #2 
Global Moderator Joined: Dec 2006 Posts: 20,929 Thanks: 2205 
Use a separate formula for each direction of the robot. Let (p, q) denote the robot's current position, and ? denote the angle. Note that the object isn't necessarily "in range"; what follows applies when it is. If the robot is on its way from position 1 to position 2, you will have p = 0 and the object's position will be given by (x, y) = (a*cos(?), q + a*sin(?)). If the robot is on its way from position 4 to position 1, you will have q = 0 and the object's position will be given by (x, y) = (p  a*sin(?), a*cos(?)). Can you now find the remaining formulas? 
May 11th, 2009, 08:06 AM  #3 
Newbie Joined: Feb 2009 Posts: 5 Thanks: 0  Re: Question about calculating xy values...
Thanks for your help, I really appreciate it! For the remaining state (3), I am thinking the following: Code: x = (a * cos[(servo_angle)]); y = (a * sin[(servo_angle)]); 
May 11th, 2009, 02:25 PM  #4 
Global Moderator Joined: Dec 2006 Posts: 20,929 Thanks: 2205 
Incorrect  you seem to be just guessing, rather than working it out. If you try to give your reasoning, you are likely to do better.


Tags 
calculating, question, values 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Hypothesis Testing question on calculating errors  Keroro  Advanced Statistics  0  October 27th, 2012 12:54 PM 
Grouping values question from newbie  druj  Abstract Algebra  1  November 18th, 2011 06:09 PM 
Expected values and variance question.  latortuga  Advanced Statistics  2  June 14th, 2011 04:13 PM 
calculating distance using using trig values?  polkadotprincess19  Algebra  4  June 4th, 2010 06:23 AM 
Calculating Eigen Values error  Singularity  Linear Algebra  2  April 18th, 2010 01:49 PM 