Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
This version contains some general improvements and fixes,
including support for the breaking changes introduced
by control libraries 5.0
  • Loading branch information
eeberhard authored Feb 18, 2022
2 parents 16ba0fe + 18c0ef4 commit 396bbff
Show file tree
Hide file tree
Showing 25 changed files with 619 additions and 407 deletions.
5 changes: 0 additions & 5 deletions .dockerignore

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Build and Push
on:
push:
branches:
- master
- main
- develop
release:
types: [published]
Expand All @@ -21,8 +21,7 @@ jobs:

- name: Build image
run: |
docker build . --file ./Dockerfile.development --tag dev-image
docker build . --file ./Dockerfile.production --build-arg BASE_IMAGE=dev-image --tag modulo
docker build --tag modulo .
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
## 1.0.0 (September 22, 2020)
## 1.1.0 (February 18, 2022)

This version contains some general improvements and fixes, including support
for the breaking changes introduced by control libraries 5.0

- Update docker paradigm (#30)
- Refactor the shutdown logic (#31)
- Modify build script for production by default (#32)
- Change the underlying message type to UInt8MultiArray (#33)
- Support int and int array parameters (#34)
- Remove the pure virtual step function (#35)
- Fix the examples due to breaking changes in DS (#36)
- Correct the include due to changes in control-libraries (#38)

## 1.0.0 (September 22, 2021)

Modulo core library to provide ROS2 Cell and Component classes built
around state_representation and clproto libraries.
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG ROS_VERSION=galactic
FROM ghcr.io/aica-technology/ros2-control-libraries:${ROS_VERSION} as development

WORKDIR ${HOME}/ros2_ws
# copy sources and build ROS workspace with user permissions
WORKDIR ${HOME}/ros2_ws/
COPY --chown=${USER} ./source/ ./src/

# clean image
RUN sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*


FROM development as production

# build modulo
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/setup.bash; colcon build"
7 changes: 0 additions & 7 deletions Dockerfile.development

This file was deleted.

6 changes: 0 additions & 6 deletions Dockerfile.production

This file was deleted.

44 changes: 44 additions & 0 deletions build-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
ROS_VERSION=galactic

IMAGE_NAME=epfl-lasa/modulo
IMAGE_TAG=latest

REMOTE_SSH_PORT=4440
SERVE_REMOTE=false

HELP_MESSAGE="Usage: build.sh [-p] [-r]
Options:
-d, --development Only target the development layer to prevent
sources from being built or tested
-r, --rebuild Rebuild the image(s) using the docker
--no-cache option
-v, --verbose Use the verbose option during the building
process
-s, --serve Start the remove development server
"

BUILD_FLAGS=(--build-arg ROS_VERSION="${ROS_VERSION}")
while [[ $# -gt 0 ]]; do
opt="$1"
case $opt in
-d|--development) BUILD_FLAGS+=(--target development) ; IMAGE_TAG=development ; shift ;;
-r|--rebuild) BUILD_FLAGS+=(--no-cache) ; shift ;;
-v|--verbose) BUILD_FLAGS+=(--progress=plain) ; shift ;;
-s|--serve) SERVE_REMOTE=true ; shift ;;
-h|--help) echo "${HELP_MESSAGE}" ; exit 0 ;;
*) echo 'Error in command line parsing' >&2
echo -e "\n${HELP_MESSAGE}"
exit 1
esac
done

docker pull ghcr.io/aica-technology/ros2-control-libraries:"${ROS_VERSION}"
DOCKER_BUILDKIT=1 docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" "${BUILD_FLAGS[@]}" . || exit 1

if [ "${SERVE_REMOTE}" = true ]; then
aica-docker server "${IMAGE_NAME}:${IMAGE_TAG}" -u ros2 -p "${REMOTE_SSH_PORT}"
fi
44 changes: 0 additions & 44 deletions build.sh

This file was deleted.

23 changes: 13 additions & 10 deletions source/modulo_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.9)
project(modulo_core)
project(modulo_core VERSION 1.1.0)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
Expand Down Expand Up @@ -65,22 +65,25 @@ target_link_libraries(${PROJECT_NAME}
robot_model
)

ament_auto_add_executable(${PROJECT_NAME}_test_cartesian tests/testCartesian.cpp)
target_link_libraries(${PROJECT_NAME}_test_cartesian ${PROJECT_NAME})
ament_auto_add_executable(example_cartesian_linear examples/cartesianLinear.cpp)
target_link_libraries(example_cartesian_linear ${PROJECT_NAME})

ament_auto_add_executable(${PROJECT_NAME}_test_cartesian_circular tests/testCartesianCircular.cpp)
target_link_libraries(${PROJECT_NAME}_test_cartesian_circular ${PROJECT_NAME})
ament_auto_add_executable(example_cartesian_circular examples/cartesianCircular.cpp)
target_link_libraries(example_cartesian_circular ${PROJECT_NAME})

ament_auto_add_executable(${PROJECT_NAME}_test_joints tests/testJoints.cpp)
target_link_libraries(${PROJECT_NAME}_test_joints ${PROJECT_NAME})
ament_auto_add_executable(example_helicoidal examples/helicoidal.cpp)
target_link_libraries(example_helicoidal ${PROJECT_NAME})

ament_auto_add_executable(${PROJECT_NAME}_test_moving_reference_frame tests/testMovingReferenceFrame.cpp)
target_link_libraries(${PROJECT_NAME}_test_moving_reference_frame ${PROJECT_NAME})
ament_auto_add_executable(example_joints examples/joints.cpp)
target_link_libraries(example_joints ${PROJECT_NAME})

ament_auto_add_executable(example_moving_reference_frame examples/movingReferenceFrame.cpp)
target_link_libraries(example_moving_reference_frame ${PROJECT_NAME})

ament_auto_package()

# Install launch files.
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)
)
2 changes: 1 addition & 1 deletion source/modulo_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ public:
No need to do anything else. The step function is called periodically at a frequency defined in the node under the `period` argument. And the `current_state` variable will be published over `robot/joint_state` channel on ros2 network automatically.
We recommand to keep this step function short, especially if you use a small period. Otherwise, latency will occur in your control loop. Complete examples of control loop including multiple nodes are written in the [tests](./tests/) for each representation spaces.
We recommend keeping this step function short, especially if you use a small period. Otherwise, latency will occur in your control loop. Complete examples of control loops including multiple nodes are written in the [tests](examples/) for each representation spaces.
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
#include <dynamical_systems/Circular.hpp>
#include <eigen3/Eigen/Core>
#include <exception>
#include <iostream>
#include <rcutils/cmdline_parser.h>

#include <state_representation/space/cartesian/CartesianPose.hpp>
#include <state_representation/space/cartesian/CartesianState.hpp>
#include <state_representation/space/cartesian/CartesianTwist.hpp>
#include <dynamical_systems/DynamicalSystemFactory.hpp>

#include "modulo_core/Cell.hpp"

using namespace state_representation;
using namespace dynamical_systems;

namespace {
class MotionGenerator : public modulo::core::Cell {
private:
std::shared_ptr<state_representation::CartesianPose> current_pose;
std::shared_ptr<state_representation::CartesianTwist> desired_twist;
dynamical_systems::Circular motion_generator;
std::shared_ptr<CartesianPose> current_pose;
std::shared_ptr<CartesianTwist> desired_twist;
std::shared_ptr<IDynamicalSystem<CartesianState>> motion_generator;

public:
explicit MotionGenerator(const std::string& node_name, const std::chrono::milliseconds& period) : Cell(node_name, period),
current_pose(std::make_shared<state_representation::CartesianPose>("robot_test")),
desired_twist(std::make_shared<state_representation::CartesianTwist>("robot_test")),
motion_generator(state_representation::CartesianPose("robot_test", 0., 0., 0.)) {
this->add_parameters(this->motion_generator.get_parameters());
explicit MotionGenerator(const std::string& node_name, const std::chrono::milliseconds& period) :
Cell(node_name, period),
current_pose(std::make_shared<CartesianPose>("robot_test")),
desired_twist(std::make_shared<CartesianTwist>("robot_test")),
motion_generator(
DynamicalSystemFactory<CartesianState>::create_dynamical_system(
DynamicalSystemFactory<CartesianState>::DYNAMICAL_SYSTEM::CIRCULAR
)) {
motion_generator->set_parameter_value("limit_cycle", Ellipsoid("attractor"));
}

bool on_configure() {
Expand All @@ -29,7 +39,7 @@ class MotionGenerator : public modulo::core::Cell {

void step() {
if (!this->current_pose->is_empty()) {
*this->desired_twist = this->motion_generator.evaluate(*this->current_pose);
*this->desired_twist = this->motion_generator->evaluate(*this->current_pose);
} else {
this->desired_twist->initialize();
}
Expand All @@ -38,13 +48,14 @@ class MotionGenerator : public modulo::core::Cell {

class ConsoleVisualizer : public modulo::core::Cell {
private:
std::shared_ptr<state_representation::CartesianPose> robot_pose;
std::shared_ptr<state_representation::CartesianTwist> desired_twist;
std::shared_ptr<CartesianPose> robot_pose;
std::shared_ptr<CartesianTwist> desired_twist;

public:
explicit ConsoleVisualizer(const std::string& node_name, const std::chrono::milliseconds& period) : Cell(node_name, period),
robot_pose(std::make_shared<state_representation::CartesianPose>("robot_test")),
desired_twist(std::make_shared<state_representation::CartesianTwist>("robot_test")) {}
explicit ConsoleVisualizer(const std::string& node_name, const std::chrono::milliseconds& period) :
Cell(node_name, period),
robot_pose(std::make_shared<CartesianPose>("robot_test")),
desired_twist(std::make_shared<CartesianTwist>("robot_test")) {}

bool on_configure() {
this->add_subscription<geometry_msgs::msg::PoseStamped>("/robot_test/pose", this->robot_pose);
Expand All @@ -65,15 +76,18 @@ class ConsoleVisualizer : public modulo::core::Cell {

class SimulatedRobotInterface : public modulo::core::Cell {
private:
std::shared_ptr<state_representation::CartesianPose> robot_pose;
std::shared_ptr<state_representation::CartesianTwist> desired_twist;
std::shared_ptr<CartesianPose> robot_pose;
std::shared_ptr<CartesianTwist> desired_twist;
std::chrono::milliseconds dt;

public:
explicit SimulatedRobotInterface(const std::string& node_name, const std::chrono::milliseconds& period) : Cell(node_name, period),
robot_pose(std::make_shared<state_representation::CartesianPose>("robot_test", Eigen::Vector3d::Random(), Eigen::Quaterniond::UnitRandom())),
desired_twist(std::make_shared<state_representation::CartesianTwist>("robot_test")),
dt(period) {}
explicit SimulatedRobotInterface(const std::string& node_name, const std::chrono::milliseconds& period) :
Cell(node_name, period),
robot_pose(
std::make_shared<CartesianPose>(
"robot_test", Eigen::Vector3d::Random(), Eigen::Quaterniond::UnitRandom())),
desired_twist(std::make_shared<CartesianTwist>("robot_test")),
dt(period) {}

bool on_configure() {
this->add_subscription<geometry_msgs::msg::TwistStamped>("/ds/desired_twist", this->desired_twist);
Expand Down
Loading

0 comments on commit 396bbff

Please sign in to comment.