Husarion Panther UGV & AgileX PiPER Arm Simulation Workspace
This ROS 2 Humble workspace integrates a Husarion Panther v2 UGV base with a custom aluminum extrusion profile frame, a StereoLabs ZED 2i camera, and an AgileX PiPER 6-DOF robotic manipulator arm.
The simulation uses Gazebo Fortress for physics rendering and MoveIt 2 for collision-free trajectory planning.
Workspace Structure
src/panther_piper_description/: Contains the unified robot URDF/Xacro models, meshes, ROS 2 control configurations, and simulation spawning launch scripts.src/panther_piper_moveit_config/: Contains MoveIt 2 configuration profiles (SRDF, kinematics, limits) and motion planning launch files.src/husarion_ugv_ros/: Cloned from husarion/husarion_ugv_ros (humble branch).src/piper_ros/: Cloned from agilexrobotics/piper_ros (humble branch).
Getting Started
1. Source the Workspace
Open a terminal inside your Ubuntu 22.04 WSL instance:
source /opt/ros/humble/setup.bash
cd ~/ros2_ws
source install/setup.bash
2. Spawning the Simulation (Gazebo)
You can choose which environment map to spawn using the world argument:
- Map 1: Office & 79m² Lab Layout (Default):
ros2 launch panther_piper_description simulation.launch.py world:=office_lab.sdf - Map 2: Outdoor Forest Map (Trees, Boulders & Off-Road Terrain):
ros2 launch panther_piper_description simulation.launch.py world:=forest.sdf - Empty World:
ros2 launch panther_piper_description simulation.launch.py world:=empty.sdf
3. Release the E-Stop (Required to Move Panther UGV Base)
By default, the Panther base simulation spawns with the E-Stop triggered (e_stop: true). To release it and enable wheel drive motors:
ros2 service call /hardware/e_stop_reset std_srvs/srv/Trigger {}
4. Control the Panther Base (Teleop)
To drive the Panther base using your keyboard:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Use the keys displayed in the console to command the wheels (publishes to /cmd_vel).
5. Launch MoveIt 2 Motion Planning
Ensure the Gazebo Simulation is running first, then open two more terminal windows:
- Terminal 2 (MoveGroup Nodes): Starts the path planning server.
ros2 launch panther_piper_moveit_config move_group.launch.py - Terminal 3 (MoveIt RViz Overlay): Starts the visual GUI representation.
Drag the interactive marker (sphere) at the arm's end-effector to a target pose in RViz, and click Plan and Execute to command movement in Gazebo.
ros2 launch panther_piper_moveit_config moveit_rviz.launch.py
Customizing Mounting Offsets (Arm & Camera)
You can customize where the PiPER arm and ZED camera are mounted on the aluminum profile frame by editing:
src/panther_piper_description/urdf/panther_piper.urdf.xacro
Modify the following properties at the top of the file:
<!-- PiPER Arm Mounting Offsets -->
<xacro:property name="arm_x_offset" value="0.12" /> <!-- meters forward/back -->
<xacro:property name="arm_y_offset" value="-0.10" /> <!-- meters left/right -->
<xacro:property name="arm_z_offset" value="0.45" /> <!-- height -->
<!-- Camera Mounting Offsets -->
<xacro:property name="camera_x_offset" value="0.0" />
<xacro:property name="camera_z_offset" value="0.80" /> <!-- height of crossbar -->
<xacro:property name="camera_pitch" value="0.0" /> <!-- camera tilt in radians -->
Always rebuild your workspace after editing Xacro files:
cd ~/ros2_ws && colcon build --symlink-install
WSL2 & Gazebo Performance Optimization Guide
If Gazebo runs laggy or sluggishly under WSL2, it is usually because it is falling back to software rendering (CPU) instead of using hardware-accelerated rendering (GPU). Follow these steps to optimize performance:
1. Verify GPU Acceleration in WSL2
Run this command in WSL2 to check your OpenGL graphics provider:
glxinfo -B
- Optimized state: The
Deviceline should display your physical GPU (e.g.NVIDIA GeForce...orIntel...). - Laggy state: If it displays
llvmpipe (LLVM...)orSoftware Rasterizer, WSL2 is rendering via the CPU.
To enable hardware GPU acceleration:
- Install the latest GPU drivers on Windows (host system). Windows WSLg virtualization supports GPU pass-through automatically.
- Ensure Mesa utils are installed in WSL:
sudo apt-get update && sudo apt-get install -y mesa-utils
2. Run Gazebo in Headless Mode (Highly Recommended)
If you only plan motions in RViz and do not need to look at the Gazebo physics window all the time, you can run the Gazebo simulator in headless mode (physics server only, GUI disabled). This cuts CPU/GPU usage by ~70%:
ros2 launch panther_piper_description simulation.launch.py gz_args:="-s -r empty.sdf"
(The -s argument disables the rendering client, running only the simulation server).
3. Allocate More Resources to WSL2 (.wslconfig)
On your Windows host, navigate to C:\Users\<YourUsername>\ and create or edit a file named .wslconfig:
[wsl2]
memory=16GB
processors=8
guiApplications=true
Save the file, then restart WSL2 by running in a Windows PowerShell window:
wsl --shutdown
4. Configure Rendering in ~/.bashrc
Mesa drivers in WSL2 sometimes throw Ogre::UnimplementedException (associated with copyTo) when launching the Gazebo GUI window with full GPU acceleration enabled. You have two options to manage this:
-
Option 1: GPU Accelerated (Headless / RViz Only): Best for motion planning and fast simulations. Keep GPU rendering active, but launch Gazebo in headless server-only mode using the
-sflag (since the crash only happens when the GUI client renders the scene). You can view the robot and plan actions in RViz. Add these to your~/.bashrc:export LIBGL_ALWAYS_INDIRECT=0 export MESA_D3D12_DEFAULT_TO_UNKNOWN_VENDOR=1 # export LIBGL_ALWAYS_SOFTWARE=1 # Make sure this is commented out! -
Option 2: Multi-threaded CPU Software Rendering (GUI Enabled): If you must open the Gazebo visual GUI client, use CPU-based software rendering. By setting
LP_NUM_THREADSto match your allocated CPU cores, rendering runs smoothly without crashing. Add these to your~/.bashrc:export LIBGL_ALWAYS_SOFTWARE=1 export LP_NUM_THREADS=8 # Matches the 'processors=8' setting in .wslconfig