Dynamic Obstacle in matlab environment
Show older comments
if i have a obstacle (represented as (x,y)) in the mobile robot environment by using matlab , how can i make that obstacle move randomly with dynamic speed .
3 Comments
Mischa Kim
on 10 Feb 2014
What do you mean by dynamic speed? Changing velocity (that is, direction and speed)?
Maria
on 11 Feb 2014
Auday
on 16 Jun 2014
Dear all I have two objects with original and destination positions as in below; how I can make them move using rand function, please
%// Define rectangle values origin_x1 = [9.5 9.5 11.5 11.5 ]; origin_y1 = [12.6 14.6 14.6 12.6]; destination_x1 = origin_x1 + 3; destination_y1 = origin_y1 + 2;
%// Define circle values r = 1; v = linspace(0,2*pi); origin_x2 = 15+r*cos(v); origin_y2 = 10+r*sin(v); destination_x2 = origin_x2 - 1; destination_y2 = origin_y2 + 3;
Accepted Answer
More Answers (2)
Mischa Kim
on 10 Feb 2014
I strongly recommend not to "randomize" the position vector since this results in a non-differentiable function. Start with acceleration and work your way back to position by integration. This way you'll at least end up with a solid kinematics system. If you even need to go a step further you have to make sure that the kinetics is compatible, as well.
function rand_mov()
tspan = 0:0.01:5;
X0 = [0 0 0 0];
[T, Xsol] = ode45(@EOM, tspan, X0);
figure
subplot(2,1,1)
plot(T, Xsol(:,1),T, Xsol(:,2))
title('x and vx vs. t')
subplot(2,1,2)
plot(Xsol(:,1), Xsol(:,3))
title('x vs. y')
end
function dX = EOM(t, X)
dX = zeros(4,1);
da = 1;
x = X(1);
vx = X(2);
y = X(3);
vy = X(4);
dX = [vx; da*(rand()-0.5); vy; da*(rand()-0.5)];
end
5 Comments
Maria
on 11 Feb 2014
Mischa Kim
on 11 Feb 2014
From your dynamics course you might remember that the first and second derivatives of position are velocity and acceleration. So far so good. When adding random numbers to a position (e.g. x), you will, by design, see jumps in x at every time step. These types of "jumpy" functions, do not have continuous, bounded derivatives. In other words, there is no velocity vx(t) and no acceleration ax(t) that would result in the x(t) you generated.
This might be acceptable in a simulation, where your obstacle just pops up and disappears at random locations. It will be a problem when you need to implement this kind of scenario with real hardware (say, robots). Obstacles don't just pop up and disappear instantaneously but need to satisfy kinematic constraints (such as twice differentiable position vectors).
Maria
on 12 Feb 2014
Mudasser Wahab
on 18 Aug 2014
Hey can you help me with a problem. How can I simulate a static obstacle?
I have the kinematic model of a differential drive robot. I have been able to navigate it from one point to another in an obstacle free environment. Now I want to insert a static obstacle and ovoid them using obstacle avoidance techniques.
The problem is I don't know How to simulate an obstacle in simulink.
Ruqaiya Attaullah
on 22 Apr 2020
Mudasser Wahab can you please help me in navigating the robot from one point to another. I am having trouble with that.
Maria
on 11 Feb 2014
0 votes
Categories
Find more on Robotics System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!