LuaBot

Lua Scripting for FRC Robots

LuaBot enables you to program FRC robots using LuaJIT, providing full access to WPILib's HAL, command-based framework, and simulation capabilities.

Installation

Add the LuaBot vendordep to your robot project:

Vendor Dependency URL:

https://maven.luabot.org/LuaBot.json

Steps:

  1. Open your robot project in VS Code with WPILib extension installed
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS)
  3. Type "WPILib: Manage Vendor Libraries"
  4. Select "Install new libraries (online)"
  5. Paste the vendor dependency URL above
  6. Click OK

What Gets Installed

Example Robot Code

local class = require('luabot.class')
local TimedRobot = require('wpi.frc.TimedRobot')
local XboxController = require('wpi.frc.XboxController')

local MyRobot = class (TimedRobot)

function MyRobot:robotInit()
    self.controller = XboxController.new(0)
end

function MyRobot:teleopPeriodic()
    local speed = self.controller:getLeftY()
    -- Drive code here
end

return MyRobot

Resources