Skip to content

Commit

Permalink
remove C++ visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mayataka committed Oct 29, 2022
1 parent c0cee91 commit 2f4a3f9
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 702 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ jobs:
sudo apt install -qqy robotpkg-py310-pinocchio
sudo apt install -qqy robotpkg-py310-qt5-gepetto-viewer
sudo apt install -qqy robotpkg-py310-qt5-gepetto-viewer-corba
- name: Install pinocchio-gepetto-viewer
run: |
export PATH=/opt/openrobots/bin:$PATH >> ~/.bashrc
export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/openrobots/lib/python2.7/site-packages:$PYTHONPATH
export PYTHONPATH=/opt/openrobots/lib/python3.8/site-packages:$PYTHONPATH
export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
git clone https://github.com/stack-of-tasks/pinocchio-gepetto-viewer.git --recursive
cd pinocchio-gepetto-viewer
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
sudo make install
cd ../..
- name: Install lcov
run: |
sudo apt-get update -y
Expand All @@ -72,7 +57,7 @@ jobs:
export PYTHONPATH=/opt/openrobots/lib/python3.8/site-packages:$PYTHONPATH
export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_VIEWER=ON -DBUILD_TESTS=ON
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON
cmake --build . --config Debug
ctest --output-on-failure
- name: Collect and upload coverage to Codecov
Expand Down
26 changes: 0 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ endif()
## Options ##
#############
option(OPTIMIZE_FOR_NATIVE "Enable -march=native" OFF)
option(BUILD_VIEWER "Build trajectory viewer" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
option(BUILD_PYTHON_INTERFACE "Build Python interface" ON)

Expand All @@ -33,8 +32,6 @@ find_package(OpenMP REQUIRED)
# build robotoc
file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES src/*.cpp)
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS include/${PROJECT_NAME}/*.h*)
list(FILTER ${PROJECT_NAME}_SOURCES EXCLUDE REGEX ".trajectory_viewer.")
list(FILTER ${PROJECT_NAME}_HEADERS EXCLUDE REGEX ".trajectory_viewer.")
add_library(
${PROJECT_NAME}
SHARED
Expand Down Expand Up @@ -85,29 +82,6 @@ if (MACOSX)
)
endif()

##################
## Build viewer ##
##################
if (BUILD_VIEWER)
find_package(PkgConfig)
pkg_check_modules(pinocchio-gepetto-viewer REQUIRED pinocchio-gepetto-viewer)
target_sources(
${PROJECT_NAME}
PRIVATE
src/utils/trajectory_viewer.cpp
)
target_link_libraries(
${PROJECT_NAME}
PUBLIC
${pinocchio-gepetto-viewer_LINK_LIBRARIES}
)
target_include_directories(
${PROJECT_NAME}
PUBLIC
${pinocchio-gepetto-viewer_INCLUDE_DIRS}
)
endif() # end if (BUILD_VIEWER)

#############
## Testing ##
#############
Expand Down
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
- Eigen3, [Pinocchio](https://stack-of-tasks.github.io/pinocchio/download.html) ,
- Python3, NumPy (for Python binding)
- [gepetto-viewer-corba](https://github.com/Gepetto/gepetto-viewer-corba.git) and/or [meshcat-python](https://github.com/rdeits/meshcat-python) (optional to visualize the solution trajectory in Python)
- [pinocchio-gepetto-viewer](https://github.com/stack-of-tasks/pinocchio-gepetto-viewer) (optional to visualize the solution trajectory in C++)
- [PyBullet](https://pybullet.org/wordpress/) (optional to simulate MPC examples)

## Installation
Expand Down Expand Up @@ -64,24 +63,12 @@ and/or [meshcat-python](https://github.com/rdeits/meshcat-python) by
pip install meshcat
```

6. If you want to visualize the solution trajectory with C++, in addition to [gepetto-viewer-corba](https://github.com/Gepetto/gepetto-viewer-corba.git), you have to install [pinocchio-gepetto-viewer](https://github.com/stack-of-tasks/pinocchio-gepetto-viewer), e.g., by
```
git clone https://github.com/stack-of-tasks/pinocchio-gepetto-viewer.git --recursive && cd pinocchio-gepetto-viewer
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make install
```
and add the CMake option for `robotoc` as
```
cmake .. -DBUILD_VIEWER=ON
```

7. If you do not want to install the Python bindings, change the CMake configuration as
6. If you do not want to install the Python bindings, change the CMake configuration as
```
cmake .. -DBUILD_PYTHON_INTERFACE=OFF
```

8. In OSX, explicitly set g++ as the complier. First, find the path of g++ as
7. In OSX, explicitly set g++ as the complier. First, find the path of g++ as
```
ls -l /usr/local/bin | grep g++
```
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/robotoc/utils/trajectory_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, model_info: robotoc.RobotModelInfo, pkg_path=None, viewer_typ
self.robot.collision_model,
self.robot.visual_model)
else:
print('Please choose viewer_type from "gepetto" or "meshcat"!')
print('Please choose viewer_type from "gepetto", "meshcat", or "rviz"!')
return NotImplementedError()


Expand Down
21 changes: 3 additions & 18 deletions doc/installation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@ and/or [meshcat-python](https://github.com/rdeits/meshcat-python) by
pip install meshcat
```

\section install_cpp_viewer 3. (Optional) Install pinocchio-gepetto-viewer
If you want to visualize the solution trajectory with C++, in addition to [gepetto-viewer-corba](https://github.com/Gepetto/gepetto-viewer-corba.git), you have to install [pinocchio-gepetto-viewer](https://github.com/stack-of-tasks/pinocchio-gepetto-viewer), e.g., by
```
git clone https://github.com/stack-of-tasks/pinocchio-gepetto-viewer.git --recursive && cd pinocchio-gepetto-viewer
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make install
```

\section install_robotoc 4. Install robotoc
\section install_robotoc 3. Install robotoc
Clone `robotoc` repository and change the directory as

```
Expand All @@ -66,19 +57,13 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE_FOR_NATIVE=ON

This option enables the vectorization of Eigen.

If you want to visualize the solution trajectory through C++, add the CMake option as

```
cmake .. -DBUILD_VIEWER=ON
```

If you do not want to install the Python bindings, change the CMake configuration as
```
cmake .. -DBUILD_PYTHON_INTERFACE=OFF
```
However, we highly recommend installing Python bindings.

\section add_python_path 5. (Optional, but recommended) Adding Python path
\section add_python_path 4. (Optional, but recommended) Adding Python path
After installing `robotoc` and its Python bindings, it is convenient to set the path to `robotoc` library in Python path.
Suppose that the Python version is 3.8. The Python bindings will then be installed at `ROBOTOC_INSTALL_DIR/lib/python3.8/site-packages` where `ROBOTOC_INSTALL_DIR` is the install directory of `robotoc` configured in CMake (e.g., by `-DCMAKE_INSTALL_PREFIX` or `/use/local/lib` if you did `sudo make install`).
To use the installed Python library, it is convenient to set the environment variable as
Expand All @@ -89,7 +74,7 @@ export PYTHONPATH=ROBOTOC_INSTALL_DIR/lib/python3.8/site-packages:$PYTHONPATH

e.g., in `~/.bashrc`. Note that if you use another Python version than `python3.8`, please adapt it.

\section install_pybullet 6. (Optional, but recommended) Install pybullet
\section install_pybullet 5. (Optional, but recommended) Install pybullet
To use `robotoc_sim` module for MPC simulations, please install [PyBullet](https://pybullet.org/wordpress/) as
```
pip install pybullet
Expand Down
10 changes: 0 additions & 10 deletions examples/anymal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set(CMAKE_CXX_STANDARD 11)

find_package(robotoc REQUIRED)

option(ENABLE_VIEWER "Enable trajectory viewer" OFF)

macro(add_benchmark BENCHMARK)
add_executable(
${BENCHMARK}
Expand All @@ -29,13 +27,6 @@ macro(add_example EXAMPLE)
PRIVATE
robotoc::robotoc
)
if (ENABLE_VIEWER)
target_compile_definitions(
${EXAMPLE}
PRIVATE
ENABLE_VIEWER
)
endif()
endmacro()

add_benchmark(ocp_benchmark)
Expand All @@ -46,5 +37,4 @@ add_example(pace)
add_example(bounce)
add_example(jump)
add_example(run)

add_example(jump_sto)
12 changes: 0 additions & 12 deletions examples/anymal/bounce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -245,13 +241,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization .timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
12 changes: 0 additions & 12 deletions examples/anymal/crawl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -265,13 +261,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
12 changes: 0 additions & 12 deletions examples/anymal/jump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -194,13 +190,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
12 changes: 0 additions & 12 deletions examples/anymal/jump_sto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -187,13 +183,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
12 changes: 0 additions & 12 deletions examples/anymal/pace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -245,13 +241,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
21 changes: 0 additions & 21 deletions examples/anymal/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


class ConfigurationSpaceRef final : public robotoc::ConfigurationSpaceRefBase {
public:
Expand Down Expand Up @@ -322,22 +318,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
Eigen::Vector3d camera_pos;
Eigen::Vector4d camera_quat;
camera_pos << 0.119269, -7.96283, 1.95978;
camera_quat << 0.609016, 0.00297497, 0.010914, 0.793077;
viewer.setCameraTransform(camera_pos, camera_quat);
viewer.display(ocp_solver.getSolution("q"), time_steps);
camera_pos << 5.10483, -3.98692, 1.59321;
camera_quat << 0.547037, 0.243328, 0.314829, 0.736495;
viewer.setCameraTransform(camera_pos, camera_quat);
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
12 changes: 0 additions & 12 deletions examples/anymal/trot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#include "robotoc/utils/ocp_benchmarker.hpp"

#ifdef ENABLE_VIEWER
#include "robotoc/utils/trajectory_viewer.hpp"
#endif


int main(int argc, char *argv[]) {
robotoc::RobotModelInfo model_info;
Expand Down Expand Up @@ -246,13 +242,5 @@ int main(int argc, char *argv[]) {
// const int num_iteration = 10000;
// robotoc::benchmark::CPUTime(ocp_solver, t, q, v, num_iteration);

#ifdef ENABLE_VIEWER
robotoc::TrajectoryViewer viewer(path_to_urdf, robotoc::BaseJointType::FloatingBase);
const auto time_discretization = ocp_solver.getTimeDiscretization();
const auto time_steps = time_discretization.timeSteps();
viewer.display(robot, ocp_solver.getSolution("q"),
ocp_solver.getSolution("f", "WORLD"), time_steps, mu);
#endif

return 0;
}
Loading

0 comments on commit 2f4a3f9

Please sign in to comment.