Upper limb exoskeleton is considered an effective solution to overcome the limitations of traditional therapy methods, in which the application of the robot operating system 2 (ROS 2) platform can surpass the constraints of conventional microcontroller-based controllers in terms of scalability and integration capability. This study introduces the design of motion controllers within the ROS 2 platform, enabling accurate and efficient testing of control algorithms in a simulation environment and, most importantly, ensuring a seamless transition from simulation to real-world implementation. First, a 4-degree-of-freedom (DOF) rehabilitation robot using brushless DC motors is constructed using SolidWorks software, and the rehabilitation exercise trajectories are developed based on materials from medical experts. After performing kinematic and dynamic analysis, two controllers proportional-derivative (PD) and proportional-derivative with gravity compensation (PD-G) are designed. The PD and PD-G controllers is then implemented on the ROS 2 platform and validated on a digital robot model deployed in the Gazebo environment based on the 3D model from SolidWorks. After testing in the simulation environment, the digital model is replaced with the physical robot while preserving the fundamental control architecture, demonstrating the adaptability of the ROS 2-based framework. Rehabilitation exercises are applied in both simulation and real-world testing to evaluate control performance. The results show that the control system achieves an average tracking error of less than 1 degree at most joints, except for the second joint due to gravitational influence, and no overshoot or oscillation is observed. The control solution based on the ROS 2 platform demonstrates high scalability, precision, and efficiency in the simulation and real-world environment, promising a potential approach for developing robot systems
Rehabilitation robot, ROS 2, ros2_control, PD/PD-G control, Co-simulation