Robotics StackExchange | Archived questions

sdformat modifications

I am trying to add a new sensor type to gazebo (UWB). I have made all the required modifications to the source code to be able to build gazebo with this new sensor. I also made the required modifications to SDFormat so that the sdf file should accept my new <uwb>tag.

I however seem to have problems referring to the new version of SDFormat. In my first run, I forgot to delete the ubuntu precompiled libraries 'libsdformat' 'sdformat' This lead to gazebo building fine, but obviously referring to the ubuntu precompiled libraries which do not contain my modifications.

After removing the precompiled libraries, gazebo will no longer compile because it is missing the sdformat library. I am building gazebo using catkin, like described in the gazebo tutorial

I can build sdformat from source, which installs the new sdf and xsd files to the /usr/share/sdformat folder, and in my '/devel/lib' folder, I also find a libsdformat.so file.

However, running 'sudo dpkg -L packagename' tells me that the sdformat package is not installed.

Any tips on how I can get gazebo/ubuntu to recognize my own compiled version of sdformat?

Asked by Edwin Walsh on 2017-06-08 05:20:34 UTC

Comments

Answers

To answer my own question:

The following code is part of the SearchForStuff.cmake file from gazebo

# Find SDFormat
set (SDFormat_MIN_VERSION 5.0.0)
find_package(SDFormat ${SDFormat_MIN_VERSION})

if (NOT SDFormat_FOUND)
  message (STATUS "Looking for SDFormat - not found")
  message(STATUS "found configs ${SDFormat_CONSIDERED_CONFIGS}")
  BUILD_ERROR ("Missing: SDF version >=${SDFormat_MIN_VERSION}. Required for reading and writing SDF files.")
else()
  message (STATUS "Looking for SDFormat - found")
endif()

The version of SDFormat that I built, was 6.0.0, which obviously is larger than 5.0.0, so I expected this to work. However, the SDFormatConfigVersion.cmake file states that only the same major versions are compatible.

set(PACKAGE_VERSION "6.0.0")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

  if("6.0.0" MATCHES "^([0-9]+)\\.")
    set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
  else()
    set(CVF_VERSION_MAJOR "6.0.0")
  endif()

  if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  endif()

  if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
      set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()


# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
   return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
  math(EXPR installedBits "8 * 8")
  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

I'm not sure if that is the way it was intended. I will have to perform some more checks to see which version of gazebo is compatible with which version of sdformat.

Asked by Edwin Walsh on 2017-06-09 02:57:32 UTC

Comments