This package implements a custom ros2_control hardware interface for a
single-joint robot that communicates with a mock serial motor driver.
The system integrates with standard ROS 2 controllers and can be visualized in RViz2.
- Ubuntu 22.04 (ROS 2 Humble)
sudo apt update
sudo apt install \
ros-humble-ros2-control \
ros-humble-ros2-controllers \
ros-humble-controller-manager \
ros-humble-joint-state-broadcaster \
ros-humble-joint-trajectory-controller \
ros-humble-xacro \
ros-humble-rviz2Create a ROS 2 workspace if you don’t already have one:
mkdir -p ~/ros_ws2/src
cd ~/ros_ws2/srcClone or copy this package into the src directory:
cd ~/ros_ws2/src
git clone https://github.com/Subh85330/mock-serial-hardware-interface.gitSource your ROS 2 environment:
source /opt/ros/humble/setup.bashBuild the package:
cd ~/ros_ws2
colcon build --packages-select mock_serial_hardwareSource the workspace:
source install/setup.bashLaunch the ros2_control system, robot_state_publisher, and RViz:
ros2 launch mock_serial_hardware mock_system.launch.pyYou should see:
ros2_control_node running
Hardware interface initialized and activated
Configured and activated joint_state_broadcaster
Configured and activated joint_position_controller
RViz window opened
Move the joint using a trajectory command:
ros2 topic pub /joint_position_controller/joint_trajectory \
trajectory_msgs/msg/JointTrajectory "
joint_names: ['joint1']
points:
- positions: [1.0]
time_from_start: {sec: 2}
"Set Fixed Frame to base
Added RobotModel and set description robot_description
Added TF


