%PREDICT Apply odometry model for differential drive robot.
%   calculates the final pose and final pose covariance matrix given
%   a start pose, a start pose covariance matrix and the angular wheel
%   displacements in ENC. PARAMS contains the robot model and the
%   error growth coefficients.
%   Input arguments:
%      R   : differential drive robot object with start pose R.X, R.C
%      ENC : structure with fields
%            ENC.PARAMS.KL: error growth coefficient of left wheel
%            ENC.PARAMS.KR: error growth coefficient of right wheel
%               with unit in [1/m]. 
%            ENC.STEPS(i).DATA1: angular displacements of left wheel
%            ENC.STEPS(i).DATA2: angular displacements of right wheel
%               in [rad] and monotonically increasing
%      PARAMS.B : wheelbase in [m]. Distance between the two wheel
%                 contact points
%      PARAMS.RL: radius of left wheel in [m]
%      PARAMS.RR: radius of right wheel in [m]
%   Output arguments:
%      R    : differential drive robot object with final pose R.X, R.C
%      FXR  : 3x3 process model Jacobian matrix linearized with
%             respect to XROUT
%      PATH : array of structure with fields PATH(i).X (3x1) and 
%             PATH(i).C (3x3) which holds the poses and the pose
%             covariance matrices over the path
%   The function implements an error model for differential drive
%   robots which models non-systematic odometry errors in the wheel 
%   space and propagates them through the robot kinematics onto the
%   x,y,theta-pose level.
%   Reference:
%      K.S. Chong, L. Kleeman, "Accurate Odometry and Error Modelling
%      for a Mobile Robot," IEEE International Conference on Robotics
%      and Automation, Albuquerque, USA, 1997.
%   See also SLAM.

% v.1.1, ~2000, Kai Arras, ASL-EPFL, Felix Wullschleger, IfR-ETHZ
% v.1.2, 29.11.2003, Kai Arras, CAS-KTH: toolbox version

function [r,Fxr,path] = predict(r,enc)

When I try to run this complete code, it asks me to input values for R and Enc. I am not sure whether they are just one digit values or a matrix. Can anyone help me by looking at the description in the code, what kind of input is required.


1 Answer 1


The inputs needed for the function are objects of the structures R and ENC. The member variables are clearly specified in the description. Declare and initialize these values before calling the function. That should solve your problem.

learn more about structures in Matlab and how to initialize one here: https://in.mathworks.com/help/matlab/ref/struct.html

Hope it helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.