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

Packaging, Python 2/3 support (Noetic), CI, rename package to whole_body_state_msgs #3

Merged
merged 8 commits into from
Aug 20, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This config file for Travis CI utilizes ros-industrial/industrial_ci package.
# For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst
language: generic
dist: bionic
services:
- docker

# include the following block if the C/C++ build artifacts should get cached by Travis,
# CCACHE_DIR needs to get set as well to actually fill the cache
cache:
directories:
- $HOME/.ccache

git:
quiet: true # optional, silences the cloning of the target repository

# configure the build environment(s)
# https://github.com/ros-industrial/industrial_ci/blob/master/doc/index.rst#variables-you-can-configure
env:
global: # global settings for all jobs
- CCACHE_DIR=$HOME/.ccache # enables C/C++ caching in industrial_ci
- ROS_REPO=ros-testing # ros
matrix:
- ROS_DISTRO="kinetic"
- ROS_DISTRO="kinetic" PRERELEASE=true
- ROS_DISTRO="melodic"
- ROS_DISTRO="melodic" PRERELEASE=true
- ROS_DISTRO="noetic"
- ROS_DISTRO="noetic" PRERELEASE=true
matrix:
allow_failures:
- env: ROS_DISTRO="kinetic" PRERELEASE=true
- env: ROS_DISTRO="melodic" PRERELEASE=true
- env: ROS_DISTRO="noetic" PRERELEASE=true
install:
- git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci.git .ci_config -b master
script:
- source .ci_config/travis.sh
48 changes: 18 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,56 +1,44 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
PROJECT(state_msgs)
PROJECT(whole_body_state_msgs)

# Set up project properties
SET(PROJECT_NAME state_msgs)
SET(PROJECT_DESCRIPTION "State ROS messages")
SET(PROJECT_NAME whole_body_state_msgs)
SET(PROJECT_DESCRIPTION "Whole-body State ROS messages")

# Print initial message
# Print initial message - using STATUS so it doesn't trigger as a warning
MESSAGE(STATUS "${PROJECT_DESCRIPTION}, version ${PROJECT_VERSION}")
MESSAGE("Copyright (C) 2020 University of Edinburgh")
MESSAGE("All rights reserved.")
MESSAGE("Released under the BSD 3-Clause License.")

# Set a default build type to 'Release' if none was specified
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
MESSAGE(STATUS "Setting build type to 'Release' as none was specified.")
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()
MESSAGE(STATUS "Copyright (C) 2020 University of Edinburgh, University of Oxford")
MESSAGE(STATUS "All rights reserved.")
wxmerkt marked this conversation as resolved.
Show resolved Hide resolved
MESSAGE(STATUS "Released under the BSD 3-Clause License.")

# Find required packages
FIND_PACKAGE(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
geometry_msgs
message_generation)
message_generation
)

catkin_python_setup()

# Define messages to be generated
add_message_files(
DIRECTORY msg
FILES
DIRECTORY msg
FILES
JointCommand.msg
CentroidalState.msg
JointState.msg
ContactState.msg
WholeBodyState.msg
WholeBodyTrajectory.msg
WholeBodyController.msg)
WholeBodyController.msg
)

generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs)

DEPENDENCIES
std_msgs
geometry_msgs
)

# Define catkin dependencies
catkin_package(CATKIN_DEPENDS roscpp message_runtime std_msgs geometry_msgs)


