Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScenarI/O: SCENe interfAces for Robot Input / Output - New Ignition Gazebo ECM APIs #158

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ option(GYMIGNITION_USE_IGNITION
add_subdirectory(cpp/gympp/base)
add_subdirectory(cpp/gympp/gazebo)
add_subdirectory(cpp/gympp/plugins)
add_subdirectory(cpp/scenario/gazebo)

# Add the targets depending on Ignition Robotics
if(${GYMIGNITION_USE_IGNITION})
Expand Down
1 change: 1 addition & 0 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target_link_libraries(${swig_name} PUBLIC
GazeboEnvironment
RobotSingleton
GazeboWrapper
ScenarioGazebo
${PYTHON_LIBRARIES})

set_property(TARGET ${swig_name} PROPERTY
Expand Down
14 changes: 14 additions & 0 deletions bindings/gympp_bindings.i
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "gympp/gazebo/GymFactory.h"
#include "gympp/gazebo/Metadata.h"
#include "gympp/gazebo/RobotSingleton.h"
#include "scenario/gazebo/Joint.h"
#include "scenario/gazebo/Link.h"
#include "scenario/gazebo/Model.h"
#include "scenario/gazebo/World.h"
#include <cstdint>
%}

Expand Down Expand Up @@ -105,3 +109,13 @@
%include "gympp/gazebo/Metadata.h"
%include "gympp/gazebo/GymFactory.h"
%include "gympp/gazebo/RobotSingleton.h"

%shared_ptr(scenario::gazebo::Joint)
%shared_ptr(scenario::gazebo::Link)
%shared_ptr(scenario::gazebo::Model)
%shared_ptr(scenario::gazebo::World)

%include "scenario/gazebo/Joint.h"
%include "scenario/gazebo/Link.h"
%include "scenario/gazebo/Model.h"
%include "scenario/gazebo/World.h"
6 changes: 3 additions & 3 deletions cpp/gympp/gazebo/IgnitionRobot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include "gympp/gazebo/IgnitionRobot.h"
#include "gympp/base/Log.h"
#include "gympp/gazebo/RobotSingleton.h"
#include "gympp/gazebo/components/JointPositionReset.h"
#include "gympp/gazebo/components/JointVelocityReset.h"
#include "gympp/gazebo/components/WorldVelocityCmd.h"
#include "scenario/gazebo/components/JointPositionReset.h"
#include "scenario/gazebo/components/JointVelocityReset.h"
#include "scenario/gazebo/components/WorldVelocityCmd.h"

#include <eigen3/Eigen/Dense>
#include <ignition/gazebo/Model.hh>
Expand Down
116 changes: 116 additions & 0 deletions cpp/scenario/gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT)
# All rights reserved.
#
# This project is dual licensed under LGPL v2.1+ or Apache License.
#
# - - - - - - - - - - - - - - - - - -
#
# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.
#
# - - - - - - - - - - - - - - - - - -
#
# 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.

# ================
# Extra Components
# ================

set(EXTRA_COMPONENTS_HDRS
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointPID.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/SimulatedTime.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/BasePoseTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/BaseWorldVelocityTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/BaseWorldAccelerationTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/MaxJointForce.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointControlMode.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/WorldVelocityCmd.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointPositionReset.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointVelocityReset.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointPositionTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointVelocityTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointAccelerationTarget.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/HistoryOfAppliedJointForces.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/ExternalWorldWrenchCmdWithDuration.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/Timestamp.h
${CMAKE_CURRENT_SOURCE_DIR}/include/scenario/gazebo/components/JointControllerPeriod.h)
diegoferigo marked this conversation as resolved.
Show resolved Hide resolved

add_library(ExtraComponents INTERFACE)
target_sources(ExtraComponents INTERFACE ${EXTRA_COMPONENTS_HDRS})

target_include_directories(ExtraComponents INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_link_libraries(ExtraComponents INTERFACE ignition-gazebo3::core)

set_target_properties(ExtraComponents PROPERTIES
PUBLIC_HEADER "${EXTRA_COMPONENTS_HDRS}")

# ==============
# ScenarioGazebo
# ==============

set(SCENARIO_PUBLIC_HDRS
include/scenario/gazebo/World.h
include/scenario/gazebo/Model.h
include/scenario/gazebo/Joint.h
include/scenario/gazebo/Link.h
include/scenario/gazebo/Log.h
include/scenario/gazebo/utils.h
include/scenario/gazebo/exceptions.h)

add_library(ScenarioGazebo
${SCENARIO_PUBLIC_HDRS}
include/scenario/gazebo/helpers.h
src/World.cpp
src/Model.cpp
src/Joint.cpp
src/Link.cpp
src/utils.cpp
src/helpers.cpp)

target_include_directories(ScenarioGazebo PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_link_libraries(ScenarioGazebo
PRIVATE
ExtraComponents
ignition-gazebo3::core)

set_target_properties(ScenarioGazebo PROPERTIES
PUBLIC_HEADER "${SCENARIO_PUBLIC_HDRS}")

# ===================
# Install the targets
# ===================

if(NOT CMAKE_BUILD_TYPE STREQUAL "PyPI")
install(
TARGETS
ExtraComponents
EXPORT scenario
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/scenario/gazebo/components)
install(
TARGETS
ScenarioGazebo
EXPORT scenario
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/scenario/gazebo)
endif()
Loading