0

Line Robot - Basic lessons - Additional actions

By now we met 2 actions, for line following and wall following. More of them are available. Here is the complete list:
ActionFunctionShortcut
actionEvacuationZoneevacuationZone()eva
actionLoop0loop0()lo0
actionLoop1loop1()lo1
actionLoop2loop2()lo2
actionLoop3loop3()lo3
actionLoop4loop4()lo4
actionLoop5loop5()lo5
actionLoop6loop6()lo6
actionLoop7loop7()lo7
actionLoop8loop8()lo8
actionLoop9loop9()lo9
actionRCJLinercjLine()lin
actionLineFollowlineFollow()lnf
actionObstacleAvoidobstacleAvoid()obs
actionWallFollowwallFollow()wal
The names decribe actions' tasks fairly well, except for generic actions. They are all empty, not having any particular purpose, and are reserved for some actions You may need in the future. You can use them as they are, or rename them. If You find, for example, all the occurences of "actionLoop1" in "mrm-robot-line.h" and "mrm-robot-line.cpp" in Notepad++, and rename them to "actionLiftBall", You will able to use Your own name in the future. You do not have to stick to this list but can also add Your own actions. However, You will need to change the code in about 6 places for each, so we will not explain this process now.

Startup action of Your whole program can be "actionRCJLine", which can do some initialization, then start "actionLineFollow".

Task: RCJ Rescue Line start.

Make a program that is started using action "actionRCJLine", changes its action to "actionLineFollow", and follows line. When there is a wall on the right side, it should start following that wall and change its current action to "actionWallFollow", where it should immediately stop.