Clear Filters
Clear Filters

Plotting a relation from a describing equation - optimized trapezoidal steering optimization

2 views (last 30 days)
I am trying to write a program which will allow me to quantify how optimized trapezoidal steering differs from the exact Ackerman steering for a given set of steering parameters (). To do that I want to find the root mean square error between the outer angle in trapezoidal steering () and in Ackerman steering () for a given inner angle .
The Ackerman relation is described by the following equation (1):
Optimized trapezoidal steering steering is described by (2):
To find , I created two vectors - one corresponding to the inner angles and the one to the outer angles. Then for each inner angle (in a loop) I substituted the whole vector of outer angles into eq. 2 and looked for the outer angle which results in being minimal. Below is my code:
close all
clear all
%% Constants
W = 2400; %track width in mm
L = 4800; %wheelbase in mm
D = 400; % steering arm length
B = 8* (pi/180); % angle beta with conversion to radians
in_vec = -40:40 ; %vector of inner angles in degrees
in_vec_rad = in_vec*(pi/180); %converted to radians
out_vec = -50:1e-3:50; %vector of outer angles for comparisons (much wider in span)
out_vec_rad = out_vec*(pi/180); %converted to radians
outer_a = zeros(1,numel(in_vec_rad)); %preallocation
outer_t_estim = zeros(1,numel(in_vec_rad));
offset_t = zeros(1,numel(in_vec_rad));
for i = 1:numel(in_vec_rad)
outer_a(1,i) = acot(W/L+cot(in_vec_rad(1,i))); %ackerman outer angles
% here I look for outer angle value that makes the offset the smallest
offset_t = abs((W/D) + ((W/D-2*sin(B)).^2-(cos(B-out_vec_rad)-cos(B+in_vec_rad(1,i))).^2).^(1/2) - sin(B+in_vec_rad(1,i))-sin(B-out_vec_rad));
outer_t_estim(1,i) = out_vec_rad(1,idxt);
grid on
hold on
The problem I am facing is that the final plots as a straight line. Is the approach generally incorrect or is there something wrong in the code?

Answers (2)

Pranav Murali
Pranav Murali on 19 Mar 2020
Hi Igor,
I see that you’ve been trying to visualize the difference between optimized trapezoidal and Ackerman steering. Finding out the root mean square error between the outer angles of Ackerman and optimized trapezoidal steering seems to be a promising approach. The code is does exactly what you have described. However, output angle is the only parameter that changes inside the loop.
Since all the other terms inside your formula are constants, the offset depends directly on the array of output angles. The vector storing the output angles you have created is linearly spaced. This causes the result also to be a linearly increasing vector since there is no relationship between a variation in the output angle to any other term in the equation. The smallest element is always at the first position. Hence you arrive at the output that is visible, your current method will produce the same pattern as it is directly related to the smallest element in the output angle vector.

Robert Shaefer
Robert Shaefer on 12 Apr 2021
there is an error in the equation (2). It should read:
....= w/d "minus" sqrt(....




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!