Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker/navigation/.env.hardware
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ROS_DOMAIN_ID=42
# Robot configuration ('mechanum_drive', 'unitree/unitree_g1', 'unitree/unitree_g1', etc)
ROBOT_CONFIG_PATH=mechanum_drive

# Robot IP address on local network for connection over WebRTC
# For Unitree Go2, Unitree G1, if using WebRTCConnection
# This can be found in the unitree app under Device settings or via network scan
ROBOT_IP=

# ============================================
# Mid-360 Lidar Configuration
# ============================================
Expand Down
5 changes: 5 additions & 0 deletions docker/navigation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ EOF\n\
echo "Generated MID360_config.json with LIDAR_COMPUTER_IP=${LIDAR_COMPUTER_IP} and LIDAR_IP=${LIDAR_IP}"\n\
fi\n\
\n\
# Display Robot IP configuration if set\n\
if [ -n "${ROBOT_IP}" ]; then\n\
echo "Robot IP configured on local network: ${ROBOT_IP}"\n\
fi\n\
\n\
fi\n\
\n\
# Execute the command\n\
Expand Down
21 changes: 12 additions & 9 deletions docker/navigation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ LIDAR_INTERFACE=eth0 # Your ethernet interface (find with: ip link
LIDAR_COMPUTER_IP=192.168.1.5 # Computer IP on the lidar subnet
LIDAR_GATEWAY=192.168.1.1 # Gateway IP address for the lidar subnet
LIDAR_IP=192.168.1.116 # Full IP address of your Mid-360 lidar
ROBOT_IP= # IP addres of robot on local network (if using WebRTC connection)

# Motor Controller
MOTOR_SERIAL_DEVICE=/dev/ttyACM0 # Serial device (check with: ls /dev/ttyACM*)
Expand All @@ -136,20 +137,22 @@ docker exec -it dimos_hardware_container bash

### In the container

In the container you can run any of the ROS or Python code.
In the container to run the full navigation stack you must run both the dimensional python runfile with connection module and the navigation stack.

#### ROS
#### Dimensional Python + Connection Module

For the Unitree G1
```bash
cd /ros2_ws/src/ros-navigation-autonomy-stack
./system_real_robot_with_route_planner.sh
dimos-robot run unitree-g1
ROBOT_IP=XX.X.X.XXX dimos-robot run unitree-g1 # If ROBOT_IP env variable is not set in .env
```

### Python

Demo which moves the robot 2 meters forward and 2 meters left.
#### Navigation Stack

```bash
source /opt/dimos-venv/bin/activate
python3 dimos/navigation/demo_ros_navigation.py
cd /ros2_ws/src/ros-navigation-autonomy-stack
./system_real_robot_with_route_planner.sh
```

Now you can place goal points/poses in RVIZ by clicking the "Goalpoint" button. The robot will navigate to the point, running both local and global planners for dynamic obstacle avoidance.

2 changes: 2 additions & 0 deletions docker/navigation/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:-all}
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-42}
- ROBOT_CONFIG_PATH=${ROBOT_CONFIG_PATH:-mechanum_drive}
- ROBOT_IP=${ROBOT_IP:-}
- HARDWARE_MODE=false

# Volume mounts
Expand Down Expand Up @@ -90,6 +91,7 @@ services:
- NVIDIA_DRIVER_CAPABILITIES=all
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-42}
- ROBOT_CONFIG_PATH=${ROBOT_CONFIG_PATH:-mechanum_drive}
- ROBOT_IP=${ROBOT_IP:-}
- HARDWARE_MODE=true
# Mid-360 Lidar configuration
- LIDAR_INTERFACE=${LIDAR_INTERFACE:-}
Expand Down
71 changes: 63 additions & 8 deletions docker/navigation/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ if [ "$MODE" = "hardware" ]; then
echo "Set LIDAR_GATEWAY to the gateway IP address for the lidar subnet"
fi

# Check for robot IP configuration
if [ -n "$ROBOT_IP" ]; then
echo -e "${GREEN}Robot IP configured: $ROBOT_IP${NC}"
else
echo -e "${YELLOW}Note: ROBOT_IP not configured in .env${NC}"
echo "Set ROBOT_IP if using network connection to robot"
fi

