Skip to content

Define _USE_MATH_DEFINES for each target that links control_toolbox on WIN32 (backport #616)#619

Merged
christophfroehlich merged 1 commit into
kiltedfrom
mergify/bp/kilted/pr-616
May 29, 2026
Merged

Define _USE_MATH_DEFINES for each target that links control_toolbox on WIN32 (backport #616)#619
christophfroehlich merged 1 commit into
kiltedfrom
mergify/bp/kilted/pr-616

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented May 29, 2026

Fixes downstream compilation problems on Windows.

M_PI is used in public headers in

-1.0 / sampling_frequency * (2.0 * M_PI * damping_frequency) /
, so we need to ensure that _USE_MATH_DEFINES is always defined also for downstream compilation units that include control_toolbox/low_pass_filter.hpp. This can be done by setting as PUBLIC target_compile_definitions _USE_MATH_DEFINES.

This fixes errors like:

 │ │ %PREFIX%\Library\include\control_toolbox\control_toolbox\low_pass_filter.hpp(117,42): error C2065: 'M_PI': undeclared identifier [%SRC_DIR%\build\gz_custom_hardware_plugins.vcxproj]
 │ │   (compiling source file '../ros-jazzy-gz-ros2-control-demos/src/work/src/gz_custom_system.cpp')
 │ │       %PREFIX%\Library\include\control_toolbox\control_toolbox\low_pass_filter.hpp(117,42):
 │ │       the template instantiation context (the oldest one first) is
 │ │           %SRC_DIR%\ros-jazzy-gz-ros2-control-demos\src\work\src\gz_custom_system.cpp(266,34):
 │ │           see reference to class template instantiation 'control_toolbox::LowPassFilter<double>' being compiled
 │ │           %PREFIX%\Library\include\control_toolbox\control_toolbox\low_pass_filter.hpp(114,8):
 │ │           while compiling class template member function 'void control_toolbox::LowPassFilter<double>::set_params(double,double,double)'
 │ │               %PREFIX%\Library\include\control_toolbox\control_toolbox\low_pass_filter.hpp(85,15):
 │ │               see the first reference to 'control_toolbox::LowPassFilter<double>::set_params' in 'control_toolbox::LowPassFilter<double>::LowPassFilter'
 │ │               C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\memory(3630,5):
 │ │               see the first reference to 'control_toolbox::LowPassFilter<double>::LowPassFilter' in 'std::make_unique'
 │ │   
 │ │ %SRC_DIR%\build>if errorlevel 1 exit 1

see RoboStack/ros-jazzy#212 (comment) .

Is this user-facing behavior change?

No.

Did you use Generative AI?

Surprisingly no.

Additional Information

None.

TODOs

To send us a pull request, please:

  • 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.

This is an automatic backport of pull request #616 done by [Mergify](https://mergify.com).

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.79%. Comparing base (c334dea) to head (d38436c).
⚠️ Report is 1 commits behind head on kilted.

Additional details and impacted files
@@           Coverage Diff           @@
##           kilted     #619   +/-   ##
=======================================
  Coverage   82.79%   82.79%           
=======================================
  Files          29       29           
  Lines        2005     2005           
  Branches      110      113    +3     
=======================================
  Hits         1660     1660           
  Misses        276      276           
  Partials       69       69           
Flag Coverage Δ
unittests 82.79% <ø> (ø)

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christophfroehlich christophfroehlich merged commit 7dcd619 into kilted May 29, 2026
14 checks passed
@christophfroehlich christophfroehlich deleted the mergify/bp/kilted/pr-616 branch May 29, 2026 16:14
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.

3 participants