You completed the exercises. Please leave feedback in README.md This was very helpful, thanks a bunch <3
- Each person in the pair needs to
git clonethis repo - Decide, who is Person A and who is Person B
- Tasks will be appearing below. After you complete one, another one appears. There is 10 in total.
- First 6 tasks are always only for one person (it alternates between A and B)
- In the remaining tasks, you will work in parallel and might even need to resolve some conflicts.
- Person A -
pod.cpp- Name your pod- Open
pod.cppfile and locate TASK 1 - Type the name for your pod inside the double-quotes (you should discuss the choice of the name with your teammate)
- Open
- Person B -
pod.cpp- Choose max speed- Open
pod.cppfile and locate TASK 2 - Tell us what the max speed of your pod is by replacing the 0 in the code with a real number
- Open
- Person A -
pod.handpod.cpp- Tempereture inside the pressure vessel- Open
pod.h, locate place for TASKS 3&4 and copy-paste the following line theredouble get_temperature();
- Open
pod.cpp, locate place for TASKS 3&4 and copy-paste the following code there (you can change the 0 there if you want a more comfortable temperature)double Pod::get_temperature() { return 0; }
- When done, commit both files in a single commit (ofc don't forget push and stuff as always)
- Open
- Person B -
pod.handpod.cpp- Pressure inside the pressure vessel- Open
pod.h, locate place for TASKS 3&4 and copy-paste the following line below the one from previous taskdouble get_pressure();
- Open
pod.cpp, locate place for TASKS 3&4, copy the following code and paste it below the function from previous task (you can change the 0 there if you want a more comfortable pressure)double Pod::get_pressure() { return 0; }
- When done, commit both files in a single commit (ofc don't forget push and stuff as always)
- Open
- Person A -
main.cppandMakefile- Main executable- Create a new file called
main.cppand copy the following code to it#include <iostream> #include "pod.h" int main() { Pod pod; std::cout << "Name: " << pod.get_name() << std::endl; std::cout << "Maximum speed: " << pod.get_max_speed() << std::endl; std::cout << "Temperature: " << pod.get_temperature() << std::endl; std::cout << "Pressure: " << pod.get_pressure() << std::endl; return 0; }
- Open
Makefile, locate place for TASK 4 and uncomment the code there to get something likemain : main.o pod.o bms.o navigation.o accelerometer.o $(CC) $(OBJS) $(LFLAGS) main.o -o main main.o : main.cpp pod.h bms.h navigation.h accelerometer.h $(CC) $(CFLAGS) main.cpp
- Notice the difference in the output of
git statusfor the newly created file - Commit
main.cppandMakefilein separate commits
- Create a new file called
- Person B -
bms.cpp,bms.handMakefile- Battery management system- Create a new file called
bms.hand copy the following code to it#ifndef HYPED_GIT_WSHOP_BMS_H #define HYPED_GIT_WSHOP_BMS_H class BatteryManagementSystem { public: BatteryManagementSystem(); /// TASKS 9 (BOTH) ///////////////////////////////////////////////////////// /// END OF TASKS 9AB /////////////////////////////////////////////////////// }; #endif //HYPED_GIT_WSHOP_BMS_H
- Create a new file called
bms.cppand copy the following code to it#include "bms.h" BatteryManagementSystem::BatteryManagementSystem() { } /// TASK 9 (BOTH) ////////////////////////////////////////////////////////////// /// END OF TASKS 9AB ///////////////////////////////////////////////////////////
- Open
Makefile, locate place for TASK 5 and uncomment the code there to get something likebms.o : bms.cpp bms.h $(CC) $(CFLAGS) bms.cpp - Notice the difference in the output of
git statusfor the newly created file - Commit
bms.handbms.cppin one commit andMakefilein separate commits
- Create a new file called
- CHANGE: both people work simultaneously on different pieces of code from now on - Person B
git pushes first- Person A -
accelerometer.h- Define accelerometer's error- Open
accelerometer.h, locate place for TASK 7 and edit the line so that it looks something like below (0 is best but also most boring)double error = <real_number_here>; - Wait for your teammate to
git pushbefore yougit pull --rebase
- Open
- Person B -
navigation.cpp- Implement way for adding accelerometers to the navigation system- Open
navigation.cpp, locate the place for TASK 7 and copy the following code therethis->accelerometers.push_back(a);
- Open
- Person A -
- Person A
git pushes first- Person A -
navigation.cpp- Implement calculation of velocity from acceleration- Open
navigation.cpp, locate the place for your part of TASK 7 (insideget_velocity()function) and copy the following code theredouble a = this->get_acceleration(); this->velocity += a*DT; //integrate return this->velocity;
- Open
- Person B -
navigation.cpp- Implement calculation of position from velocity- Open
navigation.cpp, locate the place for your part of TASK 7 (insideget_position()function) and copy the following code theredouble v = this->get_velocity(); this->position += v*DT; //integrate return this->position;
- Wait for your teammate to
git pushbefore yougit pull --rebase
- Open
- Person A -
- Person B
git pushes first- Person A -
bms.handbms.cpp- Sensing voltage- Open
bms.h, locate place for TASK 9 and copy the following code theredouble get_voltage();
- Open
bms.cpp, locate place for TASK 9 and copy the following code there (you can change the number)double BatteryManagementSystem::get_voltage() { return 0; }
- Commit both files in a single commit
- Wait for your teammate to
git pushbefore yougit pull --rebase - SLOW DOWN You've got a conflict. Now go and carefully resolve it. Take your time.
- Open
- Person B -
bms.handbms.cpp- Sensing current- Open
bms.h, locate place for TASK 9 and copy the following code theredouble get_current();
- Open
bms.cpp, locate place for TASK 9 and copy the following code there (you can change the number)double BatteryManagementSystem::get_current() { return 0; }
- Open
- Person A -
- Person A
git pushes first- Person A -
pod.handMakefile- Integrate battery management system with the pod- Open
pod.h, locate TASK 10.1, and include the BMS header by copying the following code#include "bms.h"
- Locate TASK 10.2 and declare the BMS field as follows
BatteryManagementSystem bms;
- Open
Makefile- Append
bms.hto the lines starting withpod.o :andmain.o : - Append
bms.oto the lines starting withmain :andOBJS =
- Append
- Open
- Person B -
pod.h,pod.cppandMakefile- Integrate navigation system with the pod- Open
pod.h, locate TASK 10.1, and include the navigation header by copying the following code#include "navigation.h"
- Locate TASK 10.2 and declare the nav field as follows
Navigation nav;
- Open
pod.cpp, locate TASK 10, and initialize the navigation system with one accelerometer as followsthis->nav.add_accelerometer(new Accelerometer);
- Open
Makefile- Append
navigation.hto the lines starting withpod.o :andmain.o : - Append
navigation.oto the lines starting withmain :andOBJS =
- Append
- Commit both files in a single commit
- Wait for your teammate to
git pushbefore yougit pull --rebase - SLOW DOWN You've got some conflicts. Now go and carefully resolve them. Take your time.
- Open
- Person A -
| Task # | Person A | Person B |
|---|---|---|
| 1 | Name your pod - edit pod.cpp |
|
| 2 | Max speed - edit pod.cpp |
|
| 3 | Pressure vessel temperature - edit pod.h and pod.cpp |
|
| 4 | Pressure vessel pressure - edit pod.h and pod.cpp |
|
| 5 | Create main.cpp and update Makefile |
|
| 6 | BMS - create bms.cpp and bms.h and update Makefile |
|
| 7 | Accelerometer error - edit accelerometer.hgit pull --rebase |
Edit navigation.cpp - adding accelerometers |
| 8 | Edit navigation.cpp - get velocity |
Edit navigation.cpp - get positiongit pull -- rebase |
| 9 | Edit bms.h and bms.cpp - get voltagegit pull --rebase & resolve conflicts |
Edit bms.h and bms.cpp - get current |
| 10 | Integrate BMS to pod - edit pod.h and Makefile |
Integrate navigation to pod - edit pod.h, pod.cpp and Makefilegit pull --rebase & resolve conflicts |