Skip to content
Open
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
5 changes: 5 additions & 0 deletions mujoco_ros2_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.16)

project(mujoco_ros2_control)

# Detect ROS2 Humble for API compatibility (get_hardware_info() shim)
if("$ENV{ROS_DISTRO}" STREQUAL "humble")
add_definitions(-DROS_DISTRO_HUMBLE)
endif()

find_package(ros2_control_cmake REQUIRED)

# find dependencies
Expand Down
6 changes: 5 additions & 1 deletion mujoco_ros2_control/src/mujoco_system_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,12 @@ MujocoSystemInterface::on_init(const hardware_interface::HardwareComponentInterf
const auto lidar_publish_rate =
std::stod(get_hardware_parameter(get_hardware_info(), "lidar_publish_rate").value_or("5.0"));

// Check for headless mode
// Check for headless mode (URDF hardware param or environment variable)
headless_ = hardware_interface::parse_bool(get_hardware_parameter(get_hardware_info(), "headless").value_or("false"));
if (!headless_ && std::getenv("MUJOCO_HEADLESS"))
{
headless_ = true;
}
RCLCPP_INFO_EXPRESSION(get_logger(), headless_, "Running in HEADLESS mode.");

// We essentially reconstruct the 'simulate.cc::main()' function here, and
Expand Down