Skip to content

Conversation

@taanishr
Copy link
Contributor

@taanishr taanishr commented Oct 26, 2024

Resolves #6. Finished virtual altimeter initial tests

@taanishr taanishr changed the title #6 Virtual Altimeter initial tests Virtual Altimeter base code + initial tests Oct 26, 2024
@taanishr taanishr requested a review from SwiftGapple October 26, 2024 19:10
@daftcube daftcube self-requested a review October 26, 2024 20:57
Copy link
Contributor

@daftcube daftcube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

};

void VirtualBarometer::process(double deltatime) {
std::cout << "PROCESSING NEW POSITION" << '\n';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing debug std::cout prints and instead either:

  • Print to file
  • Write function that prints state of barometer every simulation tick, and call that in simulate loop


void VirtualBarometer::process(double deltatime) {
std::cout << "PROCESSING NEW POSITION" << '\n';
position_provider.process(deltatime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you folks are changing the architecture, but you probably want to call position_provider.process(deltatime) in the main simulation loop as a first step, then call VirtualBarometer::process() after it. This prevents coupling that is present here.

VirtualBarometer(unsigned int rs, double alt, double ns);
double get_reported_altitude();
void process(double);
PhoenixPositionProvider position_provider;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a pointer to position_provider. Currently, it is declared as a unique instance that is a member of this class. Consider change to PhoenixPositionProvider* position_provider.

}else {
fs.process(solenoid_timer, target);
}
}()); // make sure to actually call lambda function immediately lolz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lolz

CHECK_THROWS_AS(fs.process(solenoid_timer, target), std::runtime_error);
}

TEST_CASE("Process Loop Run Explode", "Engine explodes cuz someone closed solenoid while it was running") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Engine will probably not explode if this happens, it will probably just sputter out. Check w/ Fluid Systems and/or Prop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests, especially checking for determinism!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look good, but check with someone more familiar with the vehicle, I have been retired for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Virtual Altimeter

3 participants