Skip to content

Commit

Permalink
[cooperative perception] Remove all noexcept specifiers from function…
Browse files Browse the repository at this point in the history
… declarations (#2246)

* Remove noexcept declarations

There is an issue where something throws in a noexcept function,
causing the cooperative perception stack to fail and subsequently the
rest of CARMA. Until we figure out which function is the source, we are
removing all noexcept declarations.

* #2246 Update code formatting

---------

Co-authored-by: Adam Morrissett <[email protected]>
  • Loading branch information
MishkaMN and adamlm authored Jan 4, 2024
1 parent 000eae5 commit 4413270
Show file tree
Hide file tree
Showing 25 changed files with 127 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ExternalObjectListToDetectionListNode : public carma_ros2_utils::CarmaLife

auto publish_as_detection_list(const input_msg_type & msg) const -> void;

auto update_georeference(const std_msgs::msg::String & msg) noexcept -> void;
auto update_georeference(const std_msgs::msg::String & msg) -> void;

private:
rclcpp_lifecycle::LifecyclePublisher<output_msg_type>::SharedPtr publisher_{nullptr};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class ExternalObjectListToSdsmNode : public carma_ros2_utils::CarmaLifecycleNode

auto publish_as_sdsm(const external_objects_msg_type & msg) const -> void;

auto update_georeference(const georeference_msg_type & proj_string) noexcept -> void;
auto update_georeference(const georeference_msg_type & proj_string) -> void;

auto update_current_pose(const pose_msg_type & pose) noexcept -> void;
auto update_current_pose(const pose_msg_type & pose) -> void;

private:
rclcpp_lifecycle::LifecyclePublisher<sdsm_msg_type>::SharedPtr sdsm_publisher_{nullptr};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ struct UtmDisplacement
*
* @return Reference to the coordinate's updated position
*/
inline constexpr auto operator+=(
UtmCoordinate & coordinate, const UtmDisplacement & displacement) noexcept -> UtmCoordinate &
inline constexpr auto operator+=(UtmCoordinate & coordinate, const UtmDisplacement & displacement)
-> UtmCoordinate &
{
coordinate.easting += displacement.easting;
coordinate.northing += displacement.northing;
Expand All @@ -83,8 +83,8 @@ inline constexpr auto operator+=(
*
* @return A new UtmCoordinate representing the new position
*/
inline constexpr auto operator+(
UtmCoordinate coordinate, const UtmDisplacement & displacement) noexcept -> UtmCoordinate
inline constexpr auto operator+(UtmCoordinate coordinate, const UtmDisplacement & displacement)
-> UtmCoordinate
{
return coordinate += displacement;
}
Expand All @@ -97,8 +97,8 @@ inline constexpr auto operator+(
*
* @return A new UtmCoordinate representing the new position
*/
inline constexpr auto operator+(
const UtmDisplacement & displacement, UtmCoordinate coordinate) noexcept -> UtmCoordinate
inline constexpr auto operator+(const UtmDisplacement & displacement, UtmCoordinate coordinate)
-> UtmCoordinate
{
return coordinate += displacement;
}
Expand All @@ -111,8 +111,8 @@ inline constexpr auto operator+(
*
* @return Reference to the coordinate's updated position
*/
inline constexpr auto operator-=(
UtmCoordinate & coordinate, const UtmDisplacement & displacement) noexcept -> UtmCoordinate &
inline constexpr auto operator-=(UtmCoordinate & coordinate, const UtmDisplacement & displacement)
-> UtmCoordinate &
{
coordinate.easting += displacement.easting;
coordinate.northing += displacement.northing;
Expand All @@ -129,8 +129,8 @@ inline constexpr auto operator-=(
*
* @return A new UtmCoordinate representing the new position
*/
inline constexpr auto operator-(
UtmCoordinate coordinate, const UtmDisplacement & displacement) noexcept -> UtmCoordinate
inline constexpr auto operator-(UtmCoordinate coordinate, const UtmDisplacement & displacement)
-> UtmCoordinate
{
return coordinate -= displacement;
}
Expand All @@ -143,8 +143,8 @@ inline constexpr auto operator-(
*
* @return A new UtmCoordinate representing the new position
*/
inline constexpr auto operator-(
const UtmDisplacement & displacement, UtmCoordinate coordinate) noexcept -> UtmCoordinate
inline constexpr auto operator-(const UtmDisplacement & displacement, UtmCoordinate coordinate)
-> UtmCoordinate
{
return coordinate -= displacement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class HostVehicleFilterNode : public carma_ros2_utils::CarmaLifecycleNode
auto handle_on_shutdown(const rclcpp_lifecycle::State & /* previous_state */)
-> carma_ros2_utils::CallbackReturn override;

auto update_host_vehicle_pose(const geometry_msgs::msg::PoseStamped & msg) noexcept -> void;
auto update_host_vehicle_pose(const geometry_msgs::msg::PoseStamped & msg) -> void;

auto attempt_filter_and_republish(
carma_cooperative_perception_interfaces::msg::DetectionList msg) noexcept -> void;
auto attempt_filter_and_republish(carma_cooperative_perception_interfaces::msg::DetectionList msg)
-> void;

private:
rclcpp::Subscription<carma_cooperative_perception_interfaces::msg::DetectionList>::SharedPtr
Expand All @@ -66,7 +66,7 @@ class HostVehicleFilterNode : public carma_ros2_utils::CarmaLifecycleNode
};

auto euclidean_distance_squared(
const geometry_msgs::msg::Pose & a, const geometry_msgs::msg::Pose & b) noexcept -> double;
const geometry_msgs::msg::Pose & a, const geometry_msgs::msg::Pose & b) -> double;

} // namespace carma_cooperative_perception

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ struct DDateTime
std::optional<units::time::second_t> second;
std::optional<units::time::minute_t> time_zone_offset;

[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::DDateTime & msg) noexcept
-> DDateTime;
[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::DDateTime & msg) -> DDateTime;
};

struct AccelerationSet4Way
Expand All @@ -54,10 +53,10 @@ struct AccelerationSet4Way
units::acceleration::two_centi_standard_gravities_t vert;
units::angular_velocity::centi_degrees_per_second_t yaw_rate;

[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::AccelerationSet4Way & msg) noexcept
[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::AccelerationSet4Way & msg)
-> AccelerationSet4Way;

[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::AccelerationSet4Way & msg) noexcept
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::AccelerationSet4Way & msg)
-> AccelerationSet4Way;
};

Expand All @@ -67,31 +66,27 @@ struct Position3D
units::angle::deci_micro_degrees_t longitude{0.0};
std::optional<units::length::deca_centimeters_t> elevation;

[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Position3D & msg) noexcept
-> Position3D;
[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Position3D & msg) -> Position3D;

[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Position3D & msg) noexcept
-> Position3D;
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Position3D & msg) -> Position3D;
};

struct Heading
{
units::angle::eighth_deci_degrees_t heading;

[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Heading & heading) noexcept
-> Heading;
[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Heading & heading) -> Heading;

[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Heading & heading) noexcept
-> Heading;
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Heading & heading) -> Heading;
};

