Quickstart Guide for Physical AI & Humanoid Robotics
This quickstart guide provides a rapid pathway for getting started with Physical AI and humanoid robotics development. It covers the essential setup and first steps to build on the concepts covered in this book.
Prerequisites
Hardware Requirements
-
Development Computer:
- 64-bit processor with 8+ cores
- 16GB+ RAM, 32GB recommended
- NVIDIA GPU with CUDA support (RTX 3060/4060 or better)
- 500GB+ available disk space
-
Robot Hardware (for physical testing, optional for simulation):
- Humanoid robot platform (e.g., Unitree G1, NAO, or similar)
- Compatible computer for robot control (e.g., NVIDIA Jetson Orin)
- Network connectivity for robot communication
Software Requirements
- Operating System: Ubuntu 22.04 LTS
- Additional OS Support: Windows 10/11, macOS 12+ (with WSL2 for full functionality)
Installation Setup
1. Install Ubuntu 22.04 (if needed)
If you don't already have Ubuntu 22.04 LTS:
# Download Ubuntu 22.04 LTS from https://ubuntu.com/download/desktop
# Create bootable USB drive using Rufus (Windows) or Startup Disk Creator (Ubuntu)
# Boot from USB and follow installation instructions
2. Install ROS 2 Humble Hawksbill
# Set locale
locale # check for UTF-8
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
# Add ROS 2 apt repository
sudo apt update && sudo apt install curl gnupg lsb-release
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | sudo gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Install ROS 2 packages
sudo apt update
sudo apt install ros-humble-desktop
sudo apt install python3-rosdep2
sudo apt install python3-colcon-common-extensions
# Initialize rosdep
sudo rosdep init
rosdep update
# Source ROS 2 - add to ~/.bashrc for persistence
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source /opt/ros/humble/setup.bash
3. Install Simulation Environment
# Install Gazebo Garden (default for ROS 2 Humble)
sudo apt install gz-garden
# Alternatively, install Ignition Fortress (previous version)
# sudo apt install ignition-fortress
# Install ROS-Gazebo bridge
sudo apt install ros-humble-gazebo-ros-pkgs ros-humble-gazebo-ros2-control
4. Install NVIDIA Isaac Sim (Optional - More Advanced)
For NVIDIA Isaac Sim setup:
- Sign up for NVIDIA Developer account
- Download Isaac Sim from developer.nvidia.com
- Follow installation guide for your system
- Verify installation with provided examples
5. Install Development Tools
# Install build tools
sudo apt install python3-pip build-essential cmake
pip3 install colcon-build vcstool
# Install Git and version control tools
sudo apt install git git-lfs
# Install development tools
sudo apt install python3-venv python3-dev
sudo apt install terminator tmux
# Install visualization tools
sudo apt install ros-humble-rviz2 ros-humble-rqt-common-plugins
6. Install Python Dependencies
# Create a Python virtual environment
python3 -m venv ~/physical-ai-env
source ~/physical-ai-env/bin/activate
# Upgrade pip
pip install --upgrade pip
# Install common Python libraries
pip install numpy scipy matplotlib pandas
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install tensorflow keras
pip install openai # For OpenAI Whisper integration
pip install transformers # For NLP components
pip install opencv-python # For computer vision
pip install pyquaternion # For rotation calculations
Getting Started with Examples
1. Create a Workspace
# Create workspace directory
mkdir -p ~/physical_ai_ws/src
cd ~/physical_ai_ws
# Source ROS 2
source /opt/ros/humble/setup.bash
# Build workspace (even if empty initially)
colcon build --symlink-install
2. Source the Workspace
# Add to ~/.bashrc for persistence
echo "source ~/physical_ai_ws/install/setup.bash" >> ~/.bashrc
# Source in current terminal
source ~/physical_ai_ws/install/setup.bash
3. Clone Example Repository
cd ~/physical_ai_ws/src
# Clone a sample humanoid robot package
git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git -b humble
git clone https://github.com/ros-controls/ros2_control.git -b humble
git clone https://github.com/ros-controls/ros2_controllers.git -b humble
# You can also create your own packages
ros2 pkg create --build-type ament_python my_physical_ai_robot
4. Build the Workspace
cd ~/physical_ai_ws
colcon build --packages-select gazebo_ros_pkgs ros2_control ros2_controllers
Running Your First Simulation
1. Launch a Simple Robot in Gazebo
# Source your workspace
source ~/physical_ai_ws/install/setup.bash
# Launch a simple robot simulation (example)
# This assumes you have a robot model, adjust for your specific robot
ros2 launch gazebo_ros empty_world.launch.py
2. Load a Robot Model
# In a new terminal (with workspace sourced)
ros2 run gazebo_ros spawn_entity.py -file /path/to/your/robot/model.urdf -entity my_robot
3. Control the Robot
# Send a simple command to the robot
ros2 topic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0}, angular: {z: 0.5}}'
Development Workflow
1. Create a New Package
cd ~/physical_ai_ws/src
ros2 pkg create --build-type ament_python --dependencies rclpy std_msgs geometry_msgs sensor_msgs my_humanoid_controller
2. Write a Simple ROS 2 Node
Create ~/physical_ai_ws/src/my_humanoid_controller/my_humanoid_controller/controller_node.py:
#!/usr/bin/env python3
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import JointState
from geometry_msgs.msg import Twist
class SimpleController(Node):
def __init__(self):
super().__init__('simple_controller')
# Create subscriber for velocity commands
self.cmd_vel_sub = self.create_subscription(
Twist,
'cmd_vel',
self.cmd_vel_callback,
10
)
# Create publisher for joint states
self.joint_pub = self.create_publisher(
JointState,
'joint_states',
10
)
# Timer for control loop
self.timer = self.create_timer(0.05, self.control_loop) # 20 Hz
self.velocity_cmd = Twist()
self.get_logger().info('Simple Controller node started')
def cmd_vel_callback(self, msg):
self.velocity_cmd = msg
def control_loop(self):
# Create joint state message
msg = JointState()
msg.name = ['joint1', 'joint2'] # Replace with actual joint names
msg.position = [0.0, 0.0] # Replace with actual joint positions
msg.header.stamp = self.get_clock().now().to_msg()
# Publish joint states
self.joint_pub.publish(msg)
def main(args=None):
rclpy.init(args=args)
controller = SimpleController()
try:
rclpy.spin(controller)
except KeyboardInterrupt:
pass
finally:
controller.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
3. Make the Node Executable and Test
# Make the Python script executable
chmod +x ~/physical_ai_ws/src/my_humanoid_controller/my_humanoid_controller/controller_node.py
# Build the package
cd ~/physical_ai_ws
colcon build --packages-select my_humanoid_controller
# Source the workspace
source install/setup.bash
# Run the node
ros2 run my_humanoid_controller controller_node
Understanding the Physical AI Stack
1. Vision Components
# Example vision component
import cv2
import numpy as np
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
class VisionComponent:
def __init__(self):
self.bridge = CvBridge()
def image_callback(self, image_msg):
# Convert ROS Image to OpenCV
cv_image = self.bridge.imgmsg_to_cv2(image_msg, "bgr8")
# Process image (example: detect red objects)
hsv = cv2.cvtColor(cv_image, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (0, 50, 50), (10, 255, 255)) # Red mask
# Find contours
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# Process contours (find largest, centroids, etc.)
# Return processed information
2. Language Components
# Example language component
from transformers import pipeline
class LanguageComponent:
def __init__(self):
self.qa_pipeline = pipeline("question-answering",
model="deepset/roberta-base-squad2")
def process_command(self, command_text):
# Process natural language command
# This is a simplified example
if "move forward" in command_text.lower():
return {"action": "move", "direction": "forward", "distance": 1.0}
elif "turn left" in command_text.lower():
return {"action": "turn", "direction": "left", "angle": 90}
# Add more complex processing as needed
3. Action Components
# Example action component
from geometry_msgs.msg import Twist
class ActionComponent:
def __init__(self, cmd_publisher):
self.cmd_publisher = cmd_publisher
def execute_action(self, action_dict):
cmd = Twist()
if action_dict["action"] == "move":
if action_dict["direction"] == "forward":
cmd.linear.x = 0.5 # m/s
elif action_dict["action"] == "turn":
if action_dict["direction"] == "left":
cmd.angular.z = 0.5 # rad/s
# Send command to robot
self.cmd_publisher.publish(cmd)
Simulation Quick Setup
1. Create a Simple URDF Robot
Create ~/physical_ai_ws/src/my_humanoid_controller/config/simple_humanoid.urdf:
<?xml version="1.0"?>
<robot name="simple_humanoid">
<!-- Base link -->
<link name="base_link">
<visual>
<geometry>
<box size="0.2 0.1 0.1"/>
</geometry>
<material name="blue">
<color rgba="0 0 1 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.2 0.1 0.1"/>
</geometry>
</collision>
<inertial>
<mass value="1.0"/>
<inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/>
</inertial>
</link>
</robot>
2. Create a Launch File
Create ~/physical_ai_ws/src/my_humanoid_controller/launch/simple_humanoid.launch.py:
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os
def generate_launch_description():
# Get URDF file path
urdf_file = os.path.join(
get_package_share_directory('my_humanoid_controller'),
'config',
'simple_humanoid.urdf'
)
return LaunchDescription([
# Robot state publisher
Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
parameters=[
{'robot_description': open(urdf_file).read()}
]
),
# Controller node
Node(
package='my_humanoid_controller',
executable='controller_node',
name='simple_controller'
)
])
3. Launch the Simulation
# Build and source the workspace
cd ~/physical_ai_ws
colcon build --packages-select my_humanoid_controller
source install/setup.bash
# Launch the simulation
ros2 launch my_humanoid_controller simple_humanoid.launch.py
Common Commands Summary
ROS 2 Commands
ros2 node list- List active nodesros2 topic list- List active topicsros2 topic echo /topic_name- Monitor topic dataros2 service list- List available servicesros2 action list- List available actionsros2 param list- List parameters of a node
Gazebo Commands
gz sim -r empty.sdf- Launch Gazebo with empty worldgz sim -r [model_name]- Launch Gazebo with a specific modelgz topic -l- List available Gazebo topicsgz service -l- List available Gazebo services
Development Commands
colcon build- Build all packages in workspacecolcon build --packages-select [pkg_name]- Build specific packagesource install/setup.bash- Source the workspacerqt- Launch ROS GUI toolsrviz2- Launch visualization tool
Troubleshooting Quick Fixes
Common Issues and Solutions
-
"Command not found" errors: Make sure to source ROS and your workspace:
source /opt/ros/humble/setup.bash
source ~/physical_ai_ws/install/setup.bash -
"Unable to communicate with master": Check if ROS is initialized:
printenv | grep ROSIf not set, source the ROS setup file.
-
Simulation runs slow: Reduce visual complexity or lower physics update rate.
-
Python import errors: Check if your Python environment is activated and packages are installed:
source ~/physical_ai_env/bin/activate
python -c "import rclpy"
Next Steps
After completing this quickstart guide, continue with:
- Module 1: Deepen your understanding of ROS 2 architecture
- Module 2: Explore Gazebo simulation and digital twins
- Module 3: Learn about NVIDIA Isaac and AI perception
- Module 4: Implement VLA (Vision-Language-Action) systems
This quickstart provides the foundation to work with Physical AI and humanoid robotics. The concepts and tools introduced here will be expanded upon in the detailed modules that follow.