Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gsaurel/gepetto-viewer-corba
  • gepetto/gepetto-viewer-corba
2 results
Show changes
Commits on Source (425)
# pre-commit run -a (Guilhem Saurel, 2022-10-20)
b04b074db9e058d06b5db27316afbb3d9eea9173
# format (Guilhem Saurel, 2022-04-05)
62b5dafa1a15795521ab3c31d321b37fd46ae69f
name: "CI - Nix"
on:
push:
jobs:
nix:
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L
......@@ -3,3 +3,4 @@ _build/*
Xcode/*
coverage/*
build*
*.pyc
include: https://rainboard.laas.fr/project/gepetto-viewer-corba/.gitlab-ci.yml
[submodule "cmake"]
path = cmake
url = git://github.com/jrl-umi3218/jrl-cmakemodules.git
url = https://github.com/jrl-umi3218/jrl-cmakemodules.git
pull_request_rules:
- name: merge automatically when CI passes and PR is approved
conditions:
- check-success = "gitlab-ci"
- check-success = "nix (macos)"
- check-success = "nix (ubuntu)"
- check-success = "pre-commit.ci - pr"
- or:
- author = pre-commit-ci[bot]
- author = dependabot[bot]
actions:
merge:
ci:
autoupdate_branch: devel
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
exclude: poetry.lock
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
args:
- --style=Google
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
Developped in LAAS-CNRS France.
Mathieu Geisert
# Copyright (c) 2014 CNRS
# Author: Mathieu Geisert, Florent Lamiraux
# Copyright (c) 2014, 2020 CNRS Author: Mathieu Geisert, Florent Lamiraux,
# Guilhem Saurel
#
# This file is part of gepetto-viewer-corba.
# gepetto-viewer-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
# This file is part of gepetto-viewer-corba. gepetto-viewer-corba is free
# software: you can redistribute it and/or modify it under the terms of the GNU
# Lesser General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# gepetto-viewer-corba is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# gepetto-viewer-corba. If not, see
# gepetto-viewer-corba is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Lesser Public License
# for more details. You should have received a copy of the GNU Lesser General
# Public License along with gepetto-viewer-corba. If not, see
# <http://www.gnu.org/licenses/>.
# Requires at least CMake 2.8 to configure the package.
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CXX_DISABLE_WERROR true)
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake-modules/
${CMAKE_MODULE_PATH})
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/idl.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/boost.cmake)
SET(PROJECT_NAME gepetto-viewer-corba)
SET(PROJECT_DESCRIPTION "Corba server for gepetto-viewer")
SET(PROJECT_URL "")
SET(CLIENT_ONLY FALSE CACHE BOOL "Set to true to install the client only")
SET(USE_QT4 TRUE CACHE BOOL "Use Qt4 instead of Qt5")
SET(${PROJECT_NAME}_HEADERS
include/gepetto/viewer/corba/windows-manager.hh
include/gepetto/viewer/corba/server.hh
include/gepetto/viewer/corba/client.hh
include/gepetto/viewer/corba/fwd.hh
)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
OPTION(DISABLE_SAMPLING "Activate this option if your computer have no graphic card or a small one" OFF)
if(DISABLE_SAMPLING)
ADD_DEFINITIONS(-DDISABLE_SAMPLING)
endif()
SETUP_PROJECT ()
# Dependencies
ADD_REQUIRED_DEPENDENCY("omniORB4 >= 4.1.4")
IF(NOT CLIENT_ONLY)
ADD_REQUIRED_DEPENDENCY("openscenegraph >= 3.2")
ADD_REQUIRED_DEPENDENCY("openscenegraph-osgQt")
ADD_REQUIRED_DEPENDENCY("openthreads >= 2.6")
ADD_REQUIRED_DEPENDENCY("gepetto-viewer")
ADD_REQUIRED_DEPENDENCY("urdfdom")
SET(BOOST_COMPONENTS system thread regex)
SEARCH_FOR_BOOST ()
FINDPYTHON(2.7 EXACT)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(USE_QT4)
FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtOpenGl QtNetwork)
SET(PKG_CONFIG_EXTRA "qtversion=${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
ELSE(USE_QT4)
FOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Network")
FIND_PACKAGE ("Qt5${component}" REQUIRED)
LIST(APPEND QT_INCLUDE_DIRS ${Qt5${component}_INCLUDE_DIRS})
LIST(APPEND QT_LIBRARIES ${Qt5${component}_LIBRARIES} )
ENDFOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Network")
SET(PKG_CONFIG_EXTRA "qtversion=${Qt5Core_VERSION}")
ENDIF(USE_QT4)
FIND_PACKAGE(PythonQt COMPONENTS QtAll)
SET(GEPETTO_GUI_HAS_PYTHONQT (${PythonQt_FOUND} AND ${PythonQt_QtAll_FOUND}) CACHE BOOL "Use PythonQt dependency")
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
INCLUDE_DIRECTORIES(SYSTEM ${EIGEN3_INCLUDE_DIRS} ${QT_INCLUDE_DIRS})
SET (${PROJECT_NAME}_HEADERS_MOC
${CMAKE_SOURCE_DIR}/include/gepetto/gui/mainwindow.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/safeapplication.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/osgwidget.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/tree-item.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/bodytreewidget.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/ledindicator.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/omniorb/omniorbthread.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/dialog/dialogloadrobot.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/dialog/dialogloadenvironment.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/dialog/pluginmanagerdialog.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/pick-handler.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/shortcut-factory.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/selection-handler.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/selection-event.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/windows-manager.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/action-search-bar.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/node-action.hh
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME gepetto-viewer-corba)
set(PROJECT_DESCRIPTION "Corba server for gepetto-viewer")
set(PROJECT_URL "https://github.com/Gepetto/${PROJECT_NAME}")
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
set(CXX_DISABLE_WERROR true)
set(DOXYGEN_USE_TEMPLATE_CSS TRUE)
# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
IF(GEPETTO_GUI_HAS_PYTHONQT)
SET (${PROJECT_NAME}_HEADERS_MOC
${${PROJECT_NAME}_HEADERS_MOC}
${CMAKE_SOURCE_DIR}/include/gepetto/gui/pythonwidget.hh)
ENDIF(GEPETTO_GUI_HAS_PYTHONQT)
SET (${PROJECT_NAME}_HEADERS_NO_MOC
${CMAKE_SOURCE_DIR}/include/gepetto/gui/fwd.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/meta.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/settings.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/color-map.hh
${CMAKE_BINARY_DIR}/include/gepetto/gui/config-dep.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/plugin-interface.hh
${CMAKE_SOURCE_DIR}/include/gepetto/gui/omniorb/url.hh
)
SET(${PROJECT_NAME}_FORMS
${CMAKE_SOURCE_DIR}/include/gepetto/gui/ui/mainwindow.ui
${CMAKE_SOURCE_DIR}/include/gepetto/gui/ui/dialogloadrobot.ui
${CMAKE_SOURCE_DIR}/include/gepetto/gui/ui/dialogloadenvironment.ui
${CMAKE_SOURCE_DIR}/include/gepetto/gui/ui/pluginmanagerdialog.ui
)
SET(${PROJECT_NAME}_RESOURCES ${CMAKE_SOURCE_DIR}/res/images.qrc)
SET(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_HEADERS_MOC}
${${PROJECT_NAME}_HEADERS_NO_MOC})
config_files(
include/gepetto/gui/config-dep.hh
src/gui/main.cc
)
ENDIF(NOT CLIENT_ONLY)
ADD_SUBDIRECTORY(src)
IF(NOT CLIENT_ONLY)
ADD_SUBDIRECTORY(src/gui)
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(pyplugins)
ADD_SUBDIRECTORY(blender)
ADD_SUBDIRECTORY(examples EXCLUDE_FROM_ALL)
ADD_SUBDIRECTORY(tests)
ENDIF(NOT CLIENT_ONLY)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
endif()
SETUP_PROJECT_FINALIZE()
include("${JRL_CMAKE_MODULES}/base.cmake")
include("${JRL_CMAKE_MODULES}/idl.cmake")
include("${JRL_CMAKE_MODULES}/apple.cmake")
set(CLIENT_ONLY
FALSE
CACHE BOOL "Set to true to install the client only")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
if(APPLE)
apply_default_apple_configuration()
endif(APPLE)
# {{{ C++ and Python client. Dependencies
add_required_dependency("omniORB4 >= 4.1.4")
set(${PROJECT_NAME}_HEADERS
include/gepetto/viewer/corba/api.hh include/gepetto/viewer/corba/client.hh
include/gepetto/viewer/corba/conversions.hh)
# }}}
# {{{ C++ server.
if(NOT CLIENT_ONLY)
# {{{ Dependencies for the server.
add_project_dependency("gepetto-viewer" REQUIRED)
# Get desired Qt version
string(REPLACE "." ";" DESIRED_QT_VERSION_LIST ${GEPETTO_VIEWER_QTVERSION})
list(GET DESIRED_QT_VERSION_LIST 0 DESIRED_QT_VERSION_MAJOR)
if(${DESIRED_QT_VERSION_MAJOR} EQUAL 4)
set(PROJECT_USE_QT4 True)
elseif(${DESIRED_QT_VERSION_MAJOR} EQUAL 5)
set(PROJECT_USE_QT4 False)
else()
message(FATAL_ERROR "This package is only compatible with Qt 4 and Qt 5")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(GEPETTO_VIEWER_CORBA_QTVERSION "${GEPETTO_VIEWER_QTVERSION}")
set(PKG_CONFIG_EXTRA "qtversion=${GEPETTO_VIEWER_CORBA_QTVERSION}")
set(PACKAGE_EXTRA_MACROS
"set(GEPETTO_VIEWER_CORBA_QTVERSION ${GEPETTO_VIEWER_CORBA_QTVERSION})")
# }}}
# {{{ Packaging
pkg_config_append_libs(${PROJECT_NAME})
# For backward compatibility
set(PKG_CONFIG_EXTRA
"${PKG_CONFIG_EXTRA}\ncmake_plugin=${GEPETTO_VIEWER_CMAKE_PLUGIN}")
# }}}
# {{{ Set list of headers
list(APPEND ${PROJECT_NAME}_HEADERS
${CMAKE_SOURCE_DIR}/include/gepetto/gui/omniorb/url.hh)
# }}}
endif(NOT CLIENT_ONLY)
# }}}
add_subdirectory(src)
add_subdirectory(doc)
if(NOT CLIENT_ONLY)
add_subdirectory(plugins)
add_subdirectory(blender)
add_subdirectory(examples EXCLUDE_FROM_ALL)
add_subdirectory(tests)
endif(NOT CLIENT_ONLY)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
# vim: foldmethod=marker foldlevel=0
Copyright (c) 2013-2014,
Copyright (c) 2013-2014,
LAAS-CNRS France
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright notice,
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the <ORGANIZATION> nor the names of its contributors
* Neither the name of the <ORGANIZATION> nor the names of its contributors
may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
......
Release 1.1.0: on May 7. 2015
=============================
new feature since 1.0.0:
-*- outline -*-
New in 5.5.0
* Parameter meshDataRootDir has been removed from idl methods addUrdf, addUrdfCollision, addUrdfObjects.
* Add package.xml
Enable urdf parser to tolerate several geometries for each link.
New primitives are supported, like
- arrows,
- capsules.
New feratures have been added, like
- camera control,
- highlight mode,
- lightning control,
- transparency mode,
- keyboard shortcuts,
- roadmap display for path planning.
API has been enriched to get better control
New in 5.3.0
* Add python trivial test
* Handle CORBA Exception
* Add IDL setVector2Property and getVector2Property
* Move pyplugins to gepetto-viewer package.
* Remove unused PythonQt and QGv dependencies and unused files.
* Add Quaternion.fromTwoVectors
Release 1.0.0 on March 3. 2015
==============================
\ No newline at end of file
New in v1.1.0
* Enable urdf parser to tolerate several geometries for each link.
* New primitives are supported, like
- arrows,
- capsules.
* New feratures have been added, like
- camera control,
- highlight mode,
- lightning control,
- transparency mode,
- keyboard shortcuts,
- roadmap display for path planning.
* API has been enriched to get better control
CORBA server/client for the Graphical Interface of Pinocchio and HPP
====================================================================
# CORBA server/client for the Graphical Interface of Pinocchio and HPP
[![Building Status](https://travis-ci.org/gepetto/gepetto-viewer-corba.svg?branch=master)](https://travis-ci.org/gepetto/gepetto-viewer-corba)
[![Pipeline status](https://gitlab.laas.fr/gepetto/gepetto-viewer-corba/badges/master/pipeline.svg)](https://gitlab.laas.fr/gepetto/gepetto-viewer-corba/commits/master)
[![Coverage report](https://gitlab.laas.fr/gepetto/gepetto-viewer-corba/badges/master/coverage.svg?job=doc-coverage)](https://gepettoweb.laas.fr/doc/gepetto/gepetto-viewer-corba/master/coverage/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gepetto/gepetto-viewer-corba/master.svg)](https://results.pre-commit.ci/latest/github/gepetto/gepetto-viewer-corba)
## Summary
* [gepetto-viewer-corba] (#gepetto-viewer-corba)
* [Setup] (#setup)
* [Dependencies] (#dependencies)
* [Install standalone urdfdom] (#install-standalone-urdfdom)
* [gepetto-gui] (#gepetto-gui)
* [gepetto-viewer-corba](#gepetto-viewer-corba)
* [Setup](#setup)
* [Dependencies](#dependencies)
* [gepetto-gui](#gepetto-gui)
* [Usage](#usage)
* [Basic usage](#basic-usage)
* [Adding predefined robots and environments](#adding-predefined-robots-and-environments)
......@@ -15,11 +20,17 @@ CORBA server/client for the Graphical Interface of Pinocchio and HPP
* [Installation procedure](#installation-procedure)
* [Dependencies](#dependencies)
* [PythonQt](#pythonqt)
* [Python 3](#python-3)
* [Troubleshooting](#troubleshooting)
## gepetto-viewer-corba
###Setup
-----
### Setup from robotpkg apt binary package repository
1. Add robotpkg to your apt configuration: http://robotpkg.openrobots.org/debian.html
2. `sudo apt update && sudo apt install robotpkg-py27-qt4-gepetto-viewer-corba` (or `py35` on 16.04 / `py36` on 18.04)
### Setup from sources
To compile this package, it is recommended to create a separate build
directory:
......@@ -32,6 +43,16 @@ directory:
Please note that CMake produces a `CMakeCache.txt` file which should
be deleted to reconfigure a package from scratch.
### Makefile
A Makefile that installs the dependencies is provided for convinience. Please follow those steps:
- copy `doc/Makefile`,
- open and set the variable `SRC_DIR` and `INSTALL_DIR`,
- optionally, change `OSG_PACKAGE` and `QT_VERSION`,
- run `make all`
Note that the environment variables `PATH`, `LD_LIBRARY_PATH` and `PKG_CONFIG_PATH` should include
the path to the installation directory.
### Dependencies
......@@ -41,23 +62,11 @@ have to be available on your machine.
- Libraries:
- omniORB4 (version >= 4.1.4)
- openscenegraph (version >= 3.2)
- urdfdom (version >= 0.3.0)
- SceneViewer (Graphical Interface of Pinocchio and HPP)
- GepettoViewer (Graphical Interface of Pinocchio and HPP)
- System tools:
- CMake (>=2.6)
- pkg-config
- usual compilation tools (GCC/G++, make, etc.)
### Install standalone urdfdom
In order to read urdf files (see http://wiki.ros.org/urdf for the description), one haves to install the urdfdom package which can come either along ROS library or be installed as a standalone library. Next section describes the second procedure.
urdfdom depends on both console_bridge and urdfdom_headers. The installation of both dependencies can be done with the following command lines in a terminal :
- git clone git://github.com/ros/console_bridge.git && cd console_bridge && mkdir build && cd build && cmake .. && make && sudo make install
- git clone git://github.com/ros/urdfdom_headers && cd urdfdom_headers && mkdir build && cd build && cmake .. && make && sudo make install
Finally, you just need to apply the following command line to install urdfdom library :
- git clone git://github.com/ros/urdfdom && cd urdfdom && mkdir build && cd build && cmake .. && make && sudo make install
## gepetto-gui
## Usage
......@@ -134,25 +143,25 @@ OPTIONS=""
# Using the core framework: hppcorbaserver
gepetto-gui -g ${OPTIONS} \
--load-plugin libhppwidgetsplugin.so \
--load-plugin libhppcorbaserverplugin.so \
--load-plugin libremoteimuplugin.so
--load-plugin hppwidgetsplugin.so \
--load-plugin hppcorbaserverplugin.so \
--load-plugin remoteimuplugin.so
# Using the manipulation framework: hpp-manipulation-server
gepetto-gui -g ${OPTIONS} \
--load-plugin libhppmanipulationwidgetsplugin.so \
--load-plugin libhppmanipulationplugin.so \
--load-plugin libhppmonitoringplugin.so \
--load-plugin libremoteimuplugin.so
--load-plugin hppmanipulationwidgetsplugin.so \
--load-plugin hppmanipulationplugin.so \
--load-plugin hppmonitoringplugin.so \
--load-plugin remoteimuplugin.so
```
###### Manually
Open `${CMAKE_INSTALL_PREFIX}/etc/gepetto-gui/settings.conf` and write:
```
[plugins]
libhppcorbaserverplugin.so=true
libremoteimuplugin.so=true
libhppwidgetsplugin.so=true
hppcorbaserverplugin.so=true
remoteimuplugin.so=true
hppwidgetsplugin.so=true
```
The plugins are looked for in the directory `${CMAKE_INSTALL_PREFIX}/lib/gepetto-gui-plugins`
......@@ -163,7 +172,7 @@ As [HPP], the *GUI* can be controlled using a python interface. When the *GUI* s
When you do so, pay attention to the following points:
- the GUI has no way of knowing when to refresh the list of joints and bodies. **There is a refresh button in the `Tools` menu**.
- you can run the `hppcorbaserver` (or any server embedding it, like `hpp-manipulation-server`) externally. Use `Tools > Reset connection` when the CORBA client has to reconnect to a new server.
In this case, set `libhppcorbaserverplugin.so` and `libhppmanipulationplugin.so` to `false` in your settings file because they are launching the servers themselves.
In this case, set `hppcorbaserverplugin.so` and `hppmanipulationplugin.so` to `false` in your settings file because they are launching the servers themselves.
- moving the robot in the GUI while the server is processing data can lead to unexpected results, because you are modifying the *current configuration* of HPP when not expected.
## Installation procedure
......@@ -189,8 +198,51 @@ To install `gepetto-gui` you just have to follow the installation step at the to
### PythonQt
gepetto-gui offers the possibility to develop plugins in python. To do so, you must install PythonQt by following the instructions here: https://github.com/jmirabel/PythonQt#readme
### Python 3
This section describes the procedure to get bindings for Python 3.
The support for Python 3 is from `OmniORB 4.2.2`.
In Ubuntu 16.04, the version is 4.2.1, and in Ubuntu 18.04 it is 4.2.2, but Ubuntu main repos do not provide python 3 support.
Thus, to make it work you must manually compile `OmniORB 4.2.2`.
Download latest versions of `OmniORB` and `OmniORBpy` from [sourceforge](https://sourceforge.net/projects/omniorb/).
Then compile `OmniORB` making sure it finds python3:
```bash
export PYTHON=/usr/bin/python3
cd omniORB-4.2.2/
mkdir build
cd build
../configure --prefix=${CMAKE_INSTALL_PREFIX}
make
make install
```
Compile `OmniORBpy` making sure it finds python3:
```bash
cd omniORBpy-4.2.2/
mkdir build
cd build
../configure --prefix=${CMAKE_INSTALL_PREFIX}
make
make install
```
Finally you can compile and install `gepetto-viewer-corba` making sure it finds `OmniORB 4.2.2`.
# Troubleshooting
## Display of large meshes is very slow
A solution to help reducing the rendering time is to use Level Of Details (LOD).
In short, you can use the following command to generate a LOD for mesh named `mesh.ext`.
```sh
gvtools --input mesh.ext --simplify 1,0,1 --simplify 0.5,1,3 --simplify 0.2,3,100 --output mesh.ext.osgb
```
This will create a LOD with three levels:
- from 0 to 1 meters, use original mesh,
- from 1 to 3 meters, use simplified mesh with ratio 0.5 (half less vertices),
- from 3 to 100 meters, use simplified mesh with ratio 0.2,
- farther than 100 meters, don't show anything.
`gvtools` is part of *gepetto-viewer* package. See `gvtools --help` for more details.
## `CORBA::TRANSIENT` when launching a server
It very often happens that the OmniNames server failed to start properly at boot.
......@@ -202,14 +254,27 @@ ps -C omniNames -o pid,args
If the process is not running, delete omniNames related log and backup files in `/var/lib/omniorb`. They may have different names on your computer, but most likely, something like:
```bash
rm /var/lib/omniORB/omninames-<computer_name>.log
rm /var/lib/omniORB/omninames-<computer_name>.bak
sudo rm /var/lib/omniORB/omninames-`hostname`.log
sudo rm /var/lib/omniORB/omninames-`hostname`.bak
```
then restart the server:
```bash
sudo service omniorb4-nameserver restart
```
## Collada files are not displayed
The nodes are created and exists in the body tree widget but nothing appears in the scene viewer. This is due to a conflict between OSG and Qt. A work around is to convert the DAE to osg using the following command:
```bash
# <file> is the name of the file including the DAE extension.
# The output filename will end with .dae.osg.
osgconv <file> <file>.osg
```
If you have many files, you may run that at the root of the meshes subdirectories:
```bash
find ${root_of_meshes_directory} -iname "*.dae" -type f -exec osgconv {} {}.osg \;
```
[HPP]:http://projects.laas.fr/gepetto/index.php/Software/Hpp
[remoteimu]:https://github.com/jmirabel/remoteimu
[hpp-gui]:https://github.com/jmirabel/hpp-gui
......
# Copyright (c) 2015 CNRS
# Author: Joseph Mirabel
# Copyright (c) 2015 CNRS Author: Joseph Mirabel
#
# This file is part of gepetto-viewer-corba.
# gepetto-viewer-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
# This file is part of gepetto-viewer-corba. gepetto-viewer-corba is free
# software: you can redistribute it and/or modify it under the terms of the GNU
# Lesser General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# gepetto-viewer-corba is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# gepetto-viewer-corba. If not, see
# gepetto-viewer-corba is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Lesser Public License
# for more details. You should have received a copy of the GNU Lesser General
# Public License along with gepetto-viewer-corba. If not, see
# <http://www.gnu.org/licenses/>.
SET (BLENDER_EXE "" CACHE FILEPATH "Path to the blender executable")
set(BLENDER_EXE
""
CACHE FILEPATH "Path to the blender executable")
IF (EXISTS ${BLENDER_EXE})
CONFIGURE_FILE (install_addon.py.in ${CMAKE_CURRENT_BINARY_DIR}/install_addon.py)
# ADD_CUSTOM_COMMAND (OUTPUT nothing
# COMMAND echo "${BLENDER_EXE}"
# COMMENT "Installing the blender addon")
# COMMAND ${BLENDER_EXE}
# --background --enable-autoexec
# --python ${CMAKE_CURRENT_SOURCE_DIR}/install_addon.py
ADD_CUSTOM_TARGET (blender
PYTHONPATH=/usr/lib/python3/dist-packages/
${BLENDER_EXE} --background --enable-autoexec
--python ${CMAKE_CURRENT_BINARY_DIR}/install_addon.py
COMMENT "Installing the blender addon")
ENDIF (EXISTS ${BLENDER_EXE})
if(EXISTS ${BLENDER_EXE})
configure_file(install_addon.py.in
${CMAKE_CURRENT_BINARY_DIR}/install_addon.py)
# ADD_CUSTOM_COMMAND (OUTPUT nothing COMMAND echo "${BLENDER_EXE}" COMMENT
# "Installing the blender addon") COMMAND ${BLENDER_EXE} --background
# --enable-autoexec --python ${CMAKE_CURRENT_SOURCE_DIR}/install_addon.py
add_custom_target(
blender
PYTHONPATH=/usr/lib/python3/dist-packages/ ${BLENDER_EXE} --background
--enable-autoexec --python ${CMAKE_CURRENT_BINARY_DIR}/install_addon.py
COMMENT "Installing the blender addon")
endif(EXISTS ${BLENDER_EXE})
INSTALL (PROGRAMS urdf_to_blender.py DESTINATION bin)
install(PROGRAMS urdf_to_blender.py DESTINATION bin)
......@@ -22,102 +22,123 @@
# https://github.com/jmirabel/gepetto-viewer-corba/tree/devel/blender
###
import os
import bpy
import bpy_extras.io_utils
import yaml
bl_info = {
"author": "Joseph Mirabel",
"name" : "Gepetto Viewer Blender Addon",
"name": "Gepetto Viewer Blender Addon",
"category": "Import-Export",
"blender": (2,75,0),
"description": "Add functionality to import files generated using the Gepetto Viewer software",
"blender": (2, 75, 0),
"description": "Add functionality to import files generated "
"using the Gepetto Viewer software",
"location": "SpaceBar Search > YAML Gepetto or URDF blender",
"wiki_url": "https://github.com/jmirabel/gepetto-viewer-corba/tree/master/blender#readme",
"warning" : "Not heavily tested, feel free to report bug on github.",
"version" : (0,0),
"support" : "COMMUNITY"
}
"wiki_url": "https://github.com/jmirabel/gepetto-viewer-corba/tree/master/blender",
"warning": "Not heavily tested, feel free to report bug on github.",
"version": (0, 0),
"support": "COMMUNITY",
}
import bpy
import bpy_extras.io_utils
import re
import yaml, os
def loadmotion (filename):
with open (filename) as file:
data = yaml.load (file)
for frameId in range (len(data.keys())):
frameKey = "frame_" + str (frameId)
def loadmotion(filename):
with open(filename) as file:
data = yaml.load(file)
for frameId in range(len(data.keys())):
frameKey = "frame_" + str(frameId)
objPositions = data[frameKey]
for objName, pos in objPositions.items ():
for objName, pos in objPositions.items():
currentObj = bpy.context.scene.objects.get(objName)
if currentObj:
currentObj.rotation_mode = 'QUATERNION'
currentObj.rotation_mode = "QUATERNION"
posF = [float(x) for x in pos]
currentObj.location = posF[0:3]
currentObj.rotation_quaternion = posF[3:7]
currentObj.keyframe_insert (data_path="location", frame=frameId)
currentObj.keyframe_insert (data_path="rotation_quaternion", frame=frameId)
currentObj.keyframe_insert(data_path="location", frame=frameId)
currentObj.keyframe_insert(
data_path="rotation_quaternion", frame=frameId
)
else:
print("Unknown object " + objName)
def checkframe (filename, frameId):
with open (filename) as file:
data = yaml.load (file)
frameKey = "frame_" + str (frameId)
def checkframe(filename, frameId):
with open(filename) as file:
data = yaml.load(file)
frameKey = "frame_" + str(frameId)
objPositions = data[frameKey]
for objName, pos in objPositions.items ():
for objName, pos in objPositions.items():
currentObj = bpy.context.scene.objects.get(objName)
if currentObj:
currentObj.rotation_mode = 'QUATERNION'
currentObj.rotation_mode = "QUATERNION"
posF = [float(x) for x in pos]
currentObj.location = posF[0:3]
currentObj.rotation_quaternion = posF[3:7]
else:
print("Unknown object " + objName)
class YamlPathImport (bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
class YamlPathImport(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
bl_idname = "import.gepettoimport"
bl_label = "Import a YAML Gepetto Viewer path file"
files = bpy.props.CollectionProperty(name="File Path", type=bpy.types.OperatorFileListElement,)
directory = bpy.props.StringProperty(subtype='DIR_PATH',)
files = bpy.props.CollectionProperty(
name="File Path",
type=bpy.types.OperatorFileListElement,
)
directory = bpy.props.StringProperty(
subtype="DIR_PATH",
)
def execute(self, context):
dir = self.directory
for f in self.files:
fullname = os.path.join (dir, f.name)
self.report ({'INFO'}, "Loading " + str(fullname))
fullname = os.path.join(dir, f.name)
self.report({"INFO"}, "Loading " + str(fullname))
loadmotion(fullname)
return {'FINISHED'}
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
return {"RUNNING_MODAL"}
class UrdfToBlendImport (bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
class UrdfToBlendImport(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
bl_idname = "import.urdf_to_blendimport"
bl_label = "Import a URDF blender script"
files = bpy.props.CollectionProperty(name="File Path", type=bpy.types.OperatorFileListElement,)
directory = bpy.props.StringProperty(subtype='DIR_PATH',)
files = bpy.props.CollectionProperty(
name="File Path",
type=bpy.types.OperatorFileListElement,
)
directory = bpy.props.StringProperty(
subtype="DIR_PATH",
)
def execute(self, context):
dir = self.directory
for f in self.files:
fullname = os.path.join (dir, f.name)
self.report ({'INFO'}, "Loading " + str(fullname))
fullname = os.path.join(dir, f.name)
self.report({"INFO"}, "Loading " + str(fullname))
exec(open(fullname).read())
return {'FINISHED'}
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
return {"RUNNING_MODAL"}
def register():
bpy.utils.register_class(YamlPathImport)
bpy.utils.register_class(UrdfToBlendImport)
def unregister():
bpy.utils.unregister_class(YamlPathImport)
bpy.utils.unregister_class(UrdfToBlendImport)
if __name__ == "__main__":
register()
#!/usr/bin/env python2.7
from __future__ import print_function
import roslib; roslib.load_manifest('urdf_parser_py')
import rospy
import resource_retriever
import sys, getopt
import os.path
import getopt
import inspect
import os.path
import sys
import resource_retriever
import roslib
import urdf_parser_py.urdf as urdf
def usage ():
print (os.path.basename(sys.argv[0]) + " [--env] [-p <prefix>] -i <urdf-file> -o <blender-script>\n")
print ("Arguments:")
print ("\t-i urdf-file \t[mandatory]\tinput URDF file")
print ("\t-o blender-script\t[mandatory]\toutput blender script")
print ("\t-p prefix \t[optional] \tprefix of object names")
print ("\t--env \t[optional] \tobject static transform will be ignored")
roslib.load_manifest("urdf_parser_py")
def usage():
print(
os.path.basename(sys.argv[0])
+ " [--env] [-p <prefix>] -i <urdf-file> -o <blender-script>\n"
)
print("Arguments:")
print("\t-i urdf-file \t[mandatory]\tinput URDF file")
print("\t-o blender-script\t[mandatory]\toutput blender script")
print("\t-p prefix \t[optional] \tprefix of object names")
print("\t--env \t[optional] \tobject static transform will be ignored")
try:
opts, args = getopt.getopt (sys.argv[1:], "p:i:o:", ["env", "prefix=", "in=", "out="])
opts, args = getopt.getopt(
sys.argv[1:], "p:i:o:", ["env", "prefix=", "in=", "out="]
)
except getopt.GetoptError as err:
usage ()
print ("\nError: " + err.msg + "\n")
usage()
print("\nError: " + err.msg + "\n")
raise
prefix = ""
......@@ -39,19 +48,19 @@ for opt, arg in opts:
isEnv = True
if urdfFilename is None or blendFilename is None:
usage ()
sys.exit (2)
usage()
sys.exit(2)
## There is a bug in urdf_parser_py that has been fixed in a later release.
## See https://github.com/ros/urdfdom/pull/38
## and https://github.com/ros/urdfdom/pull/46/files
# There is a bug in urdf_parser_py that has been fixed in a later release.
# See https://github.com/ros/urdfdom/pull/38
# and https://github.com/ros/urdfdom/pull/46/files
for tag in urdf.JointLimit.XML_REFL.attributes:
if tag.var == 'upper' or tag.var == 'lower':
if tag.var == "upper" or tag.var == "lower":
tag.required = False
tag.default = 0
## There is something wrong with tag transmission
## This just disables it but it is not the right way of doing it.
# There is something wrong with tag transmission
# This just disables it but it is not the right way of doing it.
urdf.Transmission.XML_REFL.attributes = list()
urdf.Transmission.XML_REFL.vars = list()
urdf.Transmission.XML_REFL.required_attribute_names = list()
......@@ -61,34 +70,38 @@ urdf.Transmission.XML_REFL.element_map = dict()
urdf.Transmission.XML_REFL.scalarNames = list()
urdf.Transmission.XML_REFL.scalars = list()
robot = urdf.URDF.from_xml_file (urdfFilename)
robot = urdf.URDF.from_xml_file(urdfFilename)
def resolve_ros_path (path):
filename = resource_retriever.get_filename (path)
if filename.startswith ("file://"):
def resolve_ros_path(path):
filename = resource_retriever.get_filename(path)
if filename.startswith("file://"):
return filename[7:]
else:
print ("Path might not be understood by blender: " + filename)
print("Path might not be understood by blender: " + filename)
return filename
def updateFrameMessage ():
def updateFrameMessage():
callerframerecord = inspect.stack()[1]
info = inspect.getframeinfo(callerframerecord[0])
print ("Update function %s in script %s:%i" % (info.function, info.filename, info.lineno))
print(f"Update function {info.function} in script {info.filename}:{info.lineno}")
class CreateBlenderObject:
def __init__ (self, prefix, file):
self.run = dict ()
def __init__(self, prefix, file):
self.run = dict()
self.file = file
self.prefix = prefix
self.materials = list ()
self.textures = list ()
self.materials = list()
self.textures = list()
self.run[urdf.Cylinder] = self.handleCylinder
self.run[urdf.Box] = self.handleBox
self.run[urdf.Sphere] = self.handleSphere
self.run[urdf.Mesh] = self.handleMesh
self.writeCmd ("import bpy")
self.writeCmd ("""
self.writeCmd("import bpy")
self.writeCmd(
"""
taggedObjects = list()
def tagObjects ():
global taggedObjects
......@@ -103,122 +116,131 @@ def getNonTaggedObjects ():
def setParent (children, parent):
for child in children:
child.parent = parent
""")
"""
)
def setName (self, name):
def setName(self, name):
if isEnv:
self.writeCmd ("bpy.context.object.name = \"" + self.prefix + name + "_0\"")
self.writeCmd('bpy.context.object.name = "' + self.prefix + name + '_0"')
else:
self.writeCmd ("bpy.context.object.name = \"" + self.prefix + name + "_visual0\"")
def setupParent (self, name):
self.writeCmd ("bpy.ops.object.empty_add ()")
self.writeCmd ("empty = bpy.context.object")
self.writeCmd ("empty.name = \"" + self.prefix + name + "\"")
self.writeCmd ("currentObj.parent = empty")
def translate (self, position):
self.writeCmd ("currentObj.location = %s" % \
(position, ))
def rotate (self, rotation):
self.writeCmd ("currentObj.rotation_euler = %s" % \
(rotation, ))
def scale (self, scale):
self.writeCmd ("currentObj.scale = %s" % \
(scale, ))
def handleSphere (self, sphere):
print ("Untested feature: Sphere will be treated as icosphere")
self.writeCmd ("bpy.ops.mesh.primitive_ico_sphere_add (size=%s)" %\
(sphere.radius,))
self.writeCmd ("currentObj = bpy.context.object")
def handleBox (self, geometry):
self.writeCmd ("bpy.ops.mesh.primitive_cube_add ()")
self.writeCmd ("currentObj = bpy.context.object")
self.writeCmd ("currentObj.dimensions = %s" %\
(geometry.size, ))
def handleCylinder (self, geometry):
self.writeCmd ("bpy.ops.mesh.primitive_cylinder_add (radius=%s, depth=%s)" % \
(geometry.radius, geometry.length, ))
self.writeCmd ("currentObj = bpy.context.object")
def handleMesh (self, geometry):
self.writeCmd ("tagObjects()")
self.writeCmd(
'bpy.context.object.name = "' + self.prefix + name + '_visual0"'
)
def setupParent(self, name):
self.writeCmd("bpy.ops.object.empty_add ()")
self.writeCmd("empty = bpy.context.object")
self.writeCmd('empty.name = "' + self.prefix + name + '"')
self.writeCmd("currentObj.parent = empty")
def translate(self, position):
self.writeCmd(f"currentObj.location = {position}")
def rotate(self, rotation):
self.writeCmd(f"currentObj.rotation_euler = {rotation}")
def scale(self, scale):
self.writeCmd(f"currentObj.scale = {scale}")
def handleSphere(self, sphere):
print("Untested feature: Sphere will be treated as icosphere")
self.writeCmd(f"bpy.ops.mesh.primitive_ico_sphere_add (size={sphere.radius})")
self.writeCmd("currentObj = bpy.context.object")
def handleBox(self, geometry):
self.writeCmd("bpy.ops.mesh.primitive_cube_add ()")
self.writeCmd("currentObj = bpy.context.object")
self.writeCmd(f"currentObj.dimensions = {geometry.size}")
def handleCylinder(self, geometry):
self.writeCmd(
"bpy.ops.mesh.primitive_cylinder_add"
f"(radius={geometry.radius}, depth={geometry.length})"
)
self.writeCmd("currentObj = bpy.context.object")
def handleMesh(self, geometry):
self.writeCmd("tagObjects()")
extension = os.path.splitext(geometry.filename)[1]
if extension.lower() == '.dae':
command = "bpy.ops.wm.collada_import (filepath=\"%s\")"
elif extension.lower() == '.stl':
command = "bpy.ops.import_mesh.stl (filepath=\"%s\")"
if extension.lower() == ".dae":
command = 'bpy.ops.wm.collada_import (filepath="%s")'
elif extension.lower() == ".stl":
command = 'bpy.ops.import_mesh.stl (filepath="%s")'
else:
command = "bpy.ops.mesh.primitive_cube_add () # Failed to find loading method for %s"
print ("Extension %s of file %s is not know by the script" %\
(extension, geometry.filename, ))
updateFrameMessage ()
self.writeCmd (command % (resolve_ros_path (geometry.filename),))
self.writeCmd ("imported_objects = getNonTaggedObjects ()")
self.writeCmd ("print(imported_objects)")
self.writeCmd ("bpy.ops.object.empty_add ()")
self.writeCmd ("currentObj = bpy.context.object")
self.writeCmd ("setParent (imported_objects, currentObj)")
def writeCmd (self, command):
command = (
"bpy.ops.mesh.primitive_cube_add () "
"# Failed to find loading method for %s"
)
print(
f"Extension {extension} of file {geometry.filename} "
"is not know by the script"
)
updateFrameMessage()
self.writeCmd(command % (resolve_ros_path(geometry.filename),))
self.writeCmd("imported_objects = getNonTaggedObjects ()")
self.writeCmd("print(imported_objects)")
self.writeCmd("bpy.ops.object.empty_add ()")
self.writeCmd("currentObj = bpy.context.object")
self.writeCmd("setParent (imported_objects, currentObj)")
def writeCmd(self, command):
print(command, file=self.file)
def addMaterial (self, name, rgba):
self.writeCmd ("mat = bpy.data.materials.new(\"%s\")" % (name,))
self.writeCmd ("mat.diffuse_color = %s" % (rgba[0:3],))
self.writeCmd ("mat.alpha = %s" % (rgba[3],))
def addMaterial(self, name, rgba):
self.writeCmd(f'mat = bpy.data.materials.new("{name}")')
self.writeCmd(f"mat.diffuse_color = {rgba[0:3]}")
self.writeCmd(f"mat.alpha = {rgba[3]}")
self.materials.append(name)
def addTexture (self, name, filename):
self.writeCmd ("img = bpy.data.images.load (\"%s\")" % (filename,))
self.writeCmd ("cTex = bpy.data.textures.new(\"%s\", type='IMAGE')" % (name,))
self.writeCmd ("cTex.image = img")
self.writeCmd ("mat = bpy.data.materials.new(\"%s\")" % (name,))
self.writeCmd ("mtex = mat.texture_slots.add()")
self.writeCmd ("mtex.texture = cTex")
self.writeCmd ("mtex.texture_coords = 'ORCO'")
def addTexture(self, name, filename):
self.writeCmd(f'img = bpy.data.images.load ("{filename}")')
self.writeCmd(f"cTex = bpy.data.textures.new(\"{name}\", type='IMAGE')")
self.writeCmd("cTex.image = img")
self.writeCmd(f'mat = bpy.data.materials.new("{name}")')
self.writeCmd("mtex = mat.texture_slots.add()")
self.writeCmd("mtex.texture = cTex")
self.writeCmd("mtex.texture_coords = 'ORCO'")
self.textures.append(name)
self.materials.append(name)
def setMatOrText (self, name):
def setMatOrText(self, name):
if name in self.textures:
# self.writeCmd ("bpy.context.object.data.textures.append(bpy.data.textures[\"%s\"])" %\
# (name,))
pass
# self.writeCmd
# ("bpy.context.object.data.textures.append(bpy.data.textures[\"%s\"])" %\
# (name,))
pass
if name in self.materials:
self.writeCmd ("bpy.context.object.data.materials.append(bpy.data.materials[\"%s\"])" %\
(name,))
self.writeCmd(
"bpy.context.object.data.materials.append"
f'(bpy.data.materials["{name}"])'
)
def __call__ (self, link):
def __call__(self, link):
geometry = link.visual.geometry
if self.run.has_key (type(geometry)):
if type(geometry) in self.run:
self.run[type(geometry)](geometry)
self.setName(link.name)
if link.visual.material is not None:
self.setMatOrText (link.visual.material.name)
self.setupParent (link.name)
self.setMatOrText(link.visual.material.name)
self.setupParent(link.name)
if link.visual.origin is not None:
self.translate (link.visual.origin.position)
self.rotate (link.visual.origin.rotation)
self.translate(link.visual.origin.position)
self.rotate(link.visual.origin.rotation)
# if link.visual.geometry.scale is not None:
# self.scale (link.visual.geometry.scale)
# pass
# self.scale (link.visual.geometry.scale)
# pass
else:
print ("Geometry " + str(type(geometry)) + " not supported")
updateFrameMessage ()
print("Geometry " + str(type(geometry)) + " not supported")
updateFrameMessage()
with open (blendFilename, "w+") as blendscript:
blend = CreateBlenderObject (prefix, blendscript)
with open(blendFilename, "w+") as blendscript:
blend = CreateBlenderObject(prefix, blendscript)
for m in robot.materials:
if m.color is not None:
blend.addMaterial (m.name, m.color.rgba)
blend.addMaterial(m.name, m.color.rgba)
if m.texture is not None:
blend.addTexture (m.name, resolve_ros_path (m.texture.filename))
blend.addTexture(m.name, resolve_ros_path(m.texture.filename))
for link in robot.links:
if link.visual is not None:
blend (link)
blend(link)
Subproject commit 7e56da01a62eb83631ed263fa3057b15b37c0c8c
Subproject commit 29c0eb4e659304f44d55a0389e2749812d858659
# Find PythonQt
#
# Sets PYTHONQT_FOUND, PYTHONQT_INCLUDE_DIR, PYTHONQT_LIBRARY, PYTHONQT_QTALL_LIBRARY, PYTHONQT_LIBRARIES
#
IF(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
FIND_PATH(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h
DOC "Directory where PythonQt was installed.")
ENDIF()
# XXX Since PythonQt 3.0 is not yet cmakeified, depending
# on how PythonQt is built, headers will not always be
# installed in "include/PythonQt". That is why "src"
# is added as an option. See [1] for more details.
# [1] https://github.com/commontk/CTK/pull/538#issuecomment-86106367
FIND_PATH(PYTHONQT_INCLUDE_DIR PythonQt.h
PATHS "${PYTHONQT_INSTALL_DIR}/include/PythonQt"
DOC "Path to the PythonQt include directory")
SET(PYTHONQT_LIBRARIES)
MACRO(_SEARCH_FOR COMPONENT)
STRING(TOUPPER ${COMPONENT} _COMP_UPPERCASE)
FIND_LIBRARY(${_COMP_UPPERCASE}_LIBRARY
NAMES ${COMPONENT}
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "The ${COMPONENT} library.")
IF(NOT ${${_COMP_UPPERCASE}_LIBRARY} STREQUAL "${_COMP_UPPERCASE}_LIBRARY-NOTFOUND")
SET(${COMPONENT}_FOUND TRUE)
SET(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARIES} ${${_COMP_UPPERCASE}_LIBRARY})
ENDIF(NOT ${${_COMP_UPPERCASE}_LIBRARY} STREQUAL "${_COMP_UPPERCASE}_LIBRARY-NOTFOUND")
MARK_AS_ADVANCED(${_COMP_UPPERCASE}_LIBRARY)
ENDMACRO(_SEARCH_FOR COMP)
_SEARCH_FOR(PythonQt)
FOREACH(_COMPONENT_SHORT ${PythonQt_FIND_COMPONENTS})
SET(_COMPONENT "PythonQt_${_COMPONENT_SHORT}")
_SEARCH_FOR(${_COMPONENT})
ENDFOREACH(_COMPONENT_SHORT ${PythonQt_FIND_COMPONENTS})
MARK_AS_ADVANCED(PYTHONQT_INSTALL_DIR)
MARK_AS_ADVANCED(PYTHONQT_INCLUDE_DIR)
MARK_AS_ADVANCED(PYTHONQT_LIBRARIES)
# All upper case _FOUND variable is maintained for backwards compatibility.
SET(PythonQt_FOUND 0)
IF(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIBRARIES)
# Currently CMake'ified PythonQt only supports building against a python Release build.
ADD_DEFINITIONS(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
SET(PythonQt_FOUND 1)
ENDIF()
SET(PYTHONQT_FOUND ${PythonQt_FOUND})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonQt
REQUIRED_VARS PYTHONQT_LIBRARY PYTHONQT_INCLUDE_DIR
HANDLE_COMPONENTS)
# Copyright (c) 2019 CNRS Author: Joseph Mirabel
#
# This file is part of gepetto-viewer-corba. gepetto-viewer-corba is free
# software: you can redistribute it and/or modify it under the terms of the GNU
# Lesser General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# gepetto-viewer-corba is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Lesser Public License
# for more details. You should have received a copy of the GNU Lesser General
# Public License along with gepetto-viewer-corba. If not, see
# <http://www.gnu.org/licenses/>.
# {{{ Find Qt tags
set(_use_qt_local_doc FALSE)
set(qt_online_doc "http://doc.qt.io")
if(PROJECT_USE_QT4)
find_file(
QT4_TAGFILE doc/html/qt.tags
HINTS / /usr
PATH_SUFFIXES share/qt4)
# Eventually, QT4_TAGFILE can be set manually to
# /usr/share/qt4/doc/html/qt.tags on ubuntu 16.04, from package qt4-doc-html
if(QT4_TAGFILE)
if(_use_qt_local_doc)
get_filename_component(path_to_doc ${QT4_TAGFILE} DIRECTORY)
set(QT_TAGFILES
"\"${QT4_TAGFILE}=${path_to_doc}\""
PARENT_SCOPE)
else(_use_qt_local_doc)
set(QT_TAGFILES
"\"${QT4_TAGFILE}=${qt_doc}/archives/qt-4.8\""
PARENT_SCOPE)
endif(_use_qt_local_doc)
endif()
else(PROJECT_USE_QT4)
set(_QT_TAGFILES)
# Available components qtcore qtgui qtwidgets qtnetwork qtsql qtprintsupport
# qttestlib qtconcurrent qdoc qtxml
foreach(component "core" "widgets" "gui" "network")
string(TOUPPER ${component} _up_comp)
find_file(
QT5_${_up_comp}_TAGFILE doc/qt${component}/qt${component}.tags
HINTS / /usr
PATH_SUFFIXES share/qt5)
# Eventually, QT5_${_up_comp}_TAGFILE can be set manually to
# /usr/share/qt5/doc/qt${component}/qt${component}.tags on ubuntu 16.04,
# from package qtbase5-doc-html
if(QT5_${_up_comp}_TAGFILE)
if(_use_qt_local_doc)
get_filename_component(path_to_doc ${QT5_${_up_comp}_TAGFILE} DIRECTORY)
set(_QT_TAGFILES
"${_QT_TAGFILES} \"${QT5_${_up_comp}_TAGFILE}=${path_to_doc}\"")
else(_use_qt_local_doc)
set(_QT_TAGFILES
"${_QT_TAGFILES} \"${QT5_${_up_comp}_TAGFILE}=${qt_doc}/qt-5\"")
endif(_use_qt_local_doc)
endif()
endforeach()
set(QT_TAGFILES
${_QT_TAGFILES}
PARENT_SCOPE)
endif(PROJECT_USE_QT4)
# }}}
# vim: foldmethod=marker foldlevel=0
......@@ -3,9 +3,7 @@ FILE_PATTERNS = *.idl *.hh *.py *.idl
INPUT = @CMAKE_SOURCE_DIR@/include \
@CMAKE_SOURCE_DIR@/idl \
@CMAKE_SOURCE_DIR@/plugins \
@CMAKE_SOURCE_DIR@/pyplugins \
@CMAKE_SOURCE_DIR@/src/gepetto\
@CMAKE_SOURCE_DIR@/doc
GENERATE_TREEVIEW = NO
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/examples
#
# Copyright (c) 2014 CNRS-LAAS
# Author: Florent Lamiraux
#
HPP_REPO=https://github.com/humanoid-path-planner
DISABLE_TESTS=OFF
SRC_DIR="NOT_SET"
INSTALL_DIR="NOT_SET"
ifeq (${INSTALL_DIR}, "NOT_SET")
$(error INSTALL_DIR not set. Please open the Makefile and set it)
endif
ifeq (${SRC_DIR},"NOT_SET")
$(error SRC_DIR not set. Please open the Makefile and set it)
endif
BUILD_TYPE=Release
ifeq (${BUILD_TYPE},Debug)
BUILD_FOLDER=build
else
BUILD_FOLDER=build-rel
DISABLE_TESTS=ON
endif
#OSG_PACKAGE=OpenSceneGraph-dae-plugin
OSG_PACKAGE=OpenSceneGraph-3.4.0
WGET=wget --quiet
UNZIP=unzip -qq
TAR=tar
GIT_QUIET=--quiet
# Qt version should be either 4 or 5
QT_VERSION=5
INSTALL_DOCUMENTATION=ON
collada-dom_branch=master
collada-dom_repository=${HPP_REPO}
collada-dom_extra_flags=-DBUILD_SHARED_LIBS=TRUE -DOPT_COLLADA15=FALSE
OpenSceneGraph-dae-plugin_branch=master
OpenSceneGraph-dae-plugin_repository=${HPP_REPO}
OpenSceneGraph-dae-plugin_extra_flags= -DCOLLADA_DYNAMIC_LIBRARY=${INSTALL_DIR}/lib/libcollada14dom.so -DCOLLADA_INCLUDE_DIR=${INSTALL_DIR}/include/collada-dom
OpenSceneGraph-3.4.0_extra_flags= -DDESIRED_QT_VERSION=${QT_VERSION} -DCOLLADA_DYNAMIC_LIBRARY=${INSTALL_DIR}/lib/libcollada14dom.so -DCOLLADA_INCLUDE_DIR=${INSTALL_DIR}/include/collada-dom -DLIB_POSTFIX=""
gepetto-viewer_branch=devel
gepetto-viewer_repository=${HPP_REPO}
gepetto-viewer-corba_branch=devel
gepetto-viewer-corba_repository=${HPP_REPO}
ifeq (${QT_VERSION}, 5)
gepetto-viewer-corba_extra_flags= -DPROJECT_USE_QT4=OFF
endif
pythonqt_branch=qt${QT_VERSION}
pythonqt_repository=${HPP_REPO}
pythonqt_extra_flags= -DPythonQt_Wrap_QtAll=ON -DPythonQt_Extensions=ON
qgv_branch=devel
qgv_repository=${HPP_REPO}
all: gepetto-viewer-corba.install
qgv.configure.dep: qgv.checkout
pythonqt.configure.dep: pythonqt.checkout
collada-dom.configure.dep: collada-dom.checkout
OpenSceneGraph-dae-plugin.configure.dep: collada-dom.install \
OpenSceneGraph-dae-plugin.checkout
OpenSceneGraph-3.4.0.configure.dep: collada-dom.install \
OpenSceneGraph-3.4.0.checkout
gepetto-viewer.configure.dep: ${OSG_PACKAGE}.install \
gepetto-viewer.checkout
gepetto-viewer-corba.configure.dep: gepetto-viewer.install \
gepetto-viewer-corba.checkout
pythonqt.configure.dep: pythonqt.checkout
status:
@for child_dir in $$(ls ${SRC_DIR}); do \
test -d "$$child_dir" || continue; \
test -d "$$child_dir/.git" || continue; \
${MAKE} "$$child_dir".status; \
done
log:
@for child_dir in $$(ls ${SRC_DIR}); do \
test -d "$$child_dir" || continue; \
test -d "$$child_dir/.git" || continue; \
${MAKE} "$$child_dir".log; \
done
update:
@for child_dir in $$(ls ${SRC_DIR}); do \
test -d "$$child_dir" || continue; \
test -d "$$child_dir/.git" || continue; \
${MAKE} "$$child_dir".update; \
done
%.checkout:
if [ -d $(@:.checkout=) ]; then \
echo "$(@:.checkout=) already checkout out."; \
else \
git clone ${GIT_QUIET} --recursive -b ${$(@:.checkout=)_branch} ${$(@:.checkout=)_repository}/$(@:.checkout=); \
fi \
%.update:
if [ "${$(@:.update=)_repository}" = "" ]; then \
echo "$(@:.update=) is not referenced"; \
else \
cd ${SRC_DIR}/$(@:.update=);\
git remote rm origin;\
git remote add origin ${$(@:.update=)_repository}/$(@:.update=);\
git fetch origin;\
git checkout -b bce46g origin/${$(@:.update=)_branch};\
git branch -D ${$(@:.update=)_branch};\
git checkout -b ${$(@:.update=)_branch} bce46g;\
git branch -D bce46g;\
git submodule update; \
fi
%.configure: %.configure.dep
${MAKE} $(@:.configure=).configure_nodep
%.configure_nodep:%.checkout
mkdir -p ${SRC_DIR}/$(@:.configure_nodep=)/${BUILD_FOLDER}; \
cd ${SRC_DIR}/$(@:.configure_nodep=)/${BUILD_FOLDER}; \
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DINSTALL_DOCUMENTATION=${INSTALL_DOCUMENTATION} \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -O3 -DNDEBUG" \
-DDISABLE_TESTS=${DISABLE_TESTS} \
${$(@:.configure_nodep=)_extra_flags} ..
%.install:%.configure
${MAKE} -C ${SRC_DIR}/$(@:.install=)/${BUILD_FOLDER} install
%.install_nodep:%.configure_nodep
${MAKE} -C ${SRC_DIR}/$(@:.install_nodep=)/${BUILD_FOLDER} install
%.uninstall:
${MAKE} -C ${SRC_DIR}/$(@:.uninstall=)/${BUILD_FOLDER} uninstall
%.clean:
${MAKE} -C ${SRC_DIR}/$(@:.clean=)/${BUILD_FOLDER} clean
%.very-clean:
rm -rf ${SRC_DIR}/$(@:.very-clean=)/${BUILD_FOLDER}/*
%.status:
@cd ${SRC_DIR}/$(@:.status=); \
echo \
"\033[1;36m------- Folder $(@:.status=) ---------------\033[0m"; \
git --no-pager -c status.showUntrackedFiles=no status --short --branch;\
%.log:
@cd ${SRC_DIR}/$(@:.log=); \
if [ -f .git/refs/heads/${$(@:.log=)_branch} ]; then \
echo -n "$(@:.log=): "; \
cat .git/refs/heads/${$(@:.log=)_branch}; \
fi
OpenSceneGraph-3.4.0.checkout:
if [ -d $(@:.checkout=) ]; then \
echo "$(@:.checkout=) already checkout out."; \
else \
wget http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.4.0/source/OpenSceneGraph-3.4.0.zip;\
cd ${SRC_DIR}; unzip OpenSceneGraph-3.4.0.zip;\
rm -f OpenSceneGraph-3.4.0.zip;\
fi