Skip to content
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
4 changes: 2 additions & 2 deletions .github/scripts/install_dls2_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if [ -z "$TOKEN" ]; then
fi
export GH_TOKEN="$TOKEN"

# Resolve the dls2_msgs submodule commit SHA pinned in this repo
SHA="$(git -C "$(dirname "${BASH_SOURCE[0]}")/../.." ls-tree HEAD dls2_msgs | awk '{print $3}')"
# Resolve the dls2_msgs submodule commit SHA pinned in transport_interfaces
SHA="$(git -C "$(dirname "${BASH_SOURCE[0]}")/../../transport_interfaces" ls-tree HEAD transports/fastdds/dls2_msgs | awk '{print $3}')"
echo "dls2_msgs submodule is pinned to commit: $SHA"

# Find the release tag that points to that commit
Expand Down
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
url = https://github.com/iit-DLSLab/dls2_msgs.git
[submodule "pinocchio-gluecode"]
path = pinocchio-gluecode
url = https://github.com/iit-DLSLab/pinocchio-gluecode.git
url = https://github.com/iit-DLSLab/pinocchio-gluecode.git
[submodule "transport_interfaces"]
path = transport_interfaces
url = git@github.com:iit-DLSLab/transport_interfaces.git
[submodule "dls_hal"]
path = dls_hal
url = git@github.com:iit-DLSLab/dls_hal.git
38 changes: 10 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,22 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

set(DLS_MESSAGE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/dls2_msgs
CACHE PATH "Path to the dls2_msgs folder"
)
add_subdirectory(dls2)
option(BUILD_DLS2_MSGS "Build the dls2_msgs submodule. Disable when dls2_msgs is pre-installed (e.g. in CI)." ON)
if(BUILD_DLS2_MSGS)
add_subdirectory(dls2_msgs)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/dls_message_paths.cmake")

if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "/opt/dls2/lib;/opt/dls2/hardwares/lib" CACHE STRING "RPATH for installed binaries" FORCE)
endif()

add_subdirectory(transport_interfaces)
add_subdirectory(dls_hal)
add_subdirectory(dls2)
add_subdirectory(robotlib)
add_subdirectory(pinocchio-gluecode)
add_subdirectory(visualizers/rviz_interface)

# generate ROS2 messages from IDL files each time CMake is run, to ensure they are always up to date with the IDL definitions
message(STATUS "Generating ROS2 messages from IDL files...")
set (DLS2_ROS2_INTERFACE_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dls2_ros2_interface/ros2_ws/src)
set (DLS2_ROS2_INTERFACE_DIR ${DLS2_ROS2_INTERFACE_SRC_DIR}/dls2_interface)


# remove .msg files from the ROS2 interface src directory to avoid conflicts with the newly generated ones
file(GLOB DLS_MSG_FILES CONFIGURE_DEPENDS "${DLS2_ROS2_INTERFACE_DIR}/msg/*.msg")
foreach(msg_file IN LISTS DLS_MSG_FILES)
file(REMOVE ${msg_file})
endforeach()

file(GLOB DLS_IDL_FILES CONFIGURE_DEPENDS "${DLS_MESSAGE_FOLDER}/idls/*.idl")
foreach(idl_file IN LISTS DLS_IDL_FILES)
execute_process(
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${DLS2_ROS2_INTERFACE_DIR}/scripts ${DLS2_ROS2_INTERFACE_DIR}/scripts/idl_to_msg.py ${idl_file} -o ${DLS2_ROS2_INTERFACE_SRC_DIR}/
WORKING_DIRECTORY ${DLS2_ROS2_INTERFACE_DIR}
RESULT_VARIABLE result
)
endforeach()
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate_ros2_messages.cmake")

