This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

robotics.OdometryMotionModel class

Package: robotics

Create an odometry motion model

Description

OdometryMotionModel creates an odometry motion model object for differential drive robots. This object contains specific motion model parameters. You can use this object to specify the motion model parameters in the robotics.MonteCarloLocalization object.

This motion model assumes that the robot makes pure rotation and translation motions to travel from one location to the other. The model propagates points for either forward or backwards motion based on these motion patterns. The elements of the Noise property refer to the variance in the motion. To see the effect of changing the noise parameters, use robotics.OdometryMotionModel.showNoiseDistribution.

Construction

omm = robotics.OdometryMotionModel creates an odometry motion model object for differential drive robots.

Properties

expand all

Gaussian noise for robot motion, specified as a 4-element vector. This property represents the variance parameters for Gaussian noise applied to robot motion. The elements of the vector correspond to the following errors in order:

  • Rotational error due to rotational motion

  • Rotational error due to translational motion

  • Translational error due to translation motion

  • Translational error due to rotational motion

This property is read-only.

Type of the odometry motion model, returned as 'DifferentialDrive'. This read-only property indicates the type of odometry motion model being used by the object.

Examples

collapse all

This example shows how to use the robotics.OdometryMotionModel class to predict the pose of a robot. An OdometryMotionModel object contains the motion model parameters for a differential drive robot. Use the object to predict the pose of a robot based on its current and previous poses and the motion model parameters.

Create odometry motion model object.

motionModel = robotics.OdometryMotionModel;

Define previous poses and the current odometry reading. Each pose prediction corresponds to a row in previousPoses vector.

previousPoses =  rand(10,3);
currentOdom = [0.1 0.1 0.1];

The first call to the object initializes values and returns the previous poses as the current poses.

currentPoses = motionModel(previousPoses, currentOdom);

Subsequent calls to the object with updated odometry poses returns the predicted poses based on the motion model.

currentOdom = currentOdom + [0.1 0.1 0.05];
predPoses = motionModel(previousPoses, currentOdom);

This example shows how to visualize the effect of different noise parameters on the robotics.OdometryMotionModel class. An OdometryMotionModel object contains the motion model noise parameters for a differential drive robot. Use showNoiseDistribution to visualize how changing these values affect the distribution of predicted poses.

Create a motion model object.

motionModel = robotics.OdometryMotionModel;

Show the distribution of particles with the existing noise parameters. Each particle is a hypothesis for the predicted pose.

showNoiseDistribution(motionModel);

Show the distribution with a specified odometry pose change and number of samples. The change in odometry is used as the final pose with hypotheses distributed around based on the Noise parameters.

showNoiseDistribution(motionModel, ...
            'OdometryPoseChange', [0.5 0.1 0.25], ...
            'NumSamples', 1000);

Change the Noise parameters and visualize the effects. Use the same odometry pose change and number of samples.

 motionModel.Noise = [0.2 1 0.2 1];
 
 showNoiseDistribution(motionModel, ...
            'OdometryPoseChange', [0.5 0.1 0.25], ...
            'NumSamples', 1000);

Methods

showNoiseDistributionDisplay noise parameter effects
stepComputer next pose from previous pose

Limitations

If you make changes to your motion model after using it with the MonteCarloLocalization object, call release on that object beforehand. For example:

mcl = robotics.MonteCarloLocalization(...); 
[isUpdated,pose,covariance] = mcl(...); 
release(mcl) 
mcl.MotionModel.PropName = value; 

References

[1] Thrun, Sebatian, Wolfram Burgard, and Dieter Fox. Probabilistic Robotics. MIT Press, 2005.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2016a