Differential Drive Kinematics

Differential Drive Kinematics

Động học của hệ truyền động vi sai và cách tính vận tốc từng bánh.

Động học của hệ truyền động vi sai và cách tính vận tốc từng bánh.

Level

Advanced

Source

Source

Author

Author

FTC Lib

FTC Lib

Translator

Translator

FTC26749 aDudu

FTC26749 aDudu

Date Published

Date Published

Jan 18, 2026

Jan 18, 2026

Định nghĩa lớp

Lớp DifferentialDriveKinematics là một công cụ hữu ích để chuyển đổi giữa đối tượng vận tốc khung robot ChassisSpeeds và đối tượng vận tốc bánh xe DifferentialDriveWheelSpeeds, mà đối tượng này chứa vận tốc cho bánh tráibánh phải của robot truyền động kiểu differential drive.

Tạo đối tượng Kinematics

Đối tượng DifferentialDriveKinematics được tạo bằng một tham số constructor bắt buộc, đó là:

  • trackwidth: khoảng cách giữa hai bánh trái và phải của robot differential drive.

Lưu ý:

  • trackwidth phải được cho bằng đơn vị mét (meters).

Chuyển ChassisSpeeds → Vận tốc bánh xe (DifferentialDriveWheelSpeeds)

Phương thức toWheelSpeeds(ChassisSpeeds speeds) được dùng để chuyển một đối tượng vận tốc khung robot (linear velocity + angular velocity) sang một đối tượng vận tốc bánh xe trái/phải.

Điều này hữu ích khi bạn có:

  • vxvận tốc tuyến tính (m/s),

  • omegavận tốc góc (radian/s),
    và cần tính ra:

  • vận tốc trái và phải để điều khiển từng bánh.

// Tạo đối tượng kinematics: track width là 15 inches
DifferentialDriveKinematics kinematics =
  new DifferentialDriveKinematics(15.0 / 254.0);
// Ví dụ vận tốc khung: 2 m/s tiến thẳng, 1 rad/s quay
ChassisSpeeds chassisSpeeds = new ChassisSpeeds(2.0, 0, 1.0);
// Chuyển sang tốc độ bánh xe trái/phải
DifferentialDriveWheelSpeeds wheelSpeeds =
  kinematics.toWheelSpeeds(chassisSpeeds);
// Vận tốc bánh trái
double leftVelocity = wheelSpeeds.leftMetersPerSecond;
// Vận tốc bánh phải
double rightVelocity = wheelSpeeds.rightMetersPerSecond;
// Tạo đối tượng kinematics: track width là 15 inches
DifferentialDriveKinematics kinematics =
  new DifferentialDriveKinematics(15.0 / 254.0);
// Ví dụ vận tốc khung: 2 m/s tiến thẳng, 1 rad/s quay
ChassisSpeeds chassisSpeeds = new ChassisSpeeds(2.0, 0, 1.0);
// Chuyển sang tốc độ bánh xe trái/phải
DifferentialDriveWheelSpeeds wheelSpeeds =
  kinematics.toWheelSpeeds(chassisSpeeds);
// Vận tốc bánh trái
double leftVelocity = wheelSpeeds.leftMetersPerSecond;
// Vận tốc bánh phải
double rightVelocity = wheelSpeeds.rightMetersPerSecond;

Chuyển DifferentialDriveWheelSpeedsChassisSpeeds

Bạn cũng có thể dùng đối tượng kinematics để chuyển đổi ngược: từ vận tốc từng bánh sang vận tốc khung robot.

Phương thức toChassisSpeeds(DifferentialDriveWheelSpeeds speeds) giúp đạt điều này.

// Tạo đối tượng kinematics: track width là 15 inches
DifferentialDriveKinematics kinematics =
  new DifferentialDriveKinematics(15.0 / 254.0);
// Tạo đối tượng chứa vận tốc trái/phải
DifferentialDriveWheelSpeeds wheelSpeeds =
  new DifferentialDriveWheelSpeeds(2.0, 3.0);
// Chuyển về vận tốc khung
ChassisSpeeds chassisSpeeds = kinematics.toChassisSpeeds(wheelSpeeds);
// Vận tốc tuyến tính khung robot
double linearVelocity = chassisSpeeds.vxMetersPerSecond;
// Vận tốc góc khung robot
double angularVelocity = chassisSpeeds.omegaRadiansPerSecond;
// Tạo đối tượng kinematics: track width là 15 inches
DifferentialDriveKinematics kinematics =
  new DifferentialDriveKinematics(15.0 / 254.0);
// Tạo đối tượng chứa vận tốc trái/phải
DifferentialDriveWheelSpeeds wheelSpeeds =
  new DifferentialDriveWheelSpeeds(2.0, 3.0);
// Chuyển về vận tốc khung
ChassisSpeeds chassisSpeeds = kinematics.toChassisSpeeds(wheelSpeeds);
// Vận tốc tuyến tính khung robot
double linearVelocity = chassisSpeeds.vxMetersPerSecond;
// Vận tốc góc khung robot
double angularVelocity = chassisSpeeds.omegaRadiansPerSecond;

Giải thích nhanh thuật ngữ

  • Differential Drive: hệ truyền động với hai trục bánh motor, quay trái/phải để điều hướng.

  • Kinematics: các phép toán mô tả mối quan hệ giữa vận tốc robot và vận tốc từng bánh.

  • ChassisSpeeds: biểu diễn vận tốc tổng thể của robot (vx, vy = 0, omega).

  • DifferentialDriveWheelSpeeds: vận tốc trái/phải của robot differential.

Trackwidth: khoảng cách hai bánh trái — phải.

ADUDU

A proud team of passionate Robotics Enthusiasts competing in nation-wide Technology competitions in Vietnam, the FIRST Tech Challenge and the FIRST Robotics Competition.

Copyright ©

, all rights reserved

Made by aDudu's Programming Department

made by aDudu

made by aDudu

Differential Drive Kinematics