struct Speed
{
units::velocity::two_centi_meters_per_second_t speed;

[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Speed & speed) noexcept -> Speed;
[[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Speed & speed) -> Speed;

[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Speed & speed) noexcept -> Speed;
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Speed & speed) -> Speed;
};

} // namespace carma_cooperative_perception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ struct PositionOffsetXYZ
units::length::decimeter_t offset_y{0.0};
std::optional<units::length::decimeter_t> offset_z;

[[nodiscard]] static auto from_msg(const j3224_v2x_msgs::msg::PositionOffsetXYZ & msg) noexcept
[[nodiscard]] static auto from_msg(const j3224_v2x_msgs::msg::PositionOffsetXYZ & msg)
-> PositionOffsetXYZ;

[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::PositionOffsetXYZ & msg) noexcept
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::PositionOffsetXYZ & msg)
-> PositionOffsetXYZ;
};

struct MeasurementTimeOffset
{
units::time::millisecond_t measurement_time_offset;

[[nodiscard]] static auto from_msg(
const j3224_v2x_msgs::msg::MeasurementTimeOffset & msg) noexcept -> MeasurementTimeOffset;
[[nodiscard]] static auto from_msg(const j3224_v2x_msgs::msg::MeasurementTimeOffset & msg)
-> MeasurementTimeOffset;

[[nodiscard]] static auto from_msg(
const carma_v2x_msgs::msg::MeasurementTimeOffset & msg) noexcept -> MeasurementTimeOffset;
[[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::MeasurementTimeOffset & msg)
-> MeasurementTimeOffset;
};

} // namespace carma_cooperative_perception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class Month
*
* @param[in] month_value Numerical value of the month; typically between [1, 12]
*/
constexpr explicit Month(std::uint8_t month_value) noexcept : month_value_{month_value} {}
constexpr explicit Month(std::uint8_t month_value) : month_value_{month_value} {}

