I am trying to change the input wheel velocities of a mobile robot according to a position condition ?
if d > 0 & d < 0.4 p.WR = 0.51; p.WL = 0.5; elseif d > 0.4 & d < 0.8 p.WR = 0.5; p.WL = 0.51; elseif d == 0.4 p.WR = 0.5; p.WL = 0.5; end function dt = mydglw9(t,c,p) x = c(1);y = c(2);th = c(3); dx = (((p.r*p.WL)+(p.r*p.WR))/2) * cos(th); dy = (((p.r*p.WL)+(p.r*p.WR))/2) * sin(th); dth= ((p.r*p.WL)-(p.r*p.WR))/p.L; dt = [dx;dy;dth]; pose = [x y th]; end
however i always get the error [ Reference to non-existent field 'WL' ], is there a way to make the solver check the condition before solving the differential equations ?
Best Answer