Main Content

velocityCommand

Retrieve velocity command from time series of velocity commands

Since R2023a

    Description

    velout = velocityCommand(velcmds,timestamps,timeq) retrieves the velocity command velout, at the queried time instant timeq, from a series of velocity commands, velcmds, and corresponding timestamps, timestamps.

    example

    Examples

    collapse all

    Specify a set of velocity commands and corresponding timestamps.

    velcmds = [0 0.5 1.0 1.2 1.4 1.5; ...
               0 0.2 0.5 0.2 0 0]';
    timestamps = [0; 0.11; 0.2; 0.32; 0.45; 0.7];

    Specify the query time.

    timeq = 0.55;

    Retrieve the velocity command at the queried time instant.

    velout = velocityCommand(velcmds,timestamps,timeq);
    disp("Set linear velocity to " + velout(1) + ...
        " and angular velocity to " + velout(2) + ".")
    Set linear velocity to 1.4 and angular velocity to 0.
    

    Input Arguments

    collapse all

    Series of velocity commands, specified as an N-by-2 matrix, where the first column is the linear velocity and the second column is the angular velocity.

    Data Types: double

    Timestamps of velocity commands, specified as an N-element column vector. Each element is the timestamp for the corresponding row in the velcmds input.

    Data Types: double

    Query time, specified as a positive numeric scalar.

    Data Types: double

    Output Arguments

    collapse all

    Velocity command, returned as a two-element row vector containing the linear and angular velocity at the queried time timeq.

    Extended Capabilities

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

    Version History

    Introduced in R2023a

    See Also

    Functions

    Objects