# Installation src
INSTALL(DIRECTORY src
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
catkin_package(CATKIN_DEPENDS message_runtime std_msgs geometry_msgs)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ With these basic states, the package describes whole-body states and trajectorie

## :penguin: Building

The state_msgs is a catkin project which can be built as:
The whole_body_state_msgs is a catkin project which can be built as:

cd your_ros_ws/
catkin build #catkin_make
Expand Down
8 changes: 4 additions & 4 deletions msg/WholeBodyController.msg
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
Header header

# Desired whole-body state
state_msgs/WholeBodyState desired
whole_body_state_msgs/WholeBodyState desired

# Actual whole-body state
state_msgs/WholeBodyState actual
whole_body_state_msgs/WholeBodyState actual

# Error whole-body state
state_msgs/WholeBodyState error
whole_body_state_msgs/WholeBodyState error

# Command state
state_msgs/JointCommand[] command
whole_body_state_msgs/JointCommand[] command
6 changes: 3 additions & 3 deletions msg/WholeBodyState.msg
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Header header
float64 time

# This represents the base state (CoM motion, angular motion and centroidal momenta)
state_msgs/CentroidalState centroidal
whole_body_state_msgs/CentroidalState centroidal

# This represents the joint state (position, velocity, acceleration and effort)
state_msgs/JointState[] joints
whole_body_state_msgs/JointState[] joints

# This represents the end-effector state (cartesian position and contact forces)
state_msgs/ContactState[] contacts
whole_body_state_msgs/ContactState[] contacts
4 changes: 2 additions & 2 deletions msg/WholeBodyTrajectory.msg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Header header

# The actual whole-body state
state_msgs/WholeBodyState actual
whole_body_state_msgs/WholeBodyState actual

# The whole-body trajectory
state_msgs/WholeBodyState[] trajectory
whole_body_state_msgs/WholeBodyState[] trajectory
19 changes: 9 additions & 10 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?xml version="1.0"?>
<package format="2">
<name>state_msgs</name>
<package format="3">
<name>whole_body_state_msgs</name>
<version>0.0.1</version>
<description>
Message and service data structures for robot states
</description>

<author email="carlos.mastalli@ed.ac.uk">Carlos Mastalli</author>
<maintainer email="carlos.mastalli@ad.ec.uk">Carlos Mastalli</maintainer>
<author email="carlos.mastalli@ed.ac.uk">Carlos Mastalli</author>
<author email="wolfgang@robots.ox.ac.uk">Wolfgang Merkt</author>
<license>BSD 3-Clause</license>

<buildtool_depend>catkin</buildtool_depend>

<build_depend>roscpp</build_depend>

<build_depend>rospy</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>

<exec_depend>roscpp</exec_depend>

<exec_depend>rospy</exec_depend>
<exec_depend>message_runtime</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>python-numpy</exec_depend>
<exec_depend>python-pinocchio</exec_depend>

<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-numpy</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-numpy</exec_depend>
<exec_depend>pinocchio</exec_depend>
</package>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from catkin_pkg.python_setup import generate_distutils_setup

# fetch values from package.xml
setup_args = generate_distutils_setup(packages=['state_msgs'], package_dir={'': 'src'})
setup_args = generate_distutils_setup(packages=['whole_body_state_msgs'], package_dir={'': 'src'})

setup(**setup_args)
Empty file removed src/state_msgs/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions src/whole_body_state_msgs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import whole_body_controller_publisher
import whole_body_interface
import whole_body_state_publisher
import whole_body_trajectory_publisher
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from __future__ import print_function, absolute_import

import rospy
from state_msgs.msg import WholeBodyController
from state_msgs import whole_body_interface as wb_iface
from whole_body_state_msgs.msg import WholeBodyController
from .whole_body_interface import WholeBodyStateInterface
import copy

__all__ = ['WholeBodyControllerPublisher']


class WholeBodyControllerPublisher():
def __init__(self, topic, model):
# Initializing the publisher
self.pub = rospy.Publisher(topic, WholeBodyController, queue_size=1)
self.wb_iface = wb_iface.WholeBodyStateInterface(model)
self.wb_iface = WholeBodyStateInterface(model)

def publish(self,
t,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from __future__ import print_function, absolute_import

import rospy
from state_msgs.msg import WholeBodyState, ContactState, JointState
from whole_body_state_msgs.msg import WholeBodyState, ContactState, JointState
import pinocchio
import numpy as np

__all__ = ['WholeBodyStateInterface']

class WholeBodyStateInterface():
def __init__(self, model):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from __future__ import print_function, absolute_import

import rospy
from state_msgs.msg import WholeBodyState
from state_msgs import whole_body_interface as wb_iface
from whole_body_state_msgs.msg import WholeBodyState
from .whole_body_interface import WholeBodyStateInterface

__all__ = ['WholeBodyStatePublisher']

class WholeBodyStatePublisher():
def __init__(self, topic, model):
# Initializing the publisher
self.pub = rospy.Publisher(topic, WholeBodyState, queue_size=1)
self.wb_iface = wb_iface.WholeBodyStateInterface(model)
self.wb_iface = WholeBodyStateInterface(model)

def publish(self, t, q, v, tau, p=dict(), pd=dict(), f=dict(), s=dict()):
msg = self.wb_iface.writeToMessage(t, q, v, tau, p, pd, f, s)
self.pub.publish(msg)
self.pub.publish(msg)
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from __future__ import print_function, absolute_import

import rospy
from state_msgs.msg import WholeBodyTrajectory
from state_msgs import whole_body_interface as wb_iface
from whole_body_state_msgs.msg import WholeBodyTrajectory
from .whole_body_interface import WholeBodyStateInterface
import copy

__all__ = ['WholeBodyTrajectoryPublisher']

class WholeBodyTrajectoryPublisher():
def __init__(self, topic, model):
# Defining the subscriber
self.pub = rospy.Publisher(topic, WholeBodyTrajectory, queue_size=1)
self.wb_iface = wb_iface.WholeBodyStateInterface(model)
self.wb_iface = WholeBodyStateInterface(model)

def publish(self, ts, qs, vs=None, us=None, ps=None, pds=None, fs=None, ss=None):
msg = WholeBodyTrajectory()
Expand Down