# install setup_ros2_for_dls2.bash
install(FILES dls2_ros2_interface/ros2_ws/src/dls2_interface/scripts/setup_ros2_for_dls2.bash
DESTINATION /usr/bin/dls2/scripts/
)
)
10 changes: 10 additions & 0 deletions cmake/dls_message_paths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configure the IDL source directory before adding dependent subdirectories.
set(DLS_MESSAGE_DEFAULT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/transport_interfaces/transports/fastdds/dls2_msgs")
set(DLS_MESSAGE_FOLDER "${DLS_MESSAGE_DEFAULT_FOLDER}"
CACHE PATH "Path to the dls2_msgs folder"
)
# Older build caches can still point to the former dls2_msgs location.
if(NOT IS_DIRECTORY "${DLS_MESSAGE_FOLDER}/idls")
message(WARNING "DLS_MESSAGE_FOLDER '${DLS_MESSAGE_FOLDER}' has no idls directory; using '${DLS_MESSAGE_DEFAULT_FOLDER}'.")
set(DLS_MESSAGE_FOLDER "${DLS_MESSAGE_DEFAULT_FOLDER}" CACHE PATH "Path to the dls2_msgs folder" FORCE)
endif()
46 changes: 46 additions & 0 deletions cmake/generate_ros2_messages.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Regenerate ROS2 messages from IDL definitions on every CMake configure.
message(STATUS "Generating ROS2 messages from IDL files...")
set(DLS2_ROS2_INTERFACE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dls2_ros2_interface/ros2_ws/src")
set(DLS2_ROS2_INTERFACE_DIR "${DLS2_ROS2_INTERFACE_SRC_DIR}/dls2_interface")
find_package(Python3 REQUIRED COMPONENTS Interpreter)
file(GLOB DLS_IDL_FILES CONFIGURE_DEPENDS "${DLS_MESSAGE_FOLDER}/idls/*.idl")
if(NOT DLS_IDL_FILES)
message(FATAL_ERROR "No IDL files found in '${DLS_MESSAGE_FOLDER}/idls'. Existing ROS2 messages were preserved.")
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${DLS_IDL_FILES} "${DLS2_ROS2_INTERFACE_DIR}/scripts/idl_to_msg.py")

# Generate in the build tree first so a conversion failure preserves existing messages.
set(DLS_ROS2_MSG_STAGE "${CMAKE_CURRENT_BINARY_DIR}/generated_ros2_messages")
file(REMOVE_RECURSE "${DLS_ROS2_MSG_STAGE}")
file(MAKE_DIRECTORY "${DLS_ROS2_MSG_STAGE}")
foreach(idl_file IN LISTS DLS_IDL_FILES)
execute_process(
COMMAND "${Python3_EXECUTABLE}" "${DLS2_ROS2_INTERFACE_DIR}/scripts/idl_to_msg.py"
"${idl_file}" --strict -o "${DLS_ROS2_MSG_STAGE}"
WORKING_DIRECTORY "${DLS2_ROS2_INTERFACE_DIR}"
RESULT_VARIABLE DLS_IDL_RESULT
OUTPUT_VARIABLE DLS_IDL_OUTPUT
ERROR_VARIABLE DLS_IDL_ERROR
)
if(NOT "${DLS_IDL_RESULT}" STREQUAL "0")
message(FATAL_ERROR "ROS2 message generation failed for '${idl_file}':\n${DLS_IDL_OUTPUT}\n${DLS_IDL_ERROR}\nExisting ROS2 messages were preserved.")
endif()
endforeach()

file(GLOB DLS_GENERATED_MSG_FILES "${DLS_ROS2_MSG_STAGE}/dls2_interface/msg/*.msg")
if(NOT DLS_GENERATED_MSG_FILES)
message(FATAL_ERROR "No dls2_interface messages were generated. Existing ROS2 messages were preserved.")
endif()
file(COPY ${DLS_GENERATED_MSG_FILES} DESTINATION "${DLS2_ROS2_INTERFACE_DIR}/msg")

# Remove obsolete messages only after all conversions and the copy have succeeded.
file(GLOB DLS_MSG_FILES "${DLS2_ROS2_INTERFACE_DIR}/msg/*.msg")
foreach(msg_file IN LISTS DLS_MSG_FILES)
get_filename_component(msg_name "${msg_file}" NAME)
if(NOT EXISTS "${DLS_ROS2_MSG_STAGE}/dls2_interface/msg/${msg_name}")
file(REMOVE "${msg_file}")
endif()
endforeach()
list(LENGTH DLS_GENERATED_MSG_FILES DLS_GENERATED_MSG_COUNT)
message(STATUS "Generated ${DLS_GENERATED_MSG_COUNT} ROS2 messages in ${DLS2_ROS2_INTERFACE_DIR}/msg")
2 changes: 1 addition & 1 deletion dls2
Submodule dls2 updated 89 files
+1 −1 README.md
+2 −0 cmake/dls_configure.cmake
+2 −0 cmake/dls_debian_settings.cmake
+7 −0 cmake/dls_post_install.cmake
+6 −0 doc/DeveloperHints.md
+51 −0 doc/StartupConfiguration.md
+2 −1 doc/index.md
+0 −4 modules/CMakeLists.txt
+1 −0 modules/application/CMakeLists.txt
+4 −6 modules/application/include/dls2/application/app.hpp
+6 −0 modules/application/include/dls2/application/layer.hpp
+21 −5 modules/application/include/dls2/application/layer.tpp
+1 −15 modules/application/include/dls2/application/periodic_app.hpp
+2 −0 modules/application/include/dls2/application/sched_attr.hpp
+68 −0 modules/application/include/dls2/application/sched_utils.hpp
+3 −20 modules/application/src/app.cpp
+23 −46 modules/application/src/periodic_app.cpp
+166 −0 modules/application/src/sched_utils.cpp
+27 −0 modules/child_process/CMakeLists.txt
+13 −30 modules/child_process/src/child_process_launcher.cpp.in
+8 −3 modules/command/src/command_manager.cpp
+4 −1 modules/core_framework/include/dls2/core_framework/console_layer.hpp
+7 −0 modules/core_framework/include/dls2/core_framework/control_layer.hpp
+2 −1 modules/core_framework/include/dls2/core_framework/hardware_layer.hpp
+17 −11 modules/core_framework/src/console_layer.cpp.in
+161 −85 modules/core_framework/src/control_layer.cpp.in
+35 −3 modules/core_framework/src/hardware_layer.cpp.in
+1 −1 modules/core_framework/src/options.cpp.in
+0 −32 modules/ddscom/CMakeLists.txt
+0 −106 modules/ddscom/include/dls2/util/messaging/dds_listeners.hpp
+0 −224 modules/ddscom/include/dls2/util/messaging/dds_participant.hpp
+0 −34 modules/ddscom/include/dls2/util/messaging/dds_reader.hpp
+0 −37 modules/ddscom/include/dls2/util/messaging/dds_writer.hpp
+0 −35 modules/ddscom/include/dls2/util/messaging/servers.yaml
+0 −107 modules/ddscom/src/dds_listeners.cpp
+0 −631 modules/ddscom/src/dds_participant.cpp
+0 −42 modules/ddscom/src/dds_reader.cpp
+0 −38 modules/ddscom/src/dds_writer.cpp
+0 −38 modules/ddscom/test/CMakeLists.txt
+0 −151 modules/ddscom/test/high_frequency.cpp
+0 −140 modules/ddscom/test/multipub_multisub.cpp
+0 −74 modules/ddscom/test/pub_multisub.cpp
+0 −39 modules/ddscom/test/pubsub.cpp
+0 −10 modules/domains/CMakeLists.txt
+0 −30 modules/domains/include/dls2/domains/domains.hpp
+0 −55 modules/domains/src/domains.cpp
+2 −0 modules/hardware/CMakeLists.txt
+7 −7 modules/hardware/include/dls2/hardware/hardware.hpp
+21 −12 modules/hardware/src/hardware.cpp
+5 −0 modules/log/include/dls2/log/event_config.hpp
+54 −11 modules/main/include/dls2/main/run_dls2.hpp
+11 −0 modules/main/src/default_startup.yaml
+15 −4 modules/main/src/main.cpp.in
+291 −158 modules/main/src/run_dls2.cpp.in
+2 −2 modules/motion_generator/src/motion_generator.cpp
+1 −18 modules/plugin/CMakeLists.txt
+0 −180 modules/plugin/include/dls2/plugin/plugin.hpp
+0 −49 modules/plugin/include/dls2/plugin/plugin.tpp
+1 −1 modules/plugin/skeletons/periodic/plugin/CMakeLists.txt.in
+0 −193 modules/plugin/src/plugin.cpp
+0 −25 modules/signal/CMakeLists.txt
+0 −67 modules/signal/include/dls2/signal/debug/leg_odometry_debug.hpp
+0 −42 modules/signal/include/dls2/signal/debug/trunk_controller_debug.hpp
+0 −64 modules/signal/include/dls2/signal/reader.hpp
+0 −141 modules/signal/include/dls2/signal/reader.tpp
+0 −39 modules/signal/include/dls2/signal/reader_base.hpp
+0 −33 modules/signal/include/dls2/signal/signal_base.hpp
+0 −98 modules/signal/include/dls2/signal/writer.hpp
+0 −126 modules/signal/include/dls2/signal/writer.tpp
+0 −50 modules/signal/include/dls2/signal/writer_base.hpp
+0 −11 modules/signal/src/reader_base.cpp
+0 −34 modules/signal/src/signal_base.cpp
+0 −35 modules/signal/src/writer_base.cpp
+0 −19 modules/signal/test/CMakeLists.txt
+0 −13 modules/signal/test/README.md
+0 −42 modules/signal/test/reader.cpp
+0 −58 modules/signal/test/writer.cpp
+11 −4 modules/state_machine/include/dls2/state_machine/state_machine_watcher.hpp
+42 −63 modules/state_machine/src/state_machine_watcher.cpp
+3 −2 modules/supervisor/src/supervisor.cpp
+0 −14 modules/topics/CMakeLists.txt
+0 −98 modules/topics/include/dls2/topics/topics.hpp
+0 −13 modules/topics/include/dls2/topics/utils.hpp
+0 −89 modules/topics/src/topics.cpp
+118 −0 modules/utils/include/dls2/util/owned_process.hpp
+113 −0 modules/utils/include/dls2/util/shutdown_signal.hpp
+3 −0 scripts/CMakeLists.txt
+3 −1 scripts/launch_framework.in
+3 −0 scripts/postinst
1 change: 0 additions & 1 deletion dls2_msgs
Submodule dls2_msgs deleted from c3fe30
1 change: 1 addition & 0 deletions dls_hal
Submodule dls_hal added at 5d432f
4 changes: 2 additions & 2 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To start interacting with the DLS2 network, you can now launch the console layer

At this point you are now ready to start sending commands to the DLS2 network through the console.

You can also customize the set of nodes you want to launch by creating your yaml file. To do that the yaml file has to contain the following structure
You can also customize the set of nodes you want to launch by creating your yaml file. For example you can use the following structure
```
# layers
layers: []
Expand Down Expand Up @@ -89,7 +89,7 @@ To launch your configuration file, you need to pass its path to the startup comm

dls --startup=<path_to_your_startup.yml>/startup.yml

The supervisor and the DDS servers are automatically launched when using the startup procedure.
The supervisor and the DDS servers are launched by the startup procedure only when `run_supervisor` and `run_servers`, respectively, are explicitly set to `true` in the YAML file. Both options default to `false`; omitting an option or setting it to `false` skips launching that component. Automatic simulation model loading also requires `load_model: true`; omitting it or setting it to `false` skips model loading. For a list of all available entries, see the [startup configuration reference](../dls2/doc/StartupConfiguration.md).

## Mixed routine
To launch the DLS2 network you could also use a mixed approach: load some layers and nodes with the startup routine and others with the manual steps.
1 change: 1 addition & 0 deletions transport_interfaces
Submodule transport_interfaces added at 85fe33
2 changes: 1 addition & 1 deletion visualizers/rviz_interface/src/rviz_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace periodic_app_plugin
// Run robot state publisher in a separate shell command, so rviz can
// visualize the robot while this plugin publishes joint states and tf.
std::string urdf_path = "/usr/include/" + robot_name +
"_description/urdfs/" + robot_name + "_ros.urdf";
"-description/urdfs/" + robot_name + "_ros.urdf";
const std::string bash_command =
". /usr/bin/dls2/scripts/setup_ros2_for_dls2.bash && "
"setsid ros2 run robot_state_publisher robot_state_publisher "
Expand Down
Loading