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

IGNITION_MATH_MAJOR_VERSION is undefined for ign-math4 #214

Closed
traversaro opened this issue Jul 12, 2021 · 2 comments
Closed

IGNITION_MATH_MAJOR_VERSION is undefined for ign-math4 #214

traversaro opened this issue Jul 12, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@traversaro
Copy link
Contributor

Environment

  • OS Version: Ubuntu 20.04
  • Source or binary build? Binary, in particular:
straversaro@IITICUBLAP102:~$ apt list --installed | grep math4

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libignition-math4-dev/focal,now 4.0.0+dfsg1-5ubuntu1 amd64 [installed]
libignition-math4/focal,now 4.0.0+dfsg1-5ubuntu1 amd64 [installed,automatic]

Description

  • Expected behavior: IGNITION_MATH_MAJOR_VERSION is a macro expected to have the integer value of the major version of ignition math.
  • Actual behavior: For IgnMath4, that macro is empty

Steps to reproduce

Just run cat /usr/include/ignition/math4/ignition/math/config.hh and inspect the output.

Output

straversaro@IITICUBLAP102:~$ cat /usr/include/ignition/math4/ignition/math/config.hh
/* Config.hh. Generated by CMake for ignition-math. */

/* Version number */
#define IGNITION_MATH_MAJOR_VERSION
#define IGNITION_MATH_MINOR_VERSION
#define IGNITION_MATH_PATCH_VERSION

#define IGNITION_MATH_VERSION "4.0"
#define IGNITION_MATH_VERSION_FULL "4.0.0"

#define IGNITION_MATH_VERSION_NAMESPACE v4

#define IGNITION_MATH_VERSION_HEADER "Ignition math, version 4.0.0\nCopyright (C) 2014 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n"

/* #undef IGNITION_MATH_BUILD_TYPE_PROFILE */
/* #undef IGNITION_MATH_BUILD_TYPE_DEBUG */
/* #undef IGNITION_MATH_BUILD_TYPE_RELEASE */
@traversaro traversaro added the bug Something isn't working label Jul 12, 2021
@traversaro
Copy link
Contributor Author

A bit of background: the issue was fixed for ign-math >= 6 in #151 . However, another major change of ign-math6 w.r.t. to ign-math4 was the semantics of Pose3::operator*, see https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-math/pull-requests/301/page/1 and #60 for some background. For this reason, if you need to have a plugin that uses Pose3::operator* and you want that it works fine both with Gazebo 9 (EOL: Jan 2023) and Gazebo 11 (EOL: Jan 2025), you need to have some logic like:

#ifdef IGNITION_MATH_IS_GREATER_THEN_5 
        ignition::math::Pose3d world_H_cylinder = world_H_link*link_H_cylinder;
#else 
        ignition::math::Pose3d world_H_cylinder = link_H_cylinder*world_H_link;
#endif

In my case, I was using IGNITION_MATH_MAJOR_VERSION >= 5, so:

#if IGNITION_MATH_MAJOR_VERSION >= 5
        ignition::math::Pose3d world_H_cylinder = world_H_link*link_H_cylinder;
#else 
        ignition::math::Pose3d world_H_cylinder = link_H_cylinder*world_H_link;
#endif

but it turns out that this results in a compilation error:

/home/gnava/Software/github/dic-iit/component_ironcub/software/gazebo/plugins/jets-plugin/jets-plugin.cc:595:41: error: operator '>=' has no left operand
  595 |         #if IGNITION_MATH_MAJOR_VERSION >= 5
      |                                         ^~

due to the issue described in this issue.

If anyone is affected by the same problem, as long as you are compiling a Gazebo plugin you can rely on the fact that Gazebo 9 uses ign-math4 and Gazebo 11 uses ign-math6, and so you can just use the GAZEBO_MAJOR_VERSION as a proxy for the ign-math version, i.e. this will work fine:

#if GAZEBO_MAJOR_VERSION >= 11
        ignition::math::Pose3d world_H_cylinder = world_H_link*link_H_cylinder;
#else 
        ignition::math::Pose3d world_H_cylinder = link_H_cylinder*world_H_link;
#endif

Documenting this is the main reason for which I opened this issue, as I do not plan fix the issue itself.

@azeey
Copy link
Contributor

azeey commented Oct 5, 2023

Closing since ign-math4 is EOL.

@azeey azeey closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants