Skip to content

Commit 45d7940

Browse files
authored
Merge pull request #395 from havriutkin/fix-build
Fix build
2 parents 4a9fdb2 + 938b2ff commit 45d7940

24 files changed

Lines changed: 145 additions & 1021 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 libsdformat12-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 sdformat12
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 libsdformat12-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 sdformat12
73+
brew install sdformat15
7474
7575
- name: Python Dependencies (Linux)
7676
if: runner.os == 'Linux'

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ endif()
4545
# For Python wrapper.
4646
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools")
4747

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

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

README.md

Lines changed: 24 additions & 10 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-
* [sdformat12](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 sdformat12
29+
$ # Set up the tap and install sdformat15
3030
$ brew tap osrf/simulation
31-
$ brew install sdformat12
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="10.5.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
@@ -72,9 +72,12 @@ $ git clone https://github.com/borglab/GTDynamics.git
7272
$ cd GTDynamics
7373
$ mkdir build; cd build
7474
# We can specify the install path with -DCMAKE_INSTALL_PREFIX
75+
# To compile with Python wrapper support, ensure that GTSAM was built with Python
76+
# and use -DGTDYNAMICS_BUILD_PYTHON=ON
7577
$ cmake -DCMAKE_INSTALL_PREFIX=../install ..
7678
$ make
7779
$ sudo make install
80+
# Run make python-install for installation with Python
7881
```
7982

8083
## Running Tests
@@ -91,11 +94,22 @@ We recommend going through the examples to get a better understanding of how to
9194

9295
*NOTE* The examples are made to run within the GTDynamics source folder and are not standalone projects.
9396

94-
Run these examples with
95-
```sh
96-
$ make example_XXX.run
97-
```
98-
where `XXX` corresponds to a folder name in `examples`. For example, `make example_forward_dynamics.run`.
97+
1. Build GTDynamics and navigate to the `build` folder:
98+
```sh
99+
$ cd build
100+
```
101+
102+
2. Run the example using:
103+
```sh
104+
$ make example_XXX.run
105+
```
106+
where `XXX` corresponds to the example name. Example names align with folder names in `examples`, but some of them have added suffixes. For example, `make example_forward_dynamics.run` or `make example_spider_walking_forward`.
107+
108+
3. Run the simulation using:
109+
```sh
110+
$ make example_XXX.sim
111+
```
112+
where `XXX` corresponds to the folder name in `examples`. For example, `make example_quadruped_mp.sim` or `make example_spider_walking.sim`. Make sure you have `pybullet` and `matplotlib` installed in your Python environment.
99113

100114
## Including GTDynamics With CMake
101115

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/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,30 @@ set(EXAMPLE_SUBDIRS
1313
example_quadruped_mp
1414
example_spider_walking
1515
example_constraint_manifold
16+
# example_talos_walking # In progress
1617
)
1718

1819
# Add each example subdirectory for compilation
1920
foreach(EXAMPLE ${EXAMPLE_SUBDIRS})
2021
add_subdirectory(${EXAMPLE})
2122
endforeach()
23+
24+
# --- Process Python Animation Scripts ---
25+
# This automatically finds 'animate.py' scripts and creates .animate targets.
26+
message(STATUS "Searching for python animation scripts...")
27+
foreach(EXAMPLE_NAME ${EXAMPLE_SUBDIRS})
28+
set(ANIMATION_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_NAME}/sim.py")
29+
30+
if(EXISTS ${ANIMATION_SCRIPT})
31+
message(STATUS " -- Found animation script for ${EXAMPLE_NAME}, creating '.sim' target")
32+
add_custom_target(${EXAMPLE_NAME}.sim
33+
COMMAND
34+
python3 ${ANIMATION_SCRIPT}
35+
WORKING_DIRECTORY
36+
"${CMAKE_CURRENT_BINARY_DIR}"
37+
COMMENT
38+
"Running animation for ${EXAMPLE_NAME}..."
39+
VERBATIM
40+
)
41+
endif()
42+
endforeach()

examples/README,md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Examples build status
2+
3+
## GTD Examples Status
4+
5+
| Name | Cpp Status | Animation Status |
6+
| :--- | :--- | :--- |
7+
| `quadruped_mp` | 🟢 Working | 🟢 Working |
8+
| `a1_walking_forward` | 🔴 Runtime Error | ⚫️ Not started |
9+
| `a1_walking_forward_combined` | 🔴 Runtime Error | ⚫️ Not started |
10+
| `cart_pole_trajectory_optimization` | 🟢 Working | 🟢 Working |
11+
| `forward_dynamics` | 🟢 Working | ⚫️ Not Implemented |
12+
| `full_kinodynamic_balancing` | 🟢 Working | 🟢 Working |
13+
| `full_kinodynamic_walking_walk_forward` | 🟢 Working | 🟡 Runs With Errors |
14+
| `full_kinodynamic_walking_rotate` | 🟢 Working | 🟡 Runs With Errors |
15+
| `inverted_pendulum_trajectory_optimization` | 🟢 Working | 🔴 Not Working |
16+
| `spider_walking_forward` | 🟢 Working | 🔴 Not Working |
17+
| `spider_walking_rotate` | 🟢 Working | 🔴 Not Working |

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

examples/example_a1_walking/sim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
print(pybullet_data.getDataPath())
1717
p.setGravity(0, 0, -9.8)
1818
p.setRealTimeSimulation(1)
19-
planeId = p.loadURDF("plane.urdf")
19+
planeId = p.loadURDF(gtd.URDF_PATH + "plane.urdf", useFixedBase=True)
2020
p.changeDynamics(planeId, -1, lateralFriction=0.4)
2121
robot = p.loadURDF(gtd.URDF_PATH + "/a1/a1.urdf",[0,0,0.45],[0,0,0,1.0])
2222

@@ -30,7 +30,7 @@
3030
joint_to_jid_map[jinfo[1].decode("utf-8")] = jinfo[0]
3131

3232
#Read walk forward trajectory file from build (after running the example)
33-
df = pd.read_csv(gtd.URDF_PATH + '/../../build/examples/example_a1_walking/a1_traj_DG_mass.csv')
33+
df = pd.read_csv('a1_traj_DG_mass.csv')
3434

3535
pos, orn = p.getBasePositionAndOrientation(robot_id)
3636

0 commit comments

Comments
 (0)