Skip to content
Draft
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
2 changes: 2 additions & 0 deletions mujoco_ros2_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ find_package(ros2_control_cmake REQUIRED)

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(controller_manager REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fmt REQUIRED)
Expand Down Expand Up @@ -167,6 +168,7 @@ target_link_options(mujoco_ros2_control PUBLIC
)
target_link_libraries(mujoco_ros2_control
PUBLIC
ament_index_cpp::ament_index_cpp
hardware_interface::hardware_interface
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
Expand Down
1 change: 1 addition & 0 deletions mujoco_ros2_control/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<buildtool_depend>git</buildtool_depend>
<build_depend>ros2_control_cmake</build_depend>

<depend>ament_index_cpp</depend>
<depend>backward_ros</depend>
<depend>control_toolbox</depend>
<depend>controller_manager</depend>
Expand Down
10 changes: 10 additions & 0 deletions mujoco_ros2_control/src/mujoco_system_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
#include <std_msgs/msg/string.hpp>
#include <unordered_map>

#include "ament_index_cpp/version.h"
#if AMENT_INDEX_CPP_VERSION_MINOR >= 13
#include <ament_index_cpp/get_package_share_path.hpp>
#else
#include <ament_index_cpp/get_package_share_directory.hpp>
#endif
#if !ROS_DISTRO_HUMBLE
#include <hardware_interface/helpers.hpp>
#endif
Expand Down Expand Up @@ -784,8 +789,13 @@ MujocoSystemInterface::on_init(const hardware_interface::HardwareComponentInterf
/* is_passive = */ false);

// Add ros2 control icon for the taskbar
#if AMENT_INDEX_CPP_VERSION_MINOR >= 13
std::string icon_location =
ament_index_cpp::get_package_share_path("mujoco_ros2_control") / "resources/mujoco_logo.png";
#else
std::string icon_location =
ament_index_cpp::get_package_share_directory("mujoco_ros2_control") + "/resources/mujoco_logo.png";
#endif
std::vector<unsigned char> image;
unsigned width, height;
unsigned error = lodepng::decode(image, width, height, icon_location);
Expand Down
Loading