中文 | English
A hands-on robotics simulation course — from model building to algorithm verification — powered by CoppeliaSim. Battle-tested at Beijing Institute of Technology.
Real-time GUI Speed Control |
Autonomous Obstacle Avoidance |
This repository contains a complete teaching resource kit for CoppeliaSim (formerly V-REP), covering the full pipeline from robot model construction to control algorithm verification. It was developed and refined through multiple semesters of undergraduate robotics courses at Beijing Institute of Technology (BIT).
The course is designed as a 6-hour practical curriculum split into two parts:
| Part | Focus | Duration |
|---|---|---|
| Modeling | Interface, physics, sensors, joints | ~3 hours |
| Programming | Lua scripting, GUI, MATLAB co-simulation | ~3 hours |
By the end, students build a functional differential drive car from scratch — including wheels, chassis, sensors, and intelligent control — and learn to extend it with external MATLAB algorithms.
- 📖 Bilingual Courseware — 55-slide Chinese and 60-slide English PPTs with step-by-step screenshots
- 🤖 Ready-to-Run Models — 3
.tttsimulation models: pure model, GUI control, obstacle avoidance - 🔧 Open Code — Lua embedded scripts and MATLAB Remote API toolkit, fully commented
- 🎓 Proven Pedagogy — Tested with real students, refined through multiple semesters
| Tool | Version | Download |
|---|---|---|
| CoppeliaSim Edu | v4.2.0 (recommended) | Official · Baidu Cloud (code: 5iwt) |
| MATLAB | 2021b or later | MathWorks |
⚠️ Version 4.2.0 is recommended. Newer versions may have API differences that affect compatibility.
- Download a model file, e.g.,
models/2_car_model_lua_random_run/Car_For_PC_Lua_RR.ttt - Open it with CoppeliaSim
- Click Play ▶ — the car moves with the GUI control panel
| Step | Action | Resource |
|---|---|---|
| 1 | Read Part 1 of the slides | docs/slides_zh.pptx or docs/slides_en.pptx |
| 2 | Build the car model following the slides | Step-by-step screenshots included |
| 3 | Read Part 2 — Lua scripting & MATLAB | Slides + code/ directory |
| 4 | Run and modify the code | See code/*/README.md for each module |
├── README.md # English (this file)
├── README_zh.md # 中文版
├── LICENSE # CC BY-NC-SA 4.0
├── assets/
│ ├── lua_rand_run_gui.gif # GUI control demo
│ └── lua_collision_avoidance.gif # Obstacle avoidance demo
├── docs/
│ ├── slides_zh.pptx # 55-slide Chinese courseware
│ └── slides_en.pptx # 60-slide English courseware
├── models/
│ ├── 1_car_model_pure/ # Basic car model (no script)
│ ├── 2_car_model_lua_random_run/ # GUI-controlled car
│ └── 3_car_model_lua_obstacle_avoidance/ # Obstacle avoidance car
└── code/
├── 1_basic_control/ # Lua: basic motor control
├── 2_gui_control/ # Lua: GUI speed panel
└── 3_matlab_cosenim/ # MATLAB: Remote API co-simulation
- What is CoppeliaSim and why use it
- Installation and interface walkthrough
- Dynamics simulation examples
- Build drive wheels (cylinder → physics → texture)
- Build chassis and omni-wheel
- Add revolute joints with actuation
- Configure proximity and vision sensors
- Merge into a reusable model base
- CoppeliaSim script types and lifecycle
- Basic motor control via Lua
- Adding Graph for real-time data visualization
- Building a custom GUI control panel
- Implementing autonomous obstacle avoidance
- Remote API setup (copy
remoteApi.dll, see guide) - Connection test and object querying
- Synchronous simulation control
- Migrating obstacle avoidance algorithm from Lua to MATLAB
| Function | Called When | Typical Use |
|---|---|---|
sysCall_init() |
Simulation starts | Get handles, initialize variables |
sysCall_actuation() |
Each control step | Set motor velocities, send commands |
sysCall_sensing() |
Each sensing step | Read sensors, update state |
sysCall_cleanup() |
Simulation ends | Destroy UI, release resources |
| Function | Purpose |
|---|---|
simxStart(ip, port, ...) |
Connect to CoppeliaSim |
simxGetObjectHandle(clientID, name, ...) |
Get object handle |
simxSetJointTargetVelocity(clientID, handle, vel, ...) |
Control motor |
simxSynchronous(clientID, true) |
Enable step-by-step mode |
simxSynchronousTrigger(clientID) |
Advance one simulation step |
📖 Full API Docs: MATLAB Remote API Functions
This project is licensed under CC BY-NC-SA 4.0.
You are free to share and adapt for non-commercial purposes with attribution and under the same license.
Junhang Lai (赖俊杭) Beijing Institute of Technology
- Simulation models and some code snippets reference the CoppeliaSim Official Tutorial
- Courseware developed for the robotics simulation curriculum at BIT

