OOP Concepts in C++ for Robotics

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:

  1. Name: The name of the robot.
  2. Speed: The speed of the robot.
  3. Physical Attributes:
  4. Weight: The weight of the robot.
  5. Size: The size of the robot.
  6. Number of Sensors: The number of sensors the robot has.

Methods for moving the robot:

  1. moveForward(): Simulate the robot moving forward.
  2. moveBackward(): Simulate the robot moving backward.
  3. stop(): Simulate stopping the robot.

Instructions:

  1. Instantiate a Robot object and simulate actions by invoking its methods.
  2. Use namespaces to define different robots.
  3. 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:

  1. Example for temperature: Temperature: 20°C
  2. Example for distance: Distance: 100cm

Instructions:

  1. 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:

  1. TemperatureSensor: Class for handling temperature readings.
  2. DistanceSensor: Class for handling distance measurements.

Instructions:

  1. Use these classes in a main program to simulate getting readings from sensors.
  2. Create a single-class template that can be used for multiple sensor types:
  3. For double data
  4. For string data
  5. For char data
  6. Ensure proper documentation and use a CMakeLists.txt file for building the project.

Learning Outcome

By completing this assignment, you will:

  1. Apply C++ syntax to simulate basic robotics concepts.
  2. Grasp fundamental OOP principles and understand their application in robotics software development.

Submission Process

Fork the Repository:

  1. Fork the Robotics Software Engineer repository, ensuring all branches are included in your fork.
  2. 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:

  1. Navigate to the module_1_assignment package.
  2. Create files for each task as required.

Document Your Work:

  1. Create a README.md file in the module_1_assignment package.
  2. Provide details about the files you created.
  3. Explain the commands required to run your code for each specific task.

Submit Your Assignment:

  1. Push your changes to your forked repository.
  2. Provide your repository link in the assignment submission text area.

Note: Ensure you press the “Start Assignment” button when you see the page (as it takes time to generate the pages).

Wait for Review:

  1. Wait for the instructors to review your submission.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top
Review Your Cart
0
Add Coupon Code
Subtotal