Solve Geometry Problem for Senior Design Project

  • Thread starter Thread starter Abyss
  • Start date Start date
  • Tags Tags
    Geometry
AI Thread Summary
The discussion focuses on a method for determining the location of a robot within a square arena using distance measurements from sensors on all four sides. The user has been exploring solutions but seeks a more elegant approach than a complex series of if-else statements. A proposed solution involves calculating distances to the walls based on the robot's angle and iteratively refining its position until a satisfactory accuracy is achieved. The user has visualized the problem and developed a method to find potential solutions by intersecting sensor readings. Ultimately, the approach aims to balance accuracy with code simplicity, acknowledging the challenges in maintaining precise angle measurements.
Abyss
Messages
6
Reaction score
0
Hi guys, I'm doing my senior design project and we've decided upon a method for finding the location of our robot in the square arena that we have built. The method we are using involves sensors on all four sides of the robot (each at 90 degrees of the two adjacent) that return the distance to one of the straight walls of the arena.

I am sure that given the 4 lengths from the robot to the walls of the arena, and knowing the angle that the robot is at, that it is possible to find the location the robot is at. I've spent a couple days on this problem though, and I haven't been able to come up with a general solution.

I know that with about 200 if-else statements I could program a solution but we need our code to be as elegant as possible.

I have a dozen pages of notes, and I have written an application to help me visualize the problem and test potential solutions, if anyone has any ideas I'd love to hear them.

I attached two pictures of the app, but they really aren't necessary, they may help explain the problem more clearly though.
 

Attachments

  • Problem1.jpg
    Problem1.jpg
    23.4 KB · Views: 397
  • Problem2.jpg
    Problem2.jpg
    23.3 KB · Views: 412
Physics news on Phys.org
A possible solution is to write a function that given an input (x,y,phi) calculates the 4 distances to the wall.
You can do this by intersecting the lines with all the walls.
In each heading you need the nearest intersection that lies in the proper direction.

Then write a second function that approximates your position.
That is:
1. start in the middle with your angle phi.
2. calculate the 4 distances
3. take a small step in the direction with the greatest mismatch
4. repeat 2 & 3 until you cannot get closer any more
5. if your mismatches are reasonably small you have found your position.
 
Thanks for the suggestion, I agree that solution would work. In fact we use something similar in our inverse kinematic solution.

In the end after working with it some more I decided to find all the possible solutions that a single sensors distance/angle could return per quadrant (which look like two line segments connected in a right angle). Then intersect those elbows until a solution is found.

It isn't perfect but elegant enough for my tastes. I've included a screeny which looks quite complicated but alas no graphical depiction of this problem will be simple. The solution for sensor A (in direction of the robot depicted by a small circle a short distance away from the central circle) is in Red, the solution for sensor B is +90 off of sensor A and is green, the solution for C is 180 off of A and is blue and the solution for D is 270 off of A and is yellow. The region enclosed by each solution is shaded in the solutions color, which can help to highlight the different solutions.
 

Attachments

  • problem3.jpg
    problem3.jpg
    25.6 KB · Views: 382
Abyss said:
Thanks for the suggestion, I agree that solution would work. In fact we use something similar in our inverse kinematic solution.

In the end after working with it some more I decided to find all the possible solutions that a single sensors distance/angle could return per quadrant (which look like two line segments connected in a right angle). Then intersect those elbows until a solution is found.

It isn't perfect but elegant enough for my tastes. I've included a screeny which looks quite complicated but alas no graphical depiction of this problem will be simple. The solution for sensor A (in direction of the robot depicted by a small circle a short distance away from the central circle) is in Red, the solution for sensor B is +90 off of sensor A and is green, the solution for C is 180 off of A and is blue and the solution for D is 270 off of A and is yellow. The region enclosed by each solution is shaded in the solutions color, which can help to highlight the different solutions.

That works too. As yet I don't see a more elegant solution.

Note that I expect that you won't be able to keep your phi accurate.
So I think you'll need to use your measurements too to correct phi back to the proper angle.
 
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...
Back
Top