Professional Documents
Culture Documents
Assignment 1: Utilising Abstraction of Sensor Classes: 10 Mar 2022 - Initial Release
Assignment 1: Utilising Abstraction of Sensor Classes: 10 Mar 2022 - Initial Release
Intent: Skills in utilising, classes, functions, pointers and utilising abstraction, encapsulation, inheritance,
polymorphism with appropriate documentation will be assessed.
Individual Task
Weight: 20%
Task: Write a program in C++ using object oriented paradigms that embodies a range of platforms, utilising abstraction,
encapsulation, inheritance and polymorphism. Supply appropriate auto-generated documentation utilising inline
source mark-up.
Rationale: In a Mechatronics System we would use a class to represent a real-world object such as a robotic platform
(vehcile, drone). In large projects to facilitate testing it is common to develop a mock (fake) platform class that behaves
the same as the real platform. This allows for some system testing without the presence of all hardware.
Platform control of similar nature are often abstracted from a base platform (ie. moving apltaform to reach a goal has
similar functionality, but depends on the platform kinematics/design). This allows treating a suite of platforms in an
abstract manner when navigating them to goals for a mission, the remaining of our processing code can be agnostic
to the platform type.
Contents
Contents ............................................................................................................................................................................ 1
Assignment Specifics ..................................................................................................................................................... 2
Assessment Criteria ...................................................................................................................................................... 4
Platform: Audi R8 (Akerman Steering).......................................................................................................................... 6
Sensor: Sonar ................................................................................................................................................................ 7
An Example Configuration of Sensors ............................................................................ Error! Bookmark not defined.
Automated testing of code ........................................................................................................................................... 8
FAQ (extract from Teams Discussion) ........................................................................................................................... 9
Assignment Specifics
The assignment uses a physics simulator called gazebo. Students are provided with the simulator, installation
instructions are in the README.md file under skeleton/a1_setup
Students are provided skeleton code in a1_skeleton folder that they need to use and develop from. There are two
Interface Classes MissionInterface and ControllerInterface that stipulate the functionality of the Mission or
Controller/Ackerman/Quadcopter class. The Controller class is the base class for Ackerman/Quadcopter.
There are two platforms that are used to accomplish a mission, a quadcopter (drone) and a Audi R8 (vehicle with
Ackerman steering). Given they have different kinematics, they could reach goals travelling a different distance or
covering the distance in different speed. The Ackerman platform should be controlled via a constant turn rate
(travels in arcs of a circle) at a fixed throttle (0.2) from standing (stationary). The quadcopter can travel in four
directions (forward / backward / left / right) and can turn left / right, all control should be fixed 0.4. These
constraints allow to compute time to travel as approximate value.
Overall the code should allow the user to specify via main:
The main instantiates the platforms and provides them to the Mission class with the goals and objective. Calling
runMission (of the Mission class) coordinates the platform(s) to reach these goal(s). Upon completing the current
mission new goals can be provided.
Dynamic constraints for the AUDI R8 are provided below, it grips the road and travels predictably unless it is drifting
(which above throttle will avoid). The quadcopter on the other hand drifts slowly with wind, so requires at least P
control to reach a goal. The axis superimposed on the platforms have red as X (forward) and Y (left).
Figure 1 - (left) quadcopter moving up to the flight position (right) Audi R8 moving with throttle control.
Code development
Create a Base Class (called Controller) and two derived Classes (Ackerman and Quadcopter).
The Controller will need to inherit (use as base class) the ControllerInterface header and implement its virtual
functions without changing the function declarations (signatures). The Controller is the base class for Ackerman and
Quadcopter.
Students need to determine and implement functions from ControllerInterface in Controller and/or Ackerman and
Quadcopter. These design choices are marked and examine your knowledge of Base/Derived classes.
Each derived class from Controller (Ackerman and Quadcopter) will need to
Figure 2 - The pure pursuit method to control Ackerman steering vehicle. From: Automatic Steering Methods for Autonomous, Jarrod M.
Snider, Feb 2009
The relationship between angle of wheels δ, the distance to goal ld (goal at gx, gy) and heading difference α is:
The steering wheel to wheel position is via a STEERING RATIO, the total number of turns (lock to lock) governs
maximum steer angle. The distance between wheels is knows as wheel base (L).
Property Values
STEERING RATIO 17.3
LOCK TO LOCK_REVS 3.2
MAX STEER ANGLE (M_PI * LOCK_TO_LOCK_REVS / STEERING_RATIO)
TRACK WIDTH 1.638 [m]
WHEEL RADIUS 0.36 [m]
WHEELBASE 2.65 [m]
MAX BRAKE TORQUE 8000.0 [Nm]
The quadcopter has four rotors that allow it to move in any direction on the plane as well as up/down. The up/down
motion is irrelevant to reach goals (we only consider X,Y location for goals). However, if the platform is not above
ground it could crash.
We will provide a test stub in the test folder of a1_skeleton. The testing will attempt to test the Controller Classes
developed, as well as Mission. These ARE NOT THE ONLY tests we will be undertaking on your code, but they provide
some indication of how your code will be thoroughly evaluated.
To compile and install testing students must install google testing framework (refer canvas for instructions, as you
have done for quiz 0 & quiz 1).
Instructions to compile and run the tests on your own code are in the README.md file located within the test folder.
Whenever testing, after making changed to your code, you should recompile the test folder and run the two test
scripts.
If your tests are succeeding you should get all green in execution of tests.
FAQ (extract from Teams Discussion)
Students need to decide whether to implement the function, whether in base class or derived class (whether it is
pure virtual in Controller, or virtual in Controller or fully implemented in Quadcopter/Ackerman). The base class
SHOULD not know anything about the derived classes.
Certainly, yes, you can create own functions/classes and this is good practice. This is subject to following