Skip to content

Commit 8539837

Browse files
authored
Merge pull request #1 from borglab/fix-build-2
Upgrade to sdformat15
2 parents c0061df + 8bbc02f commit 8539837

11 files changed

Lines changed: 36 additions & 36 deletions

File tree

.github/workflows/linux-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
5555
sudo apt-get -y update
5656
57-
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat13-dev
57+
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat15-dev
5858
5959
# Install CppUnitLite.
6060
git clone https://github.com/borglab/CppUnitLite.git

.github/workflows/macos-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
brew install boost
4646
brew tap osrf/simulation
47-
brew install sdformat13
47+
brew install sdformat15
4848
brew tap borglab/core
4949
5050
- name: GTSAM

.github/workflows/python-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
5555
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
5656
sudo apt-get -y update
57-
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat13-dev
57+
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat15-dev
5858
5959
- name: Install System Dependencies (macOS)
6060
if: runner.os == 'macOS'
@@ -70,7 +70,7 @@ jobs:
7070
fi
7171
brew install boost
7272
brew tap osrf/simulation
73-
brew install sdformat13
73+
brew install sdformat15
7474
7575
- name: Python Dependencies (Linux)
7676
if: runner.os == 'Linux'

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ endif()
4646
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools")
4747

4848
# For parsing urdf/sdf files. # TODO: hardcoded sdformat version
49-
set(SDFormat_VERSION 13)
49+
set(SDFormat_VERSION 15)
5050
find_package(sdformat${SDFormat_VERSION} REQUIRED)
5151

5252
# ##############################################################################

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GTDynamics is a library that allows the user to express the full kinodynamics co
1313

