Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

Tracing a square path

After moving the robot in different directions, let's make the rover trace a square path. To do this, our robot will move as follows: forward -> right turn -> forward -> right turn -> forward -> right turn -> forward -> stop:

Inside the LaptopControlRover program, we will create another if condition. Inside this if condition, we will write a program to make the robot trace a square path. The if condition will look as follows:

if(keypressed == 'r' || keypressed == 'R'){forward(); //first forward movementdelay(2000);rightturn(); //first left turndelay(500); //delay needs to be such that the robot takes a perfect 90º right ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content