# Check for serial devices
echo -e "${GREEN}Checking for serial devices...${NC}"
if [ -e "${MOTOR_SERIAL_DEVICE:-/dev/ttyACM0}" ]; then
Expand All @@ -97,15 +105,61 @@ if [ "$MODE" = "hardware" ]; then
fi

# Check network interface for lidar
if [ -n "$LIDAR_INTERFACE" ]; then
echo -e "${GREEN}Checking network interface for lidar...${NC}"
if ip link show "$LIDAR_INTERFACE" &>/dev/null; then
echo -e " Network interface $LIDAR_INTERFACE found"
else
echo -e "${YELLOW} Warning: Interface $LIDAR_INTERFACE not found${NC}"
echo -e "${YELLOW} Available interfaces:${NC}"
ip link show | grep -E "^[0-9]+:" | awk '{print " " $2}' | sed 's/:$//'
echo -e "${GREEN}Checking network interface for lidar...${NC}"

# Get available ethernet interfaces
AVAILABLE_ETH=""
for i in /sys/class/net/*; do
if [ "$(cat $i/type 2>/dev/null)" = "1" ] && [ "$i" != "/sys/class/net/lo" ]; then
interface=$(basename $i)
if [ -z "$AVAILABLE_ETH" ]; then
AVAILABLE_ETH="$interface"
else
AVAILABLE_ETH="$AVAILABLE_ETH, $interface"
fi
fi
done

if [ -z "$LIDAR_INTERFACE" ]; then
# No interface configured
echo -e "${RED}================================================================${NC}"
echo -e "${RED} ERROR: ETHERNET INTERFACE NOT CONFIGURED!${NC}"
echo -e "${RED}================================================================${NC}"
echo -e "${YELLOW} LIDAR_INTERFACE not set in .env file${NC}"
echo ""
echo -e "${YELLOW} Your ethernet interfaces: ${GREEN}${AVAILABLE_ETH}${NC}"
echo ""
echo -e "${YELLOW} ACTION REQUIRED:${NC}"
echo -e " 1. Edit the .env file and set:"
echo -e " ${GREEN}LIDAR_INTERFACE=<your_ethernet_interface>${NC}"
echo -e " 2. Run this script again"
echo -e "${RED}================================================================${NC}"
exit 1
elif ! ip link show "$LIDAR_INTERFACE" &>/dev/null; then
# Interface configured but doesn't exist
echo -e "${RED}================================================================${NC}"
echo -e "${RED} ERROR: ETHERNET INTERFACE '$LIDAR_INTERFACE' NOT FOUND!${NC}"
echo -e "${RED}================================================================${NC}"
echo -e "${YELLOW} You configured: LIDAR_INTERFACE=$LIDAR_INTERFACE${NC}"
echo -e "${YELLOW} But this interface doesn't exist on your system${NC}"
echo ""
echo -e "${YELLOW} Your ethernet interfaces: ${GREEN}${AVAILABLE_ETH}${NC}"
echo ""
echo -e "${YELLOW} ACTION REQUIRED:${NC}"
echo -e " 1. Edit the .env file and change to one of your interfaces:"
echo -e " ${GREEN}LIDAR_INTERFACE=<your_actual_ethernet_interface>${NC}"
echo -e " 2. Run this script again"
echo -e "${RED}================================================================${NC}"
exit 1
else
# Interface exists and is configured correctly
echo -e " ${GREEN}✓${NC} Network interface $LIDAR_INTERFACE found"
echo -e " ${GREEN}✓${NC} Will configure static IP: ${LIDAR_COMPUTER_IP}/24"
echo -e " ${GREEN}✓${NC} Will set gateway: ${LIDAR_GATEWAY}"
echo ""
echo -e "${YELLOW} Network configuration mode: Static IP (Manual)${NC}"
echo -e " This will temporarily replace DHCP with static IP assignment"
echo -e " Configuration reverts when container stops"
fi
fi

Expand Down Expand Up @@ -143,6 +197,7 @@ if docker info 2>/dev/null | grep -q nvidia; then
fi
else
echo -e "${YELLOW}NVIDIA Docker runtime not found. GPU acceleration disabled.${NC}"
export DOCKER_RUNTIME=runc
fi

# Set container name for reference
Expand Down