Khushant Khurana
  • Resume
  • Transcript
  1. Using Gazebo and Ros2 to Simulate And Control an Inverted Pendulum​
  • Home
    • • Introduction
  • Past internships
    • • Defense Science and Technology Graduate Intern @ Lawrence National Lab
    • • Aviation Systems Engineer Intern @ Garmin
    • • Controls Intern @ Oshkosh Corporation
  • Past research
    • • Graduate Student Researcher @ Dynamics & Control Lab
  • Projects
    • • Guidance Navigation & Control
    • • Dynamics & Control
    • • Simulation & Analysis
    • • Mechanical Design & Fabrication

On this page

  • Brief Overview
  • Controller Implementation:
    • 1. PI (Proportional- Integral)
    • 2. LQR (Linear Quadratic Regulator)
  • Supporting Files

Using Gazebo and Ros2 to Simulate And Control an Inverted Pendulum​

Brief Overview

As an introduction to using Gazebo for simulating physics and controllers, I implemented a PI controller for inverted pendulum. I designed the Gazebo model using .sdf format which consisted of base frame, a slider with prismatic joint, and the pendulum with revolute joint constrained to the slider. To get the orientation of the pendulum, I used an IMU. On the Ros2 side, I created a node that imported the IMU data from Gazebo and actuated the prismatic joint velocity using a PI controller. The briding between Ros2 and Gazebo is done using a .yaml file. A launch file is also created to launch the controller, bridge, and gazebo model. The rqt_graph of the Ros2 is provided below.

Controller Implementation:

1. PI (Proportional- Integral)

K_p = 0.27, K_I = 0.26

Video

2. LQR (Linear Quadratic Regulator)

K = [0, 1.5, 0, 0.4] for state vector = [cart_position, roll angle, cart_velocity, roll_velocity]

Video

Supporting Files

The corresponding code can be found here

 
Copyright 2023, Khushant Khurana