├── .gitignore ├── pictures └── image.png ├── sim2sim2real.repos └── ReadMe.md /.gitignore: -------------------------------------------------------------------------------- 1 | # 忽略所有文件 2 | /install 3 | /log 4 | /build 5 | 6 | # 排除 src 文件夹 7 | !src/ 8 | -------------------------------------------------------------------------------- /pictures/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDTRobot/tita_rl_sim2sim2real/HEAD/pictures/image.png -------------------------------------------------------------------------------- /sim2sim2real.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | src/tita_bringup: 3 | type: git 4 | url: https://github.com/DDTRobot/tita_rl_bring_up.git 5 | version: master 6 | 7 | src/tita_command: 8 | type: git 9 | url: https://github.com/DDTRobot/tita_rl_command.git 10 | version: master 11 | 12 | src/tita_locomotion: 13 | type: git 14 | url: https://github.com/DDTRobot/tita_rl_locomotion.git 15 | version: master 16 | 17 | src/tita_locomotion/tita_webots_ros2: 18 | type: git 19 | url: https://github.com/DDTRobot/tita_rl_webots_ros2.git 20 | version: master 21 | 22 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | 持续更新中~~~ 2 | 有问题欢迎在Issues中反馈,欢迎大家一起加入学习。 3 | 4 | 5 | 若启动了conda环境先把环境关闭 6 | 7 | ```bash 8 | conda deactivate 9 | ``` 10 | 11 | 12 | ### 安装环境(宿主机host中执行) 13 | 14 | 安装ros2_control : 15 | 16 | https://github.com/DDTRobot/TITA_ROS2_Control_Sim.git 17 | 18 | **或者直接使用docker,已配置好tensor\webots\ros2\ros2-control环境** 19 | 20 | https://github.com/DDTRobot/webots2023b_ros2_docker 21 | 22 | 按照以下命令行拉取编译代码 23 | 24 | ```bash 25 | #本仓库 26 | git clone https://github.com/DDTRobot/tita_rl_sim2sim2real.git 27 | 28 | cd sim2sim2real 29 | 30 | #其他仓库 31 | vcs import < sim2sim2real.repos 32 | ``` 33 | 34 | 编译之前先修改这个文件:src/tita_locomotion/tita_controllers/tita_controller/src/fsm/FSMState_RL.cpp 35 | ![alt text](/pictures/image.png) 36 | 把位置修改为把推理出来的model_gn.engine路径。 **如果是在docker下运行,请将.engine的路径修改为docker中的路径,而不是宿主机的路径!!(一般为/mnt/dev/*.engine)** 37 | 38 | 39 | ### 运行 (docker和 host都可以) 40 | 41 | ```bash 42 | #编译 43 | source /opt/ros/humble/setup.bash && colcon build --packages-up-to locomotion_bringup webots_bridge template_ros2_controller tita_controller joy_controller keyboard_controller 44 | 45 | source install/setup.bash 46 | 47 | #启动webots仿真 48 | source /opt/ros/humble/setup.bash && source install/setup.bash && ros2 launch locomotion_bringup sim_bringup.launch.py 49 | 50 | #启动键盘指令输入终端 51 | source /opt/ros/humble/setup.bash && source install/setup.bash && ros2 run keyboard_controller keyboard_controller_node --ros-args -r __ns:=/tita 52 | 53 | #如果webots遇到不显示机器人mesh的情况: 54 | sudo mkdir -p /usr/share/robot_description 55 | sudo cp -r src/tita_locomotion/tita_description/tita /usr/share/robot_description/ 56 | 57 | ``` 58 | 59 | ### 实机部分 60 | 61 | ```bash 62 | #拷贝文件进入机器 63 | scp -r 你的路径/tita_ros2/src robot@192.168.42.1:~/tita_ros2/ 64 | 65 | #连接机器: 66 | ssh robot@192.168.42.1 67 | #密码: 68 | apollo 69 | 70 | #关掉自启的ros2 71 | systemctl stop tita-bringup.service 72 | 73 | cd tita_ros2/ 74 | 75 | source /opt/ros/humble/setup.bash 76 | 77 | #编译 78 | colcon build --packages-up-to locomotion_bringup template_ros2_controller tita_controller joy_controller keyboard_controller hw_broadcaster 79 | 80 | source install/setup.bash 81 | 82 | #连接遥控器 83 | crsf-app -bind 84 | 85 | #原则上需要重新在机器人中重新推理生成.engine,当前版本镜像中不包含tensorrt的dev,因此需要重新安装 86 | sudo apt install nvidia-cuda-dev 87 | sudo apt install tensorrt-dev 88 | sudo apt install tensorrt 89 | #安装完毕后对你的onnx做重新推理: 90 | /usr/src/tensorrt/bin/trtexec --onnx=test.onnx --saveEngine=model_gn.engine 91 | 92 | #分别运行 93 | nohup ros2 launch locomotion_bringup hw_bringup.launch.py ctrl_mode:=wbc & 94 | nohup ros2 launch joy_controller joy_controller.launch.py & 95 | ``` 96 | 97 | 如果您的tensorrt是10.x版本,参考[这里](https://github.com/DDTRobot/tita_rl_sim2sim2real/issues/1) 98 | --------------------------------------------------------------------------------