HDrive Simulation Framework

Full Simulation & Utilities Java Package For H-Drive

A full framework for H-Drive systems in java, simulation, drivebase & safety functions, kinematics, odometry, & both descriptive and raw sysid system characterization.


Simulating an H-Drive based on either description: weight, gearbox ratio, motor type, etc or on raw sysid characteristics for both the lateral movement plant and the primary drive plant. The simulation allows for independent control of all three motor plants and the introduction of noise vectors for more realistic testing.

H-Drive Simulation Demo - YouTube

Drivebase Function & Safety

Supports Tank, Arcade, & Field Relative drive by default with tank and arcade drive having a third input for the lateral movement. All of these functions come with the motor safety class integrated.

Kinematics, Odometry, & Utilities

Built in kinematics, odometry, & expected functions found in built in classes such as DifferntialDriveKinematics, including getPoseMeters(), resetPosition, update(), toWheelSpeeds, toChasisSpeeds, to Twist2, & more allowing for easy use & integration similar to WPIlibs built in drive bases.

Kalman Filter Pose Estimation!

Using a combination of all the utilities above culminates in this feature, a functional poseEstimator class which allows for reading encoder and gyroscope data continually to estimate location & then updating asynchronously with vision measurements to help continually re-zero the bots position in the field. This class functions identically to WPIlibs Differential Drive Pose Estimator in use making it easy to plug into a code base.

Note green outline is real position, bot is estimated position after noise is introduced & the bot has been driven for over 2 minutes in an attempt to introduce error, green lines represent detected april tags (4 camera config since it’s what my team is using)

Public Release

Full code release of the system this is used in will come in December, but release of just the H-Drive package containing all these features will come out on February 20th when I’ve finished cleaning it up and writing the documentation, if anyone is interested in accessing it sooner just ask. Hopefully this means no other programmer subteam will have to suffer the same way I did trying to implement all this during build season.


If anyone is interested in helping improve or document this code let me know.


Package Link

HDrive Package for FRC (java)


This is not yet formed into a proper maven package that will be coming soon sorry for the inconvenience.

1 Like

Nice job! HDrives arent that popular but always fun to see when people do them :smile:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.