Skip to content

Commit

Permalink
deploy: cd8758b
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Apr 25, 2024
1 parent 463648b commit 0110603
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 179 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified api/cpp/doctrees/environment.pickle
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ Functions
---------


- :ref:`exhale_function_RpcLibAdaptorsBase_8hpp_1afb001b2ca995cc726f581621db317400`

- :ref:`exhale_function_RpcLibAdaptorsBase_8hpp_1a4f4b3060c8be9db77d0cbd4d342023ab`

- :ref:`exhale_function_RpcLibAdaptorsBase_8hpp_1aa48460dda401d585625e850d035669c3`
Expand All @@ -145,3 +143,5 @@ Functions

- :ref:`exhale_function_RpcLibAdaptorsBase_8hpp_1a46cd14d414e8fc72032ef2edc817fca7`

- :ref:`exhale_function_RpcLibAdaptorsBase_8hpp_1afb001b2ca995cc726f581621db317400`

Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Functions
---------


- :ref:`exhale_function_MultirotorRpcLibAdaptors_8hpp_1abfcd08d1e6f1840d131bdd83c3ace4eb`

- :ref:`exhale_function_MultirotorRpcLibAdaptors_8hpp_1a4ad96bb0b0fd837d8132bf284f81932c`

- :ref:`exhale_function_MultirotorRpcLibAdaptors_8hpp_1abfcd08d1e6f1840d131bdd83c3ace4eb`

Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,6 @@ Program Listing for File Environment.hpp

class Environment : public UpdatableObject {

private:
State initial_, current_;
HomeGeoPoint home_geo_point_;
GeodeticConverter geodetic_converter_;

void updateState(State &state) {
geodetic_converter_.ned2Geodetic(state.position, state.geo_point);

real_T geo_pot = EarthUtils::getGeopotential(state.geo_point.altitude / 1000.0f);
state.temperature = EarthUtils::getStandardTemperature(geo_pot);
state.air_pressure = EarthUtils::getStandardPressure(geo_pot, state.temperature);
state.air_density = EarthUtils::getAirDensity(state.air_pressure, state.temperature);

// TODO: avoid recalculating square roots
state.gravity = Vector3r(0, 0, EarthUtils::getGravity(state.geo_point.altitude));
}

protected:
virtual void resetImplementation() override { current_ = initial_; }

virtual void failResetUpdateOrdering(std::string err) override {
unused(err);
// Do nothing.
// The environment gets reset() twice without an update() inbetween,
// via MultirotorPawnSimApi::reset() and CarSimApi::reset(), because
// those functions directly reset an environment, and also call other reset()s that reset the same environment.
}

public:
struct State {
// these fields must be set at initialization time
Expand Down Expand Up @@ -99,6 +71,34 @@ Program Listing for File Environment.hpp
State &getState() { return current_; }

virtual void update() override { updateState(current_); }

protected:
virtual void resetImplementation() override { current_ = initial_; }

virtual void failResetUpdateOrdering(std::string err) override {
unused(err);
// Do nothing.
// The environment gets reset() twice without an update() inbetween,
// via MultirotorPawnSimApi::reset() and CarSimApi::reset(), because
// those functions directly reset an environment, and also call other reset()s that reset the same environment.
}

private:
State initial_, current_;
HomeGeoPoint home_geo_point_;
GeodeticConverter geodetic_converter_;

void updateState(State &state) {
geodetic_converter_.ned2Geodetic(state.position, state.geo_point);

real_T geo_pot = EarthUtils::getGeopotential(state.geo_point.altitude / 1000.0f);
state.temperature = EarthUtils::getStandardTemperature(geo_pot);
state.air_pressure = EarthUtils::getStandardPressure(geo_pot, state.temperature);
state.air_density = EarthUtils::getAirDensity(state.air_pressure, state.temperature);

// TODO: avoid recalculating square roots
state.gravity = Vector3r(0, 0, EarthUtils::getGravity(state.geo_point.altitude));
}
};

} // namespace autonomylib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ Program Listing for File Kinematics.hpp

class Kinematics : public UpdatableObject {

private: // fields
State initial_;
State current_;

public:
struct State {
Pose pose;
Expand Down Expand Up @@ -80,6 +76,11 @@ Program Listing for File Kinematics.hpp
const State &getState() const { return current_; }
void setState(const State &state) { current_ = state; }
const State &getInitialState() const { return initial_; }

private:
// fields
State initial_;
State current_;
};

} // namespace autonomylib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,6 @@ Program Listing for File SafetyEval.hpp
// this class takes all inputs and outputs in NEU world coordinates in metric system
class SafetyEval {

private:
MultirotorApiParams vehicle_params_;
shared_ptr<IGeoFence> fence_ptr_;
shared_ptr<ObstacleMap> obs_xy_ptr_;
SafetyViolationType enable_reasons_ = SafetyEval::SafetyViolationType_::GeoFence;
ObsAvoidanceStrategy obs_strategy_ = SafetyEval::ObsAvoidanceStrategy::RaiseException;

void checkFence(const Vector3r &cur_pos, const Vector3r &dest_pos, EvalResult &appendToResult);
void isSafeDestination(const Vector3r &dest, const Vector3r &cur_pos, const Quaternionr &quaternion,
SafetyEval::EvalResult &result);
Vector3r getDestination(const Vector3r &cur_pos, const Vector3r &velocity) const;
bool isThisRiskDistLess(float this_risk_dist, float other_risk_dist) const;
void isCurrentSafer(SafetyEval::EvalResult &result);
void setSuggestedVelocity(SafetyEval::EvalResult &result, const Quaternionr &quaternion);
float adjustClearanceForPrStl(float base_clearance, float obs_confidence);

public:
enum class SafetyViolationType_ : uint {
NoSafetyViolation = 0,
Expand Down Expand Up @@ -114,6 +98,22 @@ Program Listing for File SafetyEval.hpp
float min_z);
void setObsAvoidanceStrategy(SafetyEval::ObsAvoidanceStrategy obs_strategy);
SafetyEval::ObsAvoidanceStrategy getObsAvoidanceStrategy();

private:
MultirotorApiParams vehicle_params_;
shared_ptr<IGeoFence> fence_ptr_;
shared_ptr<ObstacleMap> obs_xy_ptr_;
SafetyViolationType enable_reasons_ = SafetyEval::SafetyViolationType_::GeoFence;
ObsAvoidanceStrategy obs_strategy_ = SafetyEval::ObsAvoidanceStrategy::RaiseException;

void checkFence(const Vector3r &cur_pos, const Vector3r &dest_pos, EvalResult &appendToResult);
void isSafeDestination(const Vector3r &dest, const Vector3r &cur_pos, const Quaternionr &quaternion,
SafetyEval::EvalResult &result);
Vector3r getDestination(const Vector3r &cur_pos, const Vector3r &velocity) const;
bool isThisRiskDistLess(float this_risk_dist, float other_risk_dist) const;
void isCurrentSafer(SafetyEval::EvalResult &result);
void setSuggestedVelocity(SafetyEval::EvalResult &result, const Quaternionr &quaternion);
float adjustClearanceForPrStl(float base_clearance, float obs_confidence);
};

} // namespace autonomylib
Expand Down
Loading

0 comments on commit 0110603

Please sign in to comment.