Skip to content

Commit

Permalink
Merge branch 'gz-math7' into scpeters/merge_7_main
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed May 6, 2024
2 parents 2f1e049 + 02e37a6 commit ca1cc35
Show file tree
Hide file tree
Showing 17 changed files with 414 additions and 36 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Ubuntu CI

on: [push, pull_request]
on:
pull_request:
push:
branches:
- 'ign-math[0-9]'
- 'gz-math[0-9]'
- 'main'

jobs:
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
Expand All @@ -22,7 +28,7 @@ jobs:
name: Ubuntu Noble CI
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@noble
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
1 change: 0 additions & 1 deletion .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ jobs:
with:
project-url: https://github.com/orgs/gazebosim/projects/7
github-token: ${{ secrets.TRIAGE_TOKEN }}

12 changes: 11 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ load(
"@gz//bazel/lint:lint.bzl",
"add_lint_tests",
)
load(
"@rules_license//rules:license.bzl",
"license",
)

package(
default_applicable_licenses = [GZ_ROOT + "math:license"],
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
)

licenses(["notice"]) # Apache-2.0
license(
name = "license",
package_name = "gz-math",
)

licenses(["notice"])

exports_files(["LICENSE"])

Expand Down
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,18 @@ endif()
if (SKIP_PYBIND11)
message(STATUS "SKIP_PYBIND11 set - disabling python bindings")
else()
include(GzPython)
find_package(PythonLibs QUIET)
if (NOT PYTHONLIBS_FOUND)
GZ_BUILD_WARNING("Python is missing: Python interfaces are disabled.")
message (STATUS "Searching for Python - not found.")
#include(GzPython) TODO: allow to specify for what it should search and then
# the code below can be removed; e.g. pybind needs Interpreter and Development components
# see https://pybind11.readthedocs.io/en/stable/cmake/index.html#new-findpython-mode
find_package(Python3 QUIET COMPONENTS Interpreter Development)

if (NOT Python3_FOUND)
GZ_BUILD_WARNING("Python3 is missing: Python interfaces are disabled.")
message (STATUS "Searching for Python3 - not found.")
else()
message (STATUS "Searching for Python - found version ${PYTHONLIBS_VERSION_STRING}.")
message (STATUS "Searching for Python3 - found version ${Python3_VERSION}.")

set(PYBIND11_PYTHON_VERSION 3)
find_package(Python3 QUIET COMPONENTS Interpreter Development)
find_package(pybind11 2.2 QUIET)

if (${pybind11_FOUND})
Expand Down
63 changes: 63 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,47 @@

## Gazebo Math 7.x

### Gazebo Math 7.4.0 (2024-03-14)

