The project

Autonomous Truck With Trailer is a continuation on an ongoing project at LiU in the project course TSRT10. The long-term goal is to create an education and research platform within the area of Autonomous Vehicles. The system consists of a LEGO truck equipped with an EV3 control unit and a Raspberry Pi.

The main purpose of the project conducted during the fall of 2021 was to introduce dynamic obstacles for the autonomous truck to avoid.


Motion planner

The truck starts in position (0,0) with a forward orientation towards positive x direction and the goal is at the red cross in (15,15) with a forward orientation towards positive y direction. The red moving dots are dynamic obstacles. The Motion Planner generates several trajectories from its current state and the trajectory that takes the truck closest towards goal without intersecting with an obstacle is chosen. The first motion primitive from the selected trajectory is driven. While driving, the trajectory generation is repeated from the end of the motion primitive. When the truck is close to goal, the trajectory that takes the truck to the desired goal position and orientation is extracted from a Heuristic Lookup Table.

Obstacle Simulator

The Obstacle Simulator generates trajectories for two types of dynamic obstacles. Both pedestrians and ground vehicle type objects can be simulated with stochastic or deterministic behaviour.


To predict the movement of dynamic obstacles, a predictor has been implemented. The purpose of the predictor is to predict the states in the motion models within a time-horizon, utilizing an extended Kalman filter.

MPC controller

A trajectory tracking MPC has been developed to allow the LEGO truck to follow the trajectories provided by the Motion Planner. The MPC translates the reference path from the Motion Planner to a trajectory with a set forward and reversing speed. It then solves a non-linear optimization problem at each time step, enabling tracking of the reference.

The predicted trajectory derived from the MPC controller and the dynamic obstacle’s predicted trajectory are compared for collision analysis, enabling the truck to avoid crashing into the obstacle.


The MPC, Obstacle Simulator and Predictor have all been successfully implemented in ROS and integrated with the previous years system. Given user input in form of starting pose and goal pose, the system can plan and execute the mission without crashing into any static obstacle. The mission can include both straight and curved segments and consist of both forward and reversing parts. As long as the start and goal poses are feasible, the MPC can make the LEGO truck track the reference trajectory provided from the planner. By comparing the truck trajectory from the MPC and the obstacle trajectory from the Predictor, dynamic obstacles can also be successfully avoided.

The Motion Planer is developed in a Python environment and was not integrated in ROS with the other subsystems this year. The Motion Planner successfully plans in an environment with both static and dynamic obstacles. Given start and goal, the planner can consider all obstacles and their future trajectories within a given horizon, and plan a feasible path to the goal that avoids the aforementioned obstacles.


Johan Rosengren

Project Leader

Erik Sellén

Software Architect

Daniel Larsson

Team Member

Daniel Similä

Design Manager

Gustav Ingemarsson

Document Manager

Jesper Sjöblom

Team Member

Olof Bergström

Test Manager