/**
* @brief Pre-increment operator overload
*
* @return Reference to Month instance being incremented
*/
constexpr auto operator++() noexcept -> Month &
constexpr auto operator++() -> Month &
{
constexpr auto jan_value{1U};
constexpr auto dec_value{12U};
Expand All @@ -64,7 +64,7 @@ class Month
*
* @return Copy of Month instance before it was incremented
*/
constexpr auto operator++(int /* dummy parameter */) noexcept -> Month
constexpr auto operator++(int /* dummy parameter */) -> Month
{
Month previous{*this};
++(*this);
Expand All @@ -77,7 +77,7 @@ class Month
*
* @return Reference to Month instance being decremented
*/
constexpr auto operator--() noexcept -> Month &
constexpr auto operator--() -> Month &
{
constexpr auto dec_value{12U};

Expand All @@ -97,7 +97,7 @@ class Month
*
* @return Copy of Month instance before it was decremented
*/
constexpr auto operator--(int /* dummy parameter */) noexcept -> Month
constexpr auto operator--(int /* dummy parameter */) -> Month
{
Month previous{*this};
--(*this);
Expand All @@ -108,17 +108,14 @@ class Month
/**
* @brief Conversion function to convert Month instance to unsigned type
*/
constexpr explicit operator unsigned() const noexcept
{
return static_cast<unsigned>(month_value_);
}
constexpr explicit operator unsigned() const { return static_cast<unsigned>(month_value_); }

/**
* @brief Checks if Month instance's value is within valid Gregorian calendar range
*
* @return true if Month instance's value is within [1, 12]; false otherwise
*/
[[nodiscard]] constexpr auto ok() const noexcept -> bool
[[nodiscard]] constexpr auto ok() const -> bool
{
constexpr auto jan_value{1U};
constexpr auto dec_value{12U};
Expand All @@ -134,7 +131,7 @@ class Month
*
* @return true is Month instances are equal; false otherwise
*/
friend constexpr auto operator==(const Month & x, const Month & y) noexcept -> bool
friend constexpr auto operator==(const Month & x, const Month & y) -> bool
{
return x.month_value_ == y.month_value_;
}
Expand All @@ -147,10 +144,7 @@ class Month
*
* @return true is Month instances are not equal; false otherwise
*/
friend constexpr auto operator!=(const Month & x, const Month & y) noexcept -> bool
{
return !(x == y);
}
friend constexpr auto operator!=(const Month & x, const Month & y) -> bool { return !(x == y); }

/**
* @brief Check if one Month instance is less than another
Expand All @@ -160,7 +154,7 @@ class Month
*
* @return true is x comes before y in the calendar; false otherwise
*/
friend constexpr auto operator<(const Month & x, const Month & y) noexcept -> bool
friend constexpr auto operator<(const Month & x, const Month & y) -> bool
{
return x.month_value_ < y.month_value_;
}
Expand All @@ -173,7 +167,7 @@ class Month
*
* @return true is x comes before y in the calendar or if instances are equal; false otherwise
*/
friend constexpr auto operator<=(const Month & x, const Month & y) noexcept -> bool
friend constexpr auto operator<=(const Month & x, const Month & y) -> bool
{
return x < y || x == y;
}
Expand All @@ -186,7 +180,7 @@ class Month
*
* @return true is x comes after y in the calendar; false otherwise
*/
friend constexpr auto operator>(const Month & x, const Month & y) noexcept -> bool
friend constexpr auto operator>(const Month & x, const Month & y) -> bool
{
return x.month_value_ > y.month_value_;
}
Expand All @@ -199,7 +193,7 @@ class Month
*
* @return true is x comes after y in the calendar or if instances are equal; false otherwise
*/
friend constexpr auto operator>=(const Month & x, const Month & y) noexcept -> bool
friend constexpr auto operator>=(const Month & x, const Month & y) -> bool
{
return x > y || x == y;
}
Expand Down
Loading

0 comments on commit 4413270

Please sign in to comment.