Skip to content

Commit

Permalink
Merge pull request gazebosim#1420 from gazebosim/scpeters/merge_14_main
Browse files Browse the repository at this point in the history
Merge sdf14 ➡️  main
  • Loading branch information
scpeters authored May 21, 2024
2 parents 342e842 + 8355ca7 commit 213814c
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 62 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/package_xml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Validate package.xml

on:
pull_request:

jobs:
package-xml:
runs-on: ubuntu-latest
name: Validate package.xml
steps:
- uses: gazebo-tooling/action-gz-ci/validate_package_xml@jammy
16 changes: 16 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@

## libsdformat 14.X

### libsdformat 14.2.0 (2024-04-23)

1. Fix trivial warning on 24.04 for JointAxis_TEST.cc
* [Pull request #1402](https://github.com/gazebosim/sdformat/pull/1402)

1. Add package.xml, fix `gz sdf` tests on Windows
* [Pull request #1374](https://github.com/gazebosim/sdformat/pull/1374)

1. Backport mesh optimization feature
* [Pull request #1398](https://github.com/gazebosim/sdformat/pull/1398)
* [Pull request #1386](https://github.com/gazebosim/sdformat/pull/1386)
* [Pull request #1382](https://github.com/gazebosim/sdformat/pull/1382)

1. Param_TEST: Check return values of Param::Get/Set
* [Pull request #1394](https://github.com/gazebosim/sdformat/pull/1394)

### libsdformat 14.1.1 (2024-03-28)

1. Fix warning with pybind11 2.12
Expand Down
32 changes: 32 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<package format="2">
<name>sdformat15</name>
<version>15.0.0</version>
<description>SDFormat is an XML file format that describes environments, objects, and robots
in a manner suitable for robotic applications</description>

<maintainer email="[email protected]">Addisu Z. Taddese</maintainer>
<maintainer email="[email protected]">Steve Peters</maintainer>

<license>Apache License 2.0</license>

<url type="website">https://github.com/gazebosim/sdformat</url>

<buildtool_depend>cmake</buildtool_depend>
<build_depend>gz-cmake4</build_depend>
<depend>gz-math8</depend>
<depend>gz-utils3</depend>
<depend>tinyxml2</depend>
<depend>liburdfdom-dev</depend>
<depend>pybind11-dev</depend>

<exec_depend>gz-tools2</exec_depend>

<test_depend>libxml2-utils</test_depend>
<test_depend>python3-psutil</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>cmake</build_type>
</export>
</package>
6 changes: 0 additions & 6 deletions src/Console.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ using namespace sdf;
static std::shared_ptr<Console> myself;
static std::mutex g_instance_mutex;

/// \todo Output disabled for windows, to allow tests to pass. We should
/// disable output just for tests on windows.
#ifndef _WIN32
static bool g_quiet = false;
#else
static bool g_quiet = true;
#endif

static Console::ConsoleStream g_NullStream(nullptr);

Expand Down
50 changes: 25 additions & 25 deletions src/JointAxis_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,58 +226,58 @@ TEST(DOMJointAxis, ToElement)
sdf::ElementPtr dynElem = elem->GetElement("dynamics", errors);
ASSERT_TRUE(errors.empty());

double damping = 0;
damping = dynElem->Get<double>(errors, "damping", damping).first;
double damping;
damping = dynElem->Get<double>(errors, "damping", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(0.2, damping);

double friction = 0;
friction = dynElem->Get<double>(errors, "friction", friction).first;
double friction;
friction = dynElem->Get<double>(errors, "friction", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.3, friction);

double springReference = 0;
double springReference;
springReference = dynElem->Get<double>(
errors, "spring_reference", springReference).first;
errors, "spring_reference", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(2.4, springReference);

double springStiffness = 0;
double springStiffness;
springStiffness = dynElem->Get<double>(
errors, "spring_stiffness", springStiffness).first;
errors, "spring_stiffness", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(-1.2, springStiffness);

// Check //axis/limit
sdf::ElementPtr limitElem = elem->GetElement("limit", errors);
double lower = 0;
lower = limitElem->Get<double>(errors, "lower", lower).first;
double lower;
lower = limitElem->Get<double>(errors, "lower", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(-10.8, lower);

double upper = 0;
upper = limitElem->Get<double>(errors, "upper", upper).first;
double upper;
upper = limitElem->Get<double>(errors, "upper", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(123.4, upper);

double effort = 0;
effort = limitElem->Get<double>(errors, "effort", effort).first;
double effort;
effort = limitElem->Get<double>(errors, "effort", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(3.2, effort);

double maxVel = 0;
maxVel = limitElem->Get<double>(errors, "velocity", maxVel).first;
double maxVel;
maxVel = limitElem->Get<double>(errors, "velocity", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(54.2, maxVel);

double stiffness = 0;
stiffness = limitElem->Get<double>(errors, "stiffness", stiffness).first;
double stiffness;
stiffness = limitElem->Get<double>(errors, "stiffness", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1e2, stiffness);

double dissipation = 0;
double dissipation;
dissipation = limitElem->Get<double>(
errors, "dissipation", dissipation).first;
errors, "dissipation", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.5, dissipation);

Expand All @@ -286,31 +286,31 @@ TEST(DOMJointAxis, ToElement)
ASSERT_NE(nullptr, mimicElem);
std::string mimicJointName;
mimicJointName = mimicElem->Get<std::string>(
errors, "joint", mimicJointName).first;
errors, "joint", "").first;
ASSERT_TRUE(errors.empty());
EXPECT_EQ("test_joint", mimicJointName);

std::string mimicAxisName;
mimicAxisName = mimicElem->Get<std::string>(
errors, "axis", mimicAxisName).first;
errors, "axis", "").first;
ASSERT_TRUE(errors.empty());
EXPECT_EQ("axis2", mimicAxisName);

double multiplier;
multiplier = mimicElem->Get<double>(
errors, "multiplier", multiplier).first;
errors, "multiplier", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(5.0, multiplier);

double offset;
offset = mimicElem->Get<double>(
errors, "offset", offset).first;
errors, "offset", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.0, offset);

double reference;
reference = mimicElem->Get<double>(
errors, "reference", reference).first;
errors, "reference", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(2.0, reference);

Expand Down
8 changes: 7 additions & 1 deletion src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ set(cmd_script_configured "${CMAKE_CURRENT_BINARY_DIR}/cmd${PROJECT_NAME}.rb.con

# Set the library_location variable to the relative path to the library file
# within the install directory structure.
set(library_location "../../../${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:${PROJECT_NAME}>")
if (MSVC)
set(library_location_prefix "${CMAKE_INSTALL_BINDIR}")
else()
set(library_location_prefix "${CMAKE_INSTALL_LIBDIR}")
endif()

set(library_location "../../../${library_location_prefix}/$<TARGET_FILE_NAME:${PROJECT_NAME}>")

configure_file(
"cmd${PROJECT_NAME_NO_VERSION_LOWER}.rb.in"
Expand Down
16 changes: 12 additions & 4 deletions src/cmd/cmdsdformat.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ else
end

require 'optparse'
require 'pathname'


# Constants.
LIBRARY_NAME = '@library_location@'
Expand Down Expand Up @@ -174,9 +176,7 @@ class Cmd
# puts options

# Read the plugin that handles the command.
if LIBRARY_NAME[0] == '/'
# If the first character is a slash, we'll assume that we've been given an
# absolute path to the library. This is only used during test mode.
if Pathname.new(LIBRARY_NAME).absolute?
plugin = LIBRARY_NAME
else
# We're assuming that the library path is relative to the current
Expand All @@ -185,10 +185,18 @@ class Cmd
end
conf_version = LIBRARY_VERSION

if defined? RubyInstaller
# RubyInstaller does not search for dlls in PATH or the directory that tests are running from,
# so we'll add the parent directory of the plugin to the search path.
# https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#-dll-loading
RubyInstaller::Runtime.add_dll_directory(File.dirname(plugin))
end

begin
Importer.dlload plugin
rescue DLError
rescue DLError => error
puts "Library error: [#{plugin}] not found."
puts "DLError: #{error.message}"
exit(-1)
end

Expand Down
Loading

0 comments on commit 213814c

Please sign in to comment.