1. Added MecanumDriveOdometry Python wrapper
* [Pull request #549](https://github.com/gazebosim/gz-math/pull/549)

1. Update CI badges in README
* [Pull request #571](https://github.com/gazebosim/gz-math/pull/571)

1. Infrastructure
* [Pull request #569](https://github.com/gazebosim/gz-math/pull/569)

1. Suppress warnings on MSVC
* [Pull request #564](https://github.com/gazebosim/gz-math/pull/564)

1. Remove the use of numeric_limits in appendToStream test
* [Pull request #553](https://github.com/gazebosim/gz-math/pull/553)

1. Replace CMake Python variables with new ones from FindPython3 module
* [Pull request #402](https://github.com/gazebosim/gz-math/pull/402)

1. Fix `Matrix3_TEST.py` on Windows with conda-forge dependencies
* [Pull request #561](https://github.com/gazebosim/gz-math/pull/561)

1. Fix small typo cppgetstarted.md
* [Pull request #560](https://github.com/gazebosim/gz-math/pull/560)

1. Update Ubuntu Binary installation since apt-key is deprecated
* [Pull request #559](https://github.com/gazebosim/gz-math/pull/559)

1. Update file tree in README to point out pybind11
* [Pull request #558](https://github.com/gazebosim/gz-math/pull/558)

1. Update tutorial/color.md
* [Pull request #557](https://github.com/gazebosim/gz-math/pull/557)

1. ign->gz in README.md
* [Pull request #556](https://github.com/gazebosim/gz-math/pull/556)

1. Update example_triangle.md
* [Pull request #555](https://github.com/gazebosim/gz-math/pull/555)

### Gazebo Math 7.3.0 (2023-08-29)

1. Adds a validity check for Sessions created using the `TimeVaryingVolumetricGrid`
Expand Down Expand Up @@ -274,6 +315,28 @@

## Gazebo Math 6.x

## Gazebo Math 6.15.1 (2024-01-05)

1. Replace CMake Python variables with new ones from FindPython3 module
* [Pull request #402](https://github.com/gazebosim/gz-math/pull/402)

1. Suppress warnings on MSVC
* [Pull request #564](https://github.com/gazebosim/gz-math/pull/564)

1. Infrastructure
* [Pull request #569](https://github.com/gazebosim/gz-math/pull/569)

## Gazebo Math 6.15.0 (2023-09-01)

1. Fixes for testing in non standard architectures
* [Pull request #546](https://github.com/gazebosim/gz-math/pull/546)

1. MecanumDriveOdometry to handle odometry estimation of Mecanum wheeled models
* [Pull request #486](https://github.com/gazebosim/gz-math/pull/486)

1. Infrastructure
* [Pull request #547](https://github.com/gazebosim/gz-math/pull/547)

## Gazebo Math 6.14.0 (2023-04-14)

1. Disable pybind11 on windows by default
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gazebo Math : Math classes and functions for robot applications

**Maintainer:** nate AT openrobotics DOT org
**Maintainer:** scpeters AT openrobotics DOT org

[![GitHub open issues](https://img.shields.io/github/issues-raw/gazebosim/gz-math.svg)](https://github.com/gazebosim/gz-math/issues)
[![GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/gazebosim/gz-math.svg)](https://github.com/gazebosim/gz-math/pulls)
Expand All @@ -9,10 +9,10 @@

Build | Status
-- | --
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-math/branch/gz-math8/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-math/branch/gz-math8)
Ubuntu Focal | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_math-ci-gz-math8-focal-amd64)](https://build.osrfoundation.org/job/ignition_math-ci-gz-math8-focal-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_math-ci-gz-math8-homebrew-amd64)](https://build.osrfoundation.org/job/ignition_math-ci-gz-math8-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ign_math-ci-win)](https://build.osrfoundation.org/job/ign_math-ci-win)
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-math/branch/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-math/branch/main)
Ubuntu Jammy | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_math-ci-main-jammy-amd64)](https://build.osrfoundation.org/job/gz_math-ci-main-jammy-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_math-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/gz_math-ci-main-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_math-main-win)](https://build.osrfoundation.org/job/gz_math-main-win)

Gazebo Math, a component of [Gazebo](https://gazebosim.org), provides general purpose math
classes and functions designed for robotic applications.
Expand Down
15 changes: 11 additions & 4 deletions eigen3/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)

package(default_applicable_licenses = [GZ_ROOT + "math:license"])

public_headers = glob([
"include/gz/math/eigen3/*.hh",
])

gz_include_header(
name = "eigen3_hh_genrule",
out = "include/gz/math/eigen3.hh",
hdrs = public_headers,
)

cc_library(
name = "eigen3",
srcs = public_headers,
hdrs = public_headers,
hdrs = public_headers + [
"include/gz/math/eigen3.hh",
],
includes = ["include"],
visibility = GZ_VISIBILITY,
deps = [
Expand Down
13 changes: 13 additions & 0 deletions include/gz/math/graph/Graph.hh
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,19 @@ namespace graph
return iter->second;
}

/// \brief Get a mutable reference to an edge using its Id.
/// \param[in] _id The Id of the edge.
/// \return A mutable reference to the edge with Id = _id or NullEdge if
/// not found.
public: EdgeType &EdgeFromId(const EdgeId &_id)
{
auto iter = this->edges.find(_id);
if (iter == this->edges.end())
return EdgeType::NullEdge;

return iter->second;
}

/// \brief Stream insertion operator. The output uses DOT graph
/// description language.
/// \param[out] _out The output stream.
Expand Down
25 changes: 25 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>gz-math8</name>
<version>8.0.0</version>
<description>Gazebo Math : Math classes and functions for robot applications</description>
<maintainer email="[email protected]">Steve Peters</maintainer>
<maintainer email="[email protected]">Aditya Pande</maintainer>
<license>Apache License 2.0</license>
<url type="website">https://github.com/gazebosim/gz-math</url>

<buildtool_depend>cmake</buildtool_depend>

<build_depend>gz-cmake4</build_depend>
<build_depend>pybind11-dev</build_depend>

<depend>eigen</depend>
<depend>gz-utils3</depend>

<test_depend>python3-pytest</test_depend>

<export>
<build_type>cmake</build_type>
</export>
</package>
2 changes: 2 additions & 0 deletions src/graph/GraphUndirected_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ TEST(UndirectedGraphTest, AddEdge)
auto edge = graph.EdgeFromId(e2.Id());
EXPECT_DOUBLE_EQ(5.0, edge.Data());
EXPECT_DOUBLE_EQ(6.0, edge.Weight());
edge.Data() = 7.0;
EXPECT_DOUBLE_EQ(7.0, edge.Data());

// Check that the edges point to the right vertices.
EXPECT_EQ(0u, e0.Vertices().first);
Expand Down
9 changes: 2 additions & 7 deletions src/python_pybind11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
# pybind11 logic for setting up a debug build when both a debug and release
# python interpreter are present in the system seems to be pretty much broken.
# This works around the issue.
set(PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES}")
endif()

message(STATUS "Building pybind11 interfaces")
set(BINDINGS_MODULE_NAME "math${PROJECT_VERSION_MAJOR}")
# Split from main extension and converted to pybind11
Expand All @@ -29,6 +22,7 @@ pybind11_add_module(${BINDINGS_MODULE_NAME} MODULE
src/Matrix3.cc
src/Matrix4.cc
src/Matrix6.cc
src/MecanumDriveOdometry.cc
src/MovingWindowFilter.cc
src/PID.cc
src/Polynomial3.cc
Expand Down Expand Up @@ -135,6 +129,7 @@ if (BUILD_TESTING)
Matrix3_TEST
Matrix4_TEST
Matrix6_TEST
MecanumDriveOdometry_TEST
MovingWindowFilter_TEST
OrientedBox_TEST
PID_TEST
Expand Down
74 changes: 74 additions & 0 deletions src/python_pybind11/src/MecanumDriveOdometry.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (C) 2023 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <string>

#include <gz/math/MecanumDriveOdometry.hh>

#include "MecanumDriveOdometry.hh"

namespace gz
{
namespace math
{
namespace python
{
void defineMathMecanumDriveOdometry(py::module &m, const std::string &typestr)
{
using Class = gz::math::MecanumDriveOdometry;
std::string pyclass_name = typestr;
py::class_<Class>(m,
pyclass_name.c_str(),
py::buffer_protocol())
.def(py::init<size_t>(), py::arg("_windowSize") = 10)
.def("init", &Class::Init, "Initialize the odometry")
.def("initialized", &Class::Initialized, "Get whether Init has been called.")
.def("update",
&Class::Update,
"Updates the odometry class with latest wheels and "
"steerings position")
.def("heading", &Class::Heading, "Get the heading.")
.def("x", &Class::X, "Get the X position.")
.def("y", &Class::Y, "Get the Y position.")
.def("linear_velocity",
&Class::LinearVelocity,
"Get the linear velocity.")
.def("angular_velocity",
&Class::AngularVelocity,
"Get the angular velocity.")
.def("lateral_velocity",
&Class::LateralVelocity,
"Get the lateral velocity.")
.def("set_wheel_params",
&Class::SetWheelParams,
"Set the wheel parameters including the radius and separation.")
.def("set_velocity_rolling_window_size",
&Class::SetVelocityRollingWindowSize,
"Set the velocity rolling window size.")
.def("wheel_separation", &Class::WheelSeparation, "Get the wheel separation")
.def("wheel_base", &Class::WheelBase, "Get the wheel base")
.def("left_wheel_radius",
&Class::LeftWheelRadius,
"Get the left wheel radius")
.def("right_wheel_radius",
&Class::RightWheelRadius,
"Get the rightwheel radius");

}
} // namespace python
} // namespace math
} // namespace gz
Loading

0 comments on commit ca1cc35

Please sign in to comment.