Distance Between Two Vectors?

Started by
23 comments, last by ironhand69 15 years, 4 months ago
Quote:Original post by markgame66
Problem is tuning that correction angle as it gets closer to the way point.

I tried the the vector length last night (Well the decimal proportion of). Whilst technically it decreases the value, it's too harsh.

What I want is something to scale that correction angle. A potential function method (the Bellman value function) was mentioned by Emergent on a previous post.


Ok I think popsoftheyear dumbed what I had said a lot sorry to confuse people tried to make it simple. I went back to the books; 3 Calculus book and 2 physics books said the same thing (issues need to be answered), Planar and scalar version of vectors. Just want to get some facts straighten out.

What we need to know or know already:
1) We are talking about Planar vectors
2) in 2D grid based map view
3) real time issues and not discreate
4) computational adjustments from discreate(computer) to real time(real moving robot)
5) movement speed, how fast is fast and how slow is slow???


Problems:
Over correction based on turning radious calculation when close to target.

problem A: how close is close? 1 inch, 1 foot, 100 feet, 1/4 mile? (deals with the speed)
problem B: over turning,
Problem 1b: make adjustments to compensate over turning at speed ***.
Problem C: calculation is too fast when close to target compensation is to rapid.
Solution C: make a clock delay when target is in **** range. (based on speed)
Problem D: where are the corrdance (0,0) once the robot left the starting point.
Solution D: need the idea how you are moving along your axis x,y robot is (0,0), or robot follows a degree based travel plan from the map, and how to orentate the robot.

Tried:
Failed: re-calcuation broad range direction (in motion) from exact calculated magitude(way point).

Here are some of the problems to solutions to figure out again answers are based on distance (magitude), speed, acceleration and time, which we dont have.
I think if you get into the math of vectors too far your going to get into a math nightmare that will keep you awake at night. I still think you have the right idea for the vector problem its the re-calcuation to turning problem is the new issue.
Advertisement
But why is there a need for a clock delay though before responding again though? The closer he gets to the destination, the robot will have the potential to diverge from the "straight path" faster as the angle will change quicker... so instead of cutting the correction but some factor based on the distance, why not allow for a greater drift (by angle, not distance...) which can be calculated according to some factor based on distance.

By the time the robot is less than a single unit away from the destination, it will be allowed to diverge by say 90 degrees from the original course... but it won't look like it diverged much at all, and by defining an answer to "problem a" (how close is close enough? 1 unit away? .1 units away?), it won't seem like it is going crazy once it approaches its destination.

Of course I'm just thinking about all this logically and have absolutely no experience actually working with such a thing... so take what I say with a grain of salt...
ironhand69 - filling in some more details:

Each cell in the 2D grid represennts 4cm in the real world.
At the moment (This will change to smoother motion once I get this steeting solution sorted) the robot recieves a "MOVE_FORWARD" command ~once a second. If it finds it outside the allowable orientation (Measured with a Gyroscope) then it will steet left or right X degrees to correct.

Movement speed isn't realy relavant given the motion at the moment.


popsoftheyear - Things can get out of hand when within 2-3 cells from a way point.

I see what you're saying re allowing the diverge angle to change. But I think this equates to the same thing. i.e. what alg to use to allow that increase as distance to way point decreases.

[Edited by - markgame66 on December 3, 2008 7:14:14 AM]
Quote:Original post by popsoftheyear
But why is there a need for a clock delay though before responding again though? The closer he gets to the destination, the robot will have the potential to diverge from the "straight path" faster as the angle will change quicker...


A clock will help keep a forward motion longer whether in a straight line or drifting off the direction of choice. It also slows down the pace of the process (the brain) from micro seconds to seconds or even mins if you need the time. The algorthm it self is a type of clock taking **** nano-seconds to process each instructions and then repeat. Things get complex when we switch from the analog world to the digital world and then back again.

Quote:Movement speed isn't realy relavant given the motion at the moment...

Ok, Think of it this way your driving a lawn tractor and a friend is driving a car and another friend is flying a plan at sub sonic speed, another friend is flying a jet super sonic. Who will have a smoother transaction the closer they reach the same exact destination? Who will have more time to compansate the change if drift is off.

you have a processor that is working at super sonic and travel time at snail pace. Its ok, we can do this.

A) now we have to say well over distance traveled or related time re-calculate your "new" mag. for direction maybe not compensate for travel path.

B)If we copensate direction were going to follow the path as a saw-tooth direction.

C) Have the process stop calculation with in 1 or 2 cm from destination and start recalculation for new direction. this may give enough (dought it) time to reach the destination and turn to new direction

D)Let me ask my Mentor on this you caught my interest on this topic and this deals with things we sometimes run into implementing software to hardware.
Quote:Original post by ironhand69
Quote:Original post by markgame66
Given this:
2 cartesian points on a grid(Map): (1,1) and (9,9).

As the robot progresses along the path the heading may change (Drifts off the path +5 degrees here -10 degree there to say in line with point (9,9)). Problems happen as it approachs ... on the grid. ... at (8,8). Then the correction angle would be 45 degrees.

So what I wanted ... will reqduce the correction angle as the ... approached -...

Mark


I think you have the right idea you just need to think that computers do exactly what their told to do. Try to use a approximation. actual grid(3.2,5.4) robot travels with (3,5) the detail of the end result is the min for correction, its close enough thought.


I had a long talk with my Mentor on this one, with the information I had. He stated the same thing I was talking about except he used:
fuzzy logic< /a>
Fuzzy logic
here is two sites that explain what fuzzy logic is about.

vector plotted and mag found(x,y,*map_corr,*end_point){
map corr [5.68,6.89]
end_point_checking[a]= map corrdanates entered.roundup[0] //double to int covertion
end_point_checking= map corrdanates entered.roundup[1] //double to int covertion
***other stuff happens***

final result for travel is:
end_points_checking[6,7]

Use are we at grid logic;
check
x = convert.int(double end_point[0]);
y = convert.int(doulbe end_point[1]);
if (x = end_points_checking[0] and y = end_point_checking[1]){
stop travel;
if (x < end...checking[0]+ 5){
calculate new heading adjust by heading/2;};
if (y < ... same as x idea){}
};
/////////////////////////////
its just the idea what Im talking about,,(I hope) my high level programming is quite shaky right now.

Question was brought up:
if you only have a map tick in integers how do I get it to form a double.

Answer was: two counters count upper ticks and count lower ticks
upper ticks 1 tick = 10 lower ticks// it could be any thing you want 2,5,10 etc.
lower ticks 1 tick = map sector in cm

***Post this see if it needs changes in a min***>

[Edited by - ironhand69 on December 4, 2008 4:41:42 PM]

This topic is closed to new replies.

Advertisement