1414
* [GTSAM4](https://github.com/borglab/gtsam)
1515
* [gtwrap](https://github.com/borglab/wrap)
16-
* [sdformat13](https://github.com/osrf/sdformat)
16+
* [sdformat15](https://github.com/osrf/sdformat)
1717

1818
## Installing SDFormat
1919

@@ -26,9 +26,9 @@ Using Homebrew is the easiest way to get SDFormat installed and it also makes sw
2626
```sh
2727
$ # Install homebrew.
2828
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
29-
$ # Set up the tap ind install sdformat13
29+
$ # Set up the tap and install sdformat15
3030
$ brew tap osrf/simulation
31-
$ brew install sdformat13
31+
$ brew install sdformat15
3232
```
3333

3434
### Source
@@ -48,10 +48,10 @@ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
4848
sudo apt-get update
4949

5050
# Install SDFormat dependencies
51-
sudo apt-get install -y libtinyxml2-dev liburdfdom-dev libignition-cmake2-dev libignition-tools-dev libignition-math6-dev
51+
sudo apt-get install -y libtinyxml2-dev liburdfdom-dev libgz-cmake2-dev libgz-tools-dev libgz-math6-dev
5252

5353
# Set the version to install
54-
export GTD_SDFormat_VERSION="13.0.0"
54+
export GTD_SDFormat_VERSION="15.0.0"
5555

5656
# Download specific version of SDFormat
5757
wget http://osrf-distributions.s3.amazonaws.com/sdformat/releases/sdformat-${GTD_SDFormat_VERSION}.tar.bz2

docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ WORKDIR /usr/src/
1010
# Make sure we have latest packages
1111
RUN apt-get -y update
1212

13-
# Install basic dependencies for sdfformat
13+
# Install basic dependencies for sdformat
1414
RUN apt-get install -y ruby-dev build-essential libboost-all-dev cmake pkg-config wget lsb-release
1515

1616
# Get Gazebo packages
1717
RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
1818
RUN wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -
1919
RUN apt-get update
20-
RUN apt-get install -y libtinyxml2-dev liburdfdom-dev libignition-cmake2-dev libignition-tools-dev libignition-math6-dev python3-psutil
20+
RUN apt-get install -y libtinyxml2-dev liburdfdom-dev libgz-cmake2-dev libgz-tools-dev libgz-math6-dev python3-psutil
2121

2222
# Get sdfformat package
23-
ENV GTD_SDFormat_VERSION="10.5.0"
23+
ENV GTD_SDFormat_VERSION="15.0.0"
2424
RUN wget http://osrf-distributions.s3.amazonaws.com/sdformat/releases/sdformat-${GTD_SDFormat_VERSION}.tar.bz2
2525
RUN tar -xvjf sdformat-${GTD_SDFormat_VERSION}.tar.bz2
2626
RUN rm sdformat-${GTD_SDFormat_VERSION}.tar.bz2

examples/cmake_project_example/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_package(GTSAM REQUIRED)
88
find_path(gtdynamics_include gtdynamics)
99
find_library(gtdynamics_lib gtdynamics)
1010
# these next 3 lines are temporary until we create a proper cmake module for gtdynamics.
11-
set(SDFormat_VERSION 12)
11+
set(SDFormat_VERSION 15)
1212
find_package(sdformat${SDFormat_VERSION} REQUIRED)
1313
list(APPEND gtdynamics_lib ${SDFormat_LIBRARIES})
1414

gtdynamics/universal_robot/sdf.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ sdf::Model GetSdf(const std::string &sdf_file_path,
7878
throw std::runtime_error("Model not found in: " + sdf_file_path);
7979
}
8080

81-
gtsam::Pose3 Pose3FromIgnition(const ignition::math::Pose3d &ignition_pose) {
82-
const auto &rot = ignition_pose.Rot();
83-
const auto &pos = ignition_pose.Pos();
81+
gtsam::Pose3 Pose3FromGazebo(const gz::math::Pose3d &gazebo_pose) {
82+
const auto &rot = gazebo_pose.Rot();
83+
const auto &pos = gazebo_pose.Pos();
8484
return gtsam::Pose3(
8585
gtsam::Rot3(gtsam::Quaternion(rot.W(), rot.X(), rot.Y(), rot.Z())),
8686
gtsam::Point3(pos[0], pos[1], pos[2]));
@@ -115,7 +115,7 @@ Pose3 GetSdfLinkFrame(const sdf::Link *sdf_link) {
115115
}
116116

117117
// Pose is updated from joint frame to base frame.
118-
const Pose3 bMl = Pose3FromIgnition(raw_pose);
118+
const Pose3 bMl = Pose3FromGazebo(raw_pose);
119119
return bMl;
120120
}
121121

@@ -128,7 +128,7 @@ Pose3 GetJointFrame(const sdf::Joint &sdf_joint,
128128

129129
// Get the pose of the joint in the parent or child link's frame depending on
130130
// the value of `frame_name`.
131-
Pose3 lTj = Pose3FromIgnition(sdf_joint.RawPose());
131+
Pose3 lTj = Pose3FromGazebo(sdf_joint.RawPose());
132132

133133
if (frame_name.empty() || frame_name == child_sdf_link->Name()) {
134134
// If `frame_name` is empty or has the same name as the child_link, it means
@@ -175,12 +175,12 @@ LinkSharedPtr LinkFromSdf(uint8_t id, const sdf::Link &sdf_link) {
175175
// Get the pose of the link in the base frame
176176
// we only save the bMcom rest matrix as part of the Link class
177177
const Pose3 bMl = GetSdfLinkFrame(&sdf_link);
178-
const Pose3 lMcom = Pose3FromIgnition(sdf_link.Inertial().Pose());
178+
const Pose3 lMcom = Pose3FromGazebo(sdf_link.Inertial().Pose());
179179
const Pose3 bMcom = bMl * lMcom;
180180

181181
return std::make_shared<Link>(id, sdf_link.Name(),
182-
sdf_link.Inertial().MassMatrix().Mass(),
183-
inertia, bMcom, bMl);
182+
sdf_link.Inertial().MassMatrix().Mass(),
183+
inertia, bMcom, bMl);
184184
}
185185

186186
LinkSharedPtr LinkFromSdf(uint8_t id, const std::string &link_name,
@@ -214,20 +214,20 @@ JointSharedPtr JointFromSdf(uint8_t id, const LinkSharedPtr &parent_link,
214214
switch (sdf_joint.Type()) {
215215
case sdf::JointType::PRISMATIC:
216216
joint = std::make_shared<PrismaticJoint>(id, name, bMj, parent_link,
217-
child_link, axis, parameters);
217+
child_link, axis, parameters);
218218
break;
219219
case sdf::JointType::REVOLUTE:
220220
joint = std::make_shared<RevoluteJoint>(id, name, bMj, parent_link,
221-
child_link, axis, parameters);
221+
child_link, axis, parameters);
222222
break;
223223
case sdf::JointType::SCREW:
224224
joint = std::make_shared<HelicalJoint>(
225225
id, name, bMj, parent_link, child_link, axis, sdf_joint.ThreadPitch(),
226226
parameters);
227227
break;
228228
case sdf::JointType::FIXED:
229-
joint = std::make_shared<FixedJoint>(id, name, bMj, parent_link,
230-
child_link);
229+
joint =
230+
std::make_shared<FixedJoint>(id, name, bMj, parent_link, child_link);
231231
break;
232232
default:
233233
throw std::runtime_error("Joint type for [" + name +
@@ -256,8 +256,8 @@ static LinkJointPair ExtractRobotFromSdf(const sdf::Model &sdf) {
256256
sdf::Joint sdf_joint = *sdf.JointByIndex(j);
257257

258258
// Get this joint's parent and child links.
259-
std::string parent_link_name = sdf_joint.ParentLinkName();
260-
std::string child_link_name = sdf_joint.ChildLinkName();
259+
std::string parent_link_name = sdf_joint.ParentName();
260+
std::string child_link_name = sdf_joint.ChildName();
261261
if (parent_link_name == "world") {
262262
// This joint fixes the child link in the world frame.
263263
LinkSharedPtr child_link = name_to_link[child_link_name];

gtdynamics/universal_robot/sdf_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <gtdynamics/universal_robot/Robot.h>
1717

18-
#include <ignition/math/Pose3.hh>
18+
#include <gz/math/Pose3.hh>
1919
#include <sdf/sdf.hh>
2020
#include <string>
2121

@@ -64,11 +64,11 @@ JointSharedPtr JointFromSdf(uint8_t id, const LinkSharedPtr &parent_link,
6464
const sdf::Joint &sdf_joint);
6565

6666
/**
67-
* Parse a ignition::math Pose object into a gtsam::Pose.
67+
* Parse a gz::math Pose object into a gtsam::Pose.
6868
*
69-
* @param ignition_pose An ignition::math::Pose object to be parsed.
69+
* @param gazebo_pose An gz::math::Pose object to be parsed.
7070
*/
71-
gtsam::Pose3 Pose3FromIgnition(const ignition::math::Pose3d &ignition_pose);
71+
gtsam::Pose3 Pose3FromGazebo(const gz::math::Pose3d &gazebo_pose);
7272

7373
/**
7474
* @fn Extract joint parameter values from an input sdf::Joint.

tests/testSdf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ TEST(Sdf, load_and_parse_sdf_world_file) {
8080
EXPECT(assert_equal(0.03, l1.Inertial().Moi()(2, 2)));
8181
}
8282

83-
TEST(Sdf, Pose3FromIgnition) {
84-
ignition::math::Pose3d pose_to_parse(-1, 1, -1, M_PI / 2, 0, -M_PI);
83+
TEST(Sdf, Pose3FromGazebo) {
84+
gz::math::Pose3d pose_to_parse(-1, 1, -1, M_PI / 2, 0, -M_PI);
8585

86-
gtsam::Pose3 parsed_pose = Pose3FromIgnition(pose_to_parse);
86+
gtsam::Pose3 parsed_pose = Pose3FromGazebo(pose_to_parse);
8787

8888
EXPECT(assert_equal(gtsam::Pose3(gtsam::Rot3::RzRyRx(M_PI / 2, 0, -M_PI),
8989
gtsam::Point3(-1, 1, -1)),

0 commit comments

Comments
 (0)