- #1
echoone10
- 1
- 0
Hello everyone. First of all, thank you for any help you can provide.
The essence of the problem is this. I am given the linear and angular velocity of an object at a given moment in time.
Data looks like this:
Time(s): Linear velocity (m/s) Angular velocity(rad/s)
10.313 0.075 0.241
Given the previous position (in x/y cooridnates) and orientation (angle in radians), and this information, I want to calculate the new position and orientation 0.1 seconds later.
Equations I've been using:
radius of turning = linear velocity/angular velocity
change in theta = angular velocity * timestep(0.1 seconds)
x-coordinate = r*cos(theta)
y-coordinate = r*sin(theta)
I realized that we don't really know whether the object will be moving about a circle to its left, or a circle to its right (i.e. is angular velocity clockwise or counter clockwise). I decided to pick one and stick with it, to see how it went.
I'm programming in MATLAB, so here is the code for the function I've written:
I'm beginning to suspect that I don't have enough information to get the proper answer, but I would be happy to be wrong.
Again, thank you all for any help.
The essence of the problem is this. I am given the linear and angular velocity of an object at a given moment in time.
Data looks like this:
Time(s): Linear velocity (m/s) Angular velocity(rad/s)
10.313 0.075 0.241
Given the previous position (in x/y cooridnates) and orientation (angle in radians), and this information, I want to calculate the new position and orientation 0.1 seconds later.
Equations I've been using:
radius of turning = linear velocity/angular velocity
change in theta = angular velocity * timestep(0.1 seconds)
x-coordinate = r*cos(theta)
y-coordinate = r*sin(theta)
I realized that we don't really know whether the object will be moving about a circle to its left, or a circle to its right (i.e. is angular velocity clockwise or counter clockwise). I decided to pick one and stick with it, to see how it went.
I'm programming in MATLAB, so here is the code for the function I've written:
Code:
function [newx newy neworient] = newstate(l_vel, ang_vel, tstep, old_orient, old_x, old_y)
r = (l_vel/ang_vel);
del_orient = ang_vel * tstep;
neworient = old_orient + del_orient;
center_x = old_x - r*cos(neworient);
center_y = old_y - r*sin(neworient);
newx = center_x + r*cos(del_orient);
newy = center_y + r*sin(del_orient);
end
I'm beginning to suspect that I don't have enough information to get the proper answer, but I would be happy to be wrong.
Again, thank you all for any help.