Skip to content

Commit

Permalink
bug fix: Makefile, impact point output
Browse files Browse the repository at this point in the history
  • Loading branch information
ina111 committed Jun 12, 2018
1 parent e35110f commit 62ce104
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -24,10 +24,10 @@ INCLUDES = $(addprefix -I ,$(INCPATHS))
OBJS = $(SRCDIR)/air.o
OBJS += $(SRCDIR)/main.o
OBJS += $(SRCDIR)/rocket.o
OBJS += $(STCDIR)/coordinate_transform.o
OBJS += $(SRCDIR)/fileio.o
OBJS += $(SRCDIR)/gravity.o
OBJS += $(SRCDIR)/Orbit.o
OBJS += $(SRCDIR)/coordinate_transform.o
CC = g++
CFLAGS = -O2 -std=gnu++11
# CFLAGS = -Wall -O2 -std=gnu++11
Expand Down
Expand Up @@ -10,11 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550414207.5271"
timestampString = "550457592.451669"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "111"
endingLineNumber = "111"
startingLineNumber = "112"
endingLineNumber = "112"
landmarkName = "RocketStage::RocketStage(picojson::object o_each, picojson::object o)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -26,11 +26,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550414207.527747"
timestampString = "550457592.45261"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "105"
endingLineNumber = "105"
startingLineNumber = "106"
endingLineNumber = "106"
landmarkName = "RocketStage::RocketStage(picojson::object o_each, picojson::object o)"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -74,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550414207.528195"
timestampString = "550457592.453428"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "199"
endingLineNumber = "199"
startingLineNumber = "201"
endingLineNumber = "201"
landmarkName = "Rocket::flight_simulation()"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -138,11 +138,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550414207.528636"
timestampString = "550457592.454415"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "146"
endingLineNumber = "146"
startingLineNumber = "147"
endingLineNumber = "147"
landmarkName = "RocketStage::RocketStage(picojson::object o_each, picojson::object o)"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -170,7 +170,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/main.cpp"
timestampString = "550414207.5290771"
timestampString = "550457592.455309"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "31"
Expand Down Expand Up @@ -707,5 +707,53 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550457592.456248"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "286"
endingLineNumber = "286"
landmarkName = "RocketStage::operator()(const RocketStage::state&amp; x, RocketStage::state&amp; dx, double t)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550457592.456967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "281"
endingLineNumber = "281"
landmarkName = "RocketStage::operator()(const RocketStage::state&amp; x, RocketStage::state&amp; dx, double t)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "scr/rocket.cpp"
timestampString = "550457592.458351"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "282"
endingLineNumber = "282"
landmarkName = "RocketStage::operator()(const RocketStage::state&amp; x, RocketStage::state&amp; dx, double t)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
15 changes: 9 additions & 6 deletions scr/rocket.cpp
Expand Up @@ -18,6 +18,7 @@ Vector3d posECI_init_g;
Vector3d velECI_init_g;
bool flag_separation_g = false;
bool flag_dump_g = false;
bool flag_impact_g = false;
double max_downrange_g = 0.0;
double max_alt_g = 0.0;
Vector2d impact_point_g; // LLH[deg]
Expand Down Expand Up @@ -185,6 +186,7 @@ void Rocket::flight_simulation(){
for (int i = 0; i < rs.size(); i++){ // i is number of the rocket stages
flag_separation_g = false;
flag_dump_g = false;
flag_impact_g = false;
if (i == 0){
rs[i].posECI_init << posECI_init(rs[0].launch_pos_LLH);
rs[i].velECI_init << velECI_init(rs[0].launch_vel_NED, rs[0].launch_pos_LLH);
Expand Down Expand Up @@ -241,6 +243,7 @@ void Rocket::flight_simulation(){

// ==== DUMPING PRODUCTS flight simulation ====
for (int i = 0; i < fo.size(); i++) { // i is number of the dumping products
flag_impact_g = false;
RocketStage::state State = { fo[i].mass_init,
fo[i].posECI_init[0], fo[i].posECI_init[1], fo[i].posECI_init[2],
fo[i].velECI_init[0], fo[i].velECI_init[1], fo[i].velECI_init[2],
Expand Down Expand Up @@ -279,9 +282,9 @@ void RocketStage::operator()(const RocketStage::state& x, RocketStage::state& dx
if ((int)t % 10 == 0 && (int)(t*10) % 10 == 0 ){ // progress
progress(t);
}
if ( flag_impact == false ) {
if ( flag_impact_g == false ) {
impact_point_g << posLLH_[0], posLLH_[1];
flag_impact = true;
flag_impact_g = true;
}
return;
}
Expand Down Expand Up @@ -554,10 +557,10 @@ void rocket_csv_observer::operator()(const state& x, double t){
if ((int)t % 10 == 0 && (int)(t*10) % 10 == 0 ){ // progress
progress(t);
}
if ( flag_impact == false ) {
impact_point << posLLH_[0], posLLH_[1];
flag_impact = true;
}
// if ( flag_impact == false ) {
// impact_point << posLLH_[0], posLLH_[1];
// flag_impact = true;
// }
return;
}

Expand Down
2 changes: 1 addition & 1 deletion scr/rocket.hpp
Expand Up @@ -41,7 +41,7 @@ class FlyingObject{
double max_downrange; // maximum downrange [m]
double max_alt; // maximum altitude [m]
Vector2d impact_point; // impact position LLH [deg,deg]
bool flag_impact;
bool flag_impact = false;

using state = std::array<double, 7>;

Expand Down

0 comments on commit 62ce104

Please sign in to comment.