ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.25k stars 9.72k forks source link

About the function of setup_host.sh. #12258

Closed hongyi-zhao closed 4 years ago

hongyi-zhao commented 4 years ago

Hi,

I try to figure out the function of the setup_host.sh script but still not so clear.

Any hints will be highly appreciated.

Best regards, HY

daohu527 commented 4 years ago

The comment has been explained very clearly. Generally speaking, it's do some configurations.

  1. Setup core dump format. when the program crash, there will be a coredump file used to record the error and debug the problem.
  2. Setup ntpdate to run once per minute. Log at /var/log/syslog. For time synchronization
  3. Add udev rules. udev allows for rules that specify what name is given to a device, regardless of which port it is plugged into
  4. Add uvcvideo clock config. Set usb camera clock config
storypku commented 4 years ago

The comment has been explained very clearly. Generally speaking, it's do some configurations.

  1. Setup core dump format. when the program crash, there will be a coredump file used to record the error and debug the problem.
  2. Setup ntpdate to run once per minute. Log at /var/log/syslog. For time synchronization
  3. Add udev rules. udev allows for rules that specify what name is given to a device, regardless of which port it is plugged into
  4. Add uvcvideo clock config. Set usb camera clock config

One question about "Enable Core Dump on Host": Since apollo was run inside docker, why do we need to enable coredump on the host machine where docker is running on?

I was wondering the reason why the original author wrote it, but got no clue ...

Do you have any ideas ? @xiaoxq @Capri2014 @jinghaomiao @ycool

daohu527 commented 4 years ago

Seems modify the config in dockerfile will have some problem, and It is best to modify outside docker. ref link link

First make sure the container will write the cores to an existing location in the container filesystem. The core generation settings are set in the host, not in the container. Example:

echo '/cores/core.%e.%p' | sudo tee /proc/sys/kernel/core_pattern
hongyi-zhao commented 4 years ago
2. Setup ntpdate to run once per minute. Log at /var/log/syslog. For time synchronization

For the real car running on the load, say, the Apollo D-Kit system, IMO, the time is obtained and/or synced from/among the GPS/GNSS/RTK/Lidar systems, etc..

So, I'm still not so clear why should we use ntpdate for this job and do it so frequently.

Best regards, HY

Capri2014 commented 4 years ago

Because Apollo modules need precise time stamps to collaborate and perform especially in complex environments, and system time may have accumulated error and differ from GPS time. You would find this frequent time sync essential also after your initial hundreds of hours road tests.

hongyi-zhao commented 4 years ago

@Capri2014 OK, thanks a lot for your explanations. It seems the job in this script only need to be run once immediately after the system has been started or the user has logged into. So, if I understand correct, we only need to apply a check workflow, say, in /etc/profile or ~/.profile, for confirmation whether the correct settings have been applied via invoking this script. Am I right?

Best regards, HY

storypku commented 4 years ago

Especially, do we need to run it as a very beginning step each time when I want to start apollo?

@hongyi-zhao I don't think setup_host.sh need to be run each time you started Apollo. You only need to run it once on the host.

hongyi-zhao commented 4 years ago

Thanks. Got it.