guzhaoyuan / QuadrupedSim

A quadruped robot simulator in Matlab/Simulink

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two years ago after reading "Legged Robots that Balance", I started to work on a MATLAB simulation of a quadruped robot. Initially this project is put in my "toy_code" repo. This semester I will use this quadruped robot for two of my CMU course projects. So it is necessary to create a dedicated repository for it.


General Principle

Simulate a walking quadruped robot is easy (But remember all simulations are wrong), first construct body and legs, then carefully understand the frame transformations among them to get forward and inverse kinematics. So the robot knows how to place its feet.

Then find a good method to simulate the contact forces between a foot and the ground. This is proved to be very difficult because few exisiting contact models are precise enough compared to real world scenario. Besides, bad contact force model can make simulation run slower, for the contact force will make the entire simulation model "stiff". In the current implementation, I use Simscape Multibody Contact Forces Library created by Steve Miller.

Then design a gait planner to move feet in a periodic manner.


Helper code:

  1. forward_kinematics.m Calculate forward kinematics of the robot leg (Each leg is a simple three-joint manipulator. From shoulder to foot tip, jonts are labelled as "shoulder", "upper" and "knee". Then in the forward kinematics they are abbreviated as "s" "u" and "k")
  2. inverse_kinematics.m Calculate inverse kinematics
  3. init_quad_new_leg.m Initialize some parameters

quad_XXXX.slx will be the name of different models. I will make sure all quad_XXXX.sx file has a corresponding init_quad_XXXX.m initialization file.


Notice:

  1. Check this post to properly use contact forces library

About

A quadruped robot simulator in Matlab/Simulink


Languages

Language:HTML 62.2%Language:MATLAB 37.8%