unity2moveit2/docker/docker-compose.yml
ayuan9957 fe15edcbd5 Initial commit: Unity-MoveIt2 integrated robotic arm simulation system
- Unity frontend with ROS-TCP-Connector for ROS2 communication
- Docker-based ROS2 Jazzy backend with MoveIt2 integration
- Support for 1-9 DOF manipulators
- UR5 robot configuration and URDF files
- Assembly task feasibility analysis tools
- Comprehensive documentation and deployment guides

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 12:08:34 +08:00

112 lines
2.7 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
services:
ros2-unity:
build:
context: ..
dockerfile: docker/Dockerfile
container_name: unity-ros2-system
hostname: ros2-unity
# 网络配置
ports:
- "9090:9090" # Rosbridge WebSocket端口
- "10000:10000" # ROS-TCP-Endpoint主端口
- "10001:10001" # 备用端口1
- "10002:10002" # 备用端口2
- "11311:11311" # ROS Master端口 (如果需要ROS1桥接)
# 环境变量
environment:
- ROS_DOMAIN_ID=0
- RMW_IMPLEMENTATION=rmw_fastrtps_cpp
- ROS_LOCALHOST_ONLY=0
- PYTHONUNBUFFERED=1
- DISPLAY=${DISPLAY:-:0}
# 卷挂载
volumes:
- ../ros2-workspace:/ros2_ws_host:rw # 主机工作空间源码
- ../configs:/ros2_ws/configs:ro
- ../logs:/ros2_ws/logs:rw
- /tmp/.X11-unix:/tmp/.X11-unix:rw # X11转发 (Linux GUI支持)
# 网络模式
network_mode: bridge
# 重启策略
restart: unless-stopped
# 健康检查
healthcheck:
test: ["CMD", "/bin/bash", "-c", "source /opt/ros/jazzy/setup.bash && ros2 node list"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# 资源限制
deploy:
resources:
limits:
memory: 4G
cpus: '2.0'
reservations:
memory: 2G
cpus: '1.0'
# 交互式终端
stdin_open: true
tty: true
# 启动命令
command: >
bash -c "
source /opt/ros/jazzy/setup.bash &&
if [ -f /ros2_ws/install/setup.bash ]; then source /ros2_ws/install/setup.bash; fi &&
echo '启动ROS2 Unity系统...' &&
ros2 run ros_tcp_endpoint default_server_endpoint --ros-args -p ROS_IP:=0.0.0.0 -p ROS_TCP_PORT:=10000
"
# 可选ROS2监控服务
ros2-monitor:
build:
context: ..
dockerfile: docker/Dockerfile
container_name: ros2-monitor
depends_on:
- ros2-unity
environment:
- ROS_DOMAIN_ID=0
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
volumes:
- ../logs:/ros2_ws/logs:rw
command: >
bash -c "
echo '启动ROS2监控服务...'
sleep 10
while true; do
echo '=== ROS2 系统状态 ==='
echo '节点列表:'
ros2 node list || echo '无活动节点'
echo '话题列表:'
ros2 topic list || echo '无活动话题'
echo '服务列表:'
ros2 service list || echo '无活动服务'
echo '========================'
sleep 30
done
"
profiles:
- monitoring
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16