Main Content

wheelEncoderOdometryBicycle

Compute bicycle odometry using wheel encoder ticks and steering angle

Since R2020b

Description

The wheelEncoderOdometryBicycle System object™ computes bicycle odometry using the wheel encoder ticks and steering angle of the vehicle.

To compute bicycle odometry:

  1. Create the wheelEncoderOdometryBicycle object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

whlEncOdom = wheelEncoderOdometryBicycle creates a wheelEncoderOdometryBicycle System object with default property values.

example

whlEncOdom = wheelEncoderOdometryBicycle(encoder) creates a wheelEncoderOdometryBicycle System object using the specified wheelEncoderBicycle System object, encoder, to set properties.

whlEncOdom = wheelEncoderOdometryBicycle(Name,Value) sets Properties using one or more name-value pairs. Unspecified properties have default values. Enclose each property name in quotes.

For example, whlEncOdom = wheelEncoderOdometryBicycle('SampleRate',100) sets the sample rate of the sensor to 100 Hz.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Sample rate of sensor, specified as a positive scalar in hertz.

Example: 'SampleRate',100

Data Types: double

Number of encoder ticks per wheel revolution, specified as a positive integer. This value corresponds to the rear wheel of the bicycle.

Example: 'TicksPerRevolution',2048

Data Types: double

Wheel radius, specified as a positive scalar in meters.

Example: 'WheelRadius',0.35

Data Types: double

Distance between front and rear axle, specified as a positive scalar in meters.

Example: 'WheelBase',2.818

Data Types: double

Initial pose of the vehicle, specified as three-element vector of the form [X Y Yaw]. X and Y specify the vehicle position in meters. Yaw specifies the vehicle orientation in radians. All values are in the local navigation coordinate system.

Example: 'InitialPose',[0 0 0]

Tunable: No

Data Types: double

Usage

Description

pose = whlEncOdom(ticks,steer) computes the odometry of a bicycle using the specified wheel encoder ticks ticks and steering angle steer, and returns the position and orientation of the vehicle in the local navigation coordinate system.

[pose,velocity] = whlEncOdom(ticks,steer) additionally returns the linear and angular velocity of the vehicle in the local navigation coordinate system.

example

Input Arguments

expand all

Number of wheel encoder ticks, specified as an n-element column vector. n is the number of samples in the current frame. Each element is the number of ticks for the rear wheel of the bicycle in the corresponding sample.

Example: [5; 2]

Data Types: single | double

Steering angle of the vehicle, specified as an n-element column vector in radians. n is the number of samples in the current frame.

Example: [0.2; 0.2]

Data Types: single | double

Output Arguments

expand all

Position and orientation of the vehicle, returned as an n-by-3 matrix. n is the number of samples in the current frame. Each row of the matrix specifies the position and orientation of a sample in the form [X Y Yaw]. X and Y specify the vehicle position in meters. Yaw specifies the vehicle orientation in radians. All values are in the local navigation coordinate system.

Data Types: single | double

Linear and angular velocity of the vehicle, returned as an n-by-3 matrix. n is the number of samples in the current frame. Each row of the matrix specifies the linear and angular velocity of a sample in the form [velX velY yawRate]. velX and velY specify the linear velocity of the vehicle in meters per second. yawRate specifies the angular velocity of the vehicle in radians per second. All values are in the local navigation coordinate system.

Data Types: single | double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

cloneCreate duplicate System object
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object
isLockedDetermine if System object is in use

Examples

collapse all

Create a wheelEncoderOdometryBicycle System object.

whlEncOdom = wheelEncoderOdometryBicycle;

Specify the number of wheel encoder ticks and the steering angle.

ticks = [5; 2];
steer = [0.2; 0.2];

Compute the bicycle odometry.

[pose,vel] = whlEncOdom(ticks,steer)
pose = 2×3

    0.0054    0.0000    0.0004
    0.0075    0.0000    0.0005

vel = 2×3

    0.5369    0.0002    0.0386
    0.2148    0.0001    0.0154

Extended Capabilities

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

Version History

Introduced in R2020b