Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1694f40
Added mujoco topic loading
Ortisa Nov 5, 2025
d9a0882
removed the model loading from parameter
Ortisa Nov 5, 2025
7372b0f
Improved deleteSpec
Ortisa Nov 5, 2025
a299157
improved loadModel function
Ortisa Nov 6, 2025
844619f
Added control dependency on mujoco actuators
Ortisa Nov 7, 2025
a590405
Added control_toolbox dependence
Ortisa Nov 10, 2025
e50a3d6
Added pid control
Ortisa Nov 10, 2025
b9e82ac
Improved structure
Ortisa Nov 10, 2025
85143cf
Added joint mujoco actuator type
Ortisa Nov 11, 2025
d8d8645
Improved logic
Ortisa Nov 11, 2025
3846eb4
Improved variable management
Ortisa Nov 11, 2025
62f0f4f
Fixed export_command_interfaces
Ortisa Nov 12, 2025
8138c52
managed unknown mujoco actuator
Ortisa Nov 12, 2025
9b02d28
Fixed mujoco general actuator
Ortisa Nov 12, 2025
bde1912
Managed custom mujococ actuator
Ortisa Nov 12, 2025
8c7f05f
Improved logic
Ortisa Nov 13, 2025
9389e58
added commands for pid control
Ortisa Nov 13, 2025
87ff505
fix if logic
Ortisa Nov 13, 2025
dba9c01
support of pid control for custom actuators
Ortisa Nov 17, 2025
b066fd5
Improved register joints for the velocity case
Ortisa Nov 18, 2025
4bd8834
Use PidROS instead of PID to reuse elements
saikishor Nov 18, 2025
631a6a9
added test
Ortisa Nov 19, 2025
bb54e2e
fix the prints
saikishor Nov 19, 2025
eb41ef5
Cleanup the repo and apply pre-commit formatting changes
saikishor Nov 19, 2025
ba83b32
Update to use the pids_config_file argument
saikishor Nov 19, 2025
b49b65f
update readme
saikishor Nov 19, 2025
cfd0f9e
Update pixi dependencies
saikishor Nov 19, 2025
e673551
update PID logic to be local
saikishor Nov 20, 2025
4e5fad1
Local PID logic for velocity command interface
Ortisa Nov 20, 2025
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ find_package(ament_cmake REQUIRED)
find_package(controller_manager REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(glfw3 REQUIRED)
find_package(control_toolbox REQUIRED)
find_package(hardware_interface REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
Expand Down Expand Up @@ -158,6 +159,7 @@ target_link_libraries(mujoco_ros2_simulation
pluginlib::pluginlib
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
control_toolbox::control_toolbox
sensor_msgs::sensor_msgs_library
Eigen3::Eigen
Threads::Threads
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ Just specify the plugin and point to a valid MJCF on launch:
<plugin>mujoco_ros2_simulation/MujocoSystemInterface</plugin>
<param name="mujoco_model">$(find my_description)/description/scene.xml</param>

<!--
Optional parameter to load the PIDs that can be used with the actuators loaded with the MuJoCo model. The velocity actuator supports position mode with the PID gains and the rest of the actuation models support both position and velocity mode provided the corresponding PID gains. The gains should be in ROS parameters format and is loaded by the control_toolbox::PidROS class
-->
<param name="pids_config_file">$(find my_description)/config/pids.yaml</param>

<!--
Optional parameter to override the speed scaling parameters from the Simulate App window
and just attempt to run at whatever the desired rate is here. This allows users to run the simulation
Expand Down
16 changes: 16 additions & 0 deletions include/mujoco_ros2_simulation/data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@

#include <Eigen/Core>
#include <Eigen/Geometry>
#include "control_toolbox/pid_ros.hpp"

#include <string>
#include <vector>

namespace mujoco_ros2_simulation
{

enum class ActuatorType
{
MOTOR,
POSITION,
VELOCITY,
CUSTOM
};

/**
* Wrapper for mujoco actuators and relevant ROS HW interface data.
*/
Expand All @@ -37,6 +46,9 @@ struct JointState
double position;
double velocity;
double effort;
std::shared_ptr<control_toolbox::PidROS> pos_pid{ nullptr };
std::shared_ptr<control_toolbox::PidROS> vel_pid{ nullptr };
ActuatorType actuator_type;
double position_command;
double velocity_command;
double effort_command;
Expand All @@ -51,8 +63,12 @@ struct JointState
// Booleans record whether or not we should be writing commands to these interfaces
// based on if they have been claimed.
bool is_position_control_enabled{ false };
bool is_position_pid_control_enabled{ false };
bool is_velocity_pid_control_enabled{ false };
bool is_velocity_control_enabled{ false };
bool is_effort_control_enabled{ false };
bool has_pos_pid{ false };
bool has_vel_pid{ false };
};

template <typename T>
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>sensor_msgs</depend>
<depend>control_toolbox</depend>

<test_depend>joint_state_broadcaster</test_depend>
<test_depend>position_controllers</test_depend>
Expand Down
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ros-jazzy-ros-base = "*"
ros-jazzy-ament-cmake = "*"
ros-jazzy-rclcpp = "*"
ros-jazzy-controller-manager = "*"
ros-jazzy-control-toolbox = "*"
ros-jazzy-hardware-interface = "*"
ros-jazzy-joint-state-broadcaster = "*"
ros-jazzy-position-controllers = "*"
Expand Down
Loading
Loading