Skip to main content

Basic movement programs

Time: 9:30 AM to 10:15 AM
Today you start writing and running real code. By the end of this section, you will have driven your robot with keyboard controls and created your own custom movement pattern.

Run the movement example

SSH into your robot and navigate to the examples folder:
cd ~/picar-x/example
sudo python3 1.move.py
The robot will move forward, turn, reverse, and stop. Watch how it behaves and compare against your Day 1 calibration.

Keyboard control

Take direct control of the robot using your keyboard:
sudo python3 3.keyboard_control.py
Use WASD keys to drive the robot in real time.

Read the code

Open the movement code and read it line by line with the facilitator:
  • What does px.forward(50) do?
  • What does the number 50 represent?
  • Change the speed values and observe what happens

Build your own sequence

Write a custom 3-step movement pattern of your choosing. For example: drive forward for 2 seconds, turn left, then reverse.
Experiment with different speed values and durations. There is no wrong answer here - the goal is to understand how the commands map to physical motion.