A real-time visualization and control tool for the Unitree A1 robot. This repository provides:
- Interactive joint control sliders to command the robot's joints.
- Real-time graphical plots to visualize joint positions and foot forces.
- Synchronized visualization of the robot in Gazebo and RViz.
1. Interactive Joint Control:
- GUI sliders to control all 12 joints (hip, thigh, and calf).
- Safety limits enforced for each joint to protect the robot.
2. Real-Time Visualization:
- Joint positions and foot force values plotted live using matplotlib.
3. Gazebo and RViz Integration:
- Launch the Unitree A1 robot in Gazebo for visualization.
- View joint states and foot forces in RViz.
4. ROS Support:
- Publishes and subscribes to ROS topics for smooth integration with the Unitree robot.
System Dependencies:
ROS melodic
Gazebo 9+ (for simulation)
Unitree Legged SDK
Python Libraries:
rospy
matplotlib
numpy
tkinter
Install missing dependencies:
sudo apt-get update
sudo apt-get install ros-noetic-joint-state-publisher ros-noetic-robot-state-publisher
pip install matplotlib numpy
Installation
- Clone this repository:
cd ~/catkin_ws/src
git clone https://github.com/your-username/A1-RealViz.git
cd ..
catkin_make
- Source your workspace:
source ~/catkin_ws/devel/setup.bash
Follow these steps to launch the tools in the correct order:
Start the ROS core:
roscore
Launch the Unitree A1 robot in Gazebo for visualization:
roslaunch unitree_joint_publisher display.launch
Launch the joint command publisher node that enables joint control:
rosrun unitree_joint_publisher joint_command_publisher
Launch the GUI to interactively control each joint using sliders:
rosrun unitree_joint_publisher joint_command_gui.py
Use the sliders to adjust the joint angles. The safety limits for each joint are enforced automatically.
To visualize joint positions and foot force data over time:
rosrun unitree_joint_publisher real_time_plot.py
display.launch
: Launches Gazebo and the robot visualization.control.launch
: Starts joint control publishers.
joint_command_gui.py
: GUI-based sliders to command joint positions.real_time_plot.py
: Plots joint positions and foot forces in real-time.
joint_publisher.cpp
: Publishes joint states and foot force data.joint_command_publisher.cpp
: Subscribes to desired joint positions and sends commands to the robot.
- Start the ROS master and launch Gazebo.
- Use the Joint Command GUI to control the robot's joints interactively.
- Visualize joint movements and foot forces in the real-time plot.
- View the robot's real-time state in Gazebo and RViz.
- Ensure the launch files are installed correctly.
- Source the workspace:
source ~/catkin_ws/devel/setup.bash
- Ensure tkinter is installed:
sudo apt-get install python3-tk
- Verify the
/joint_states
and/foot_forces
topics are being published.
- Add logging support for joint movements and forces.
- Integrate 3D sensor data (e.g., RealSense) for depth visualization.
This project is licensed under the MIT License.