CS684: Embedded System Course

Lab 4: Case Study - Adaptive Cruise Control (Embedded C)


AIM

In this task, you will learn the concept of line following algorithm.

  • The arena provided to you is made up of curved, zig-zag, and straight paths with a START and GOAL position for the robot as shown in following figure.
  • Arena also consists of obstacles randomly placed.
  • You have to program the robot which will begin from START position, follow the path avoiding obstacles and stop at the GOAL position.

The program is provided as Eclipse project. But, the program contains few incomplete functions which you would have to complete to achive the aim.


PROCEDURE

Step-1: Download lab4_line_follower_robot zip folder. Right-click on the hyperlinks and select Save Link As... option to download. Extract the zip file. Start Eclipse, click on File > Open Projects From File System > Directory and browse for lab4_line_follower_robot folder to open the project.

Step-2: In src/eBot_Sandbox.cpp, complete the traverse_line_to_goal function to achieve the following:

  1. Robot starts from START position.
  2. Follows the line and checks for obstacles.
  3. If obstacle is found on a path, avoids it and plans the next shortest path.
  4. Stops at GOAL position.

Note: While completing, you have to use the functions defined in eBot_Sim_Predef.h header file. In src/eBot_Sandbox.cpp file, along with traverse_line_to_goal function, some other helper functions are provided. You can complete and use those functions or create your won set of helper functions.

Step-3: Build the project (click on Project --> Build Project). If there are no errors present in your program, the project will get build successfully and you will get the message (on console at bottom pane) as shown below,

**======== Build Finished. 0 errors, 0 warnings  ========**

Step-4: Check the behaviour of the robot on CoppeliaSim.

  • Download the lab4_line_follower_robot.ttt scene. Start CoppeliaSim, click on File --> Open Scene and browse for lab4_line_follower_robot.ttt file to open the scene (shown in Expected Output - CoppeliaSim video).
  • In Eclipse, right click on lab4_line_follower_robot folder (Project Explorer - left pane) and select Run As --> Local C/C++ Application. If no errors are encountered, following message will be displayed onto the console (bottom pane):
Connection Success ... 
0
0
0

 Please Enter Y to Start Simulation:	  Y

Enter 'Y' on console. This will start the simulation in CoppeliaSim.


Simulation: EXPECTED OUTPUT

Software required: CoppeliaSim and Eclipse (refer Installation_Instructions provided to you)

Note: Do not hardcode the path in program. Your code should be generic and it should work for any obstacle positions. During evaluation, your code will be tested for different scene - in which arena will be same but obstacles will be placed at different positions.

Following rules will be followed for obstacle placement:

  • No obstacle will be placed on curved or zig-zag path.
  • Obstacle will always be placed on a line and between two nodes.
  • Only three colored (red, green and blue) obstacles will be used.
  • Any number of obstacles can be present on the arena.

All the best!