Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of M_PI on Windows #1036

Merged
merged 1 commit into from
Feb 11, 2024
Merged

Conversation

traversaro
Copy link
Contributor

@traversaro traversaro commented Feb 11, 2024

M_PI and M_PI_2 are not part of the C or C++ standard. However, they are available in almost all major compilers. On Windows, to make sure that they are defined, _USE_MATH_DEFINES needs to be defined when #include <cmath> or #include <math.h> is included. This PR make sure that _USE_MATH_DEFINES is defined whenever M_PI or M_PI_2 is used, for Windows compatibility.

Checklist:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

@bmagyar
Copy link
Member

bmagyar commented Feb 11, 2024

Thank you!

Copy link

codecov bot commented Feb 11, 2024

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (9f7e9e9) 47.71% compared to head (d8dc189) 72.41%.
Report is 20 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1036       +/-   ##
===========================================
+ Coverage   47.71%   72.41%   +24.69%     
===========================================
  Files          41       41               
  Lines        3871     3639      -232     
  Branches     1833     1782       -51     
===========================================
+ Hits         1847     2635      +788     
+ Misses        751      691       -60     
+ Partials     1273      313      -960     
Flag Coverage Δ
unittests 72.41% <73.13%> (+24.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...de/diff_drive_controller/diff_drive_controller.hpp 100.00% <ø> (ø)
...iff_drive_controller/src/diff_drive_controller.cpp 76.38% <100.00%> (+28.32%) ⬆️
...jectory_controller/joint_trajectory_controller.hpp 100.00% <ø> (+20.00%) ⬆️
...include/joint_trajectory_controller/trajectory.hpp 73.33% <ø> (+23.33%) ⬆️
...nclude/tricycle_controller/tricycle_controller.hpp 100.00% <ø> (ø)
...roadcaster/src/force_torque_sensor_broadcaster.cpp 82.53% <75.00%> (+21.93%) ⬆️
...ory_controller/src/joint_trajectory_controller.cpp 80.45% <87.50%> (+33.33%) ⬆️
joint_trajectory_controller/src/trajectory.cpp 89.67% <77.77%> (+22.10%) ⬆️
tricycle_controller/src/tricycle_controller.cpp 60.58% <60.60%> (+27.93%) ⬆️

... and 27 files with indirect coverage changes

@bmagyar bmagyar merged commit 9ab848a into ros-controls:master Feb 11, 2024
14 of 17 checks passed
@bmagyar bmagyar added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Feb 11, 2024
mergify bot pushed a commit that referenced this pull request Feb 11, 2024
mergify bot pushed a commit that referenced this pull request Feb 11, 2024
bmagyar pushed a commit that referenced this pull request Feb 12, 2024
bmagyar pushed a commit that referenced this pull request Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants