Objective
This assignment introduces basic Object-Oriented Programming (OOP) concepts using C++ within a robotics context. You will develop a series of C++ programs that simulate robotic behavior, utilize sensor data, and demonstrate fundamental OOP principles.
Tasks
Task 1: Robot Class Implementation
Define a Robot class with the following attributes:
- Name: The name of the robot.
- Speed: The speed of the robot.
- Physical Attributes:
- Weight: The weight of the robot.
- Size: The size of the robot.
- Number of Sensors: The number of sensors the robot has.
Methods for moving the robot:
moveForward(): Simulate the robot moving forward.moveBackward(): Simulate the robot moving backward.stop(): Simulate stopping the robot.
Instructions:
- Instantiate a
Robotobject and simulate actions by invoking its methods. - Use namespaces to define different robots.
- Ensure that each action is outputted to the console to demonstrate the robot’s behavior.
Task 2: Simulating Sensor Readings
Create a C++ program that represents a robot equipped with temperature and distance sensors. Simulate sensor readings with hardcoded values:
- Example for temperature:
Temperature: 20°C - Example for distance:
Distance: 100cm
Instructions:
- Print these values to the console with appropriate descriptions.
Task 3: Sensor Library Design
Design a simple sensor library that includes classes for different types of sensors:
- TemperatureSensor: Class for handling temperature readings.
- DistanceSensor: Class for handling distance measurements.
Instructions:
- Use these classes in a main program to simulate getting readings from sensors.
- Create a single-class template that can be used for multiple sensor types:
- For double data
- For string data
- For char data
- Ensure proper documentation and use a
CMakeLists.txtfile for building the project.
Task 4: Debugging a Multi-File C++ Project
Task Description: Your task is to fix and debug a multi-file C++ project for a robot simulation. The project is incomplete and contains various errors in syntax, logic, and structure. The project includes classes for Robot, Sensor, and Main execution.
Instructions:
- Clone the directory structure.
- Identify and fix errors in the provided files.
- Use CMakeLists.txt to build the project.
- Ensure the program compiles and runs, outputting the expected robot actions and sensor readings.
Submission Process
Fork the Repository:
- Fork the Robotics Software Engineer repository, ensuring all branches are included in your fork.
- https://github.com/Robotisim/robotics_software_engineer
Clone Your Forked Repository:
mkdir -p ~/assignment_ws/src/ && cd ~/assignment_ws/src/
git clone https://github.com/<your-username>/robotics_software_engineer
Create Files:
- Navigate to the
module_1_assignmentpackage. - Create files for each task as required.
Document Your Work:
- Create a
README.mdfile in themodule_1_assignmentpackage. - Provide details about the files you created.
- Explain the commands required to run your code for each specific task.
Submit Your Assignment:
- Push your changes to your forked repository.
- Provide your repository link in the assignment submission text area.
Wait for Review:
- Wait for the instructors to review your submission.
