Macbook pro 13" compile Apollo 2.5

STEPS:

0. Install Homebrew

1.  Install 'Docker for Mac 18.03+',配置CPUs (n个CPUs,Bazel开n个线程编译), Memory (>2G,编译最小内存,推荐4G), Swap (>2G,推荐2G)

2. git clone ... apollo ...

3. 进入apollo目录,pull docker image for apollo (首次运行会pull 5G 的images)

./docker/scripts/dev_start.sh

*注意 这里的dev_start.sh需要修改下来适配Docker for Mac特性, 需要改成手动配置端口映射:

Replace
--net host

with bellow, both 8887 and 8888 works.
-p 8887:8887 -p 8888:8888

4. 进入apollo container by using

./docker/scripts/dev_into.sh

5. Docker for mac 的实现基于轻量虚拟机技术,网络和文件系统共享完善。

在container中的/apollo文件夹直接映射host中的工作文件夹./apollo

6. 编译

./apollo.sh build

(or)

./apollo.sh build_no_perception dbg

由于macbook 13" 性能不佳或者网络不好(编译中可能会下载一个小文件),编译可能中断。

直接退出后重启docker, 清空container,重启apollo container进入接着编译

Bazel会自动跳过已编译过的项目。

整个编译过程大概要~1h,需要约10G硬盘空间。

7. 编译成功后运行

./scripts/bootstrap.sh

启动

andrew@in_dev_docker:/apollo$ ./scripts/bootstrap.sh  

Started supervisord with dev conf

Start roscore...

voice_detector: started

dreamview: started

Dreamview is running at http://localhost:8888

8. 在host mac上打开chrome输入地址 localhost:8888

进入dreamview前端界面

From the dropdown box selet "Navigation" mode.

9.  Replay demo rosbag

To see if the system works, use the demo 'bag' which feeds the system.

下载演示数据集 demo_2.5.bag (~约3G)

# get rosbag note that the command download is required
python ./docs/demo_guide/rosbag_helper.py demo_2.5.bag

运行演示数据集 demo_2.5.bag
# You can now replay this demo "bag" in a loop with the '-l' flag rosbag play -l demo_2.5.bag

Dreamview should show a running vehicle now.

Comments

1. Docker for mac的支持已经很好, mac可以用做代码编写和编译环境、模拟演示

2. 整个编译运行空间,大约需要50G +,mac ssd!,macbook 13"编译时间长

3. docker.qcow2 是docker用于存放image和container的单个文件,在docker for mac 中配置其大小最多为60G。 

=============================

du -sh 查看当前文件夹大小

 

du -sh * | sort -n 统计当前文件夹(目录)大小,并按文件大小排序

 

  • #!/bin/bash
  • # Delete all containers
  • docker rm $(docker ps -a -q)
  • # Delete all images
  • docker rmi $(docker images -q)

 

Force-remove a running container 

This command will force-remove a running container. 

$ docker rm --force redis r

 

The main process inside the container referenced under the link redis will receive SIGKILL, then the container will be removed. 

 

Remove all stopped containers 

$ docker rm $(docker ps -a -q) 

 

This command will delete all stopped containers. The command docker ps -a -q will return all existing container IDs and pass them to the rm command which will delete them. Any running containers will not be deleted. 

 

Remove a container and its volumes 

$ docker rm -v redis redis 

 

This command will remove the container and any volumes associated with it. Note that if a volume was specified with a name, it will not be removed.

原文地址:https://www.cnblogs.com/andrew-wang/p/9094964.html