ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.1k stars 9.69k forks source link

How to run bridge with aem in apollo 8.0? #14808

Open mgcho0608 opened 1 year ago

mgcho0608 commented 1 year ago

System information

I previously used Apollo version 7.0 with docker, and now I am attempting to utilize version 8.0 for its improved end-to-end planning capabilities. However, I am struggling to find the proper method for running cyber_bridge with the aem tool. In version 7.0, I executed the python code after performing the following steps: 1. dev_start.sh, 2. dev_into.sh, 3. bootstrap_lgsvl.sh, and 4. bridge.sh. After reviewing the documentation, I discovered that the first three steps should be replaced with 1. aem start, 2. aem enter, and 3. aem bootstrap. Unfortunately, I was unable to locate the aem bridge. Any suggestions?

WildBeast114514 commented 1 year ago

In apollo 8.0, You need to perform the following action:

# update repositories
sudo apt update

# download drivers and cyber bridge module
$ sudo apt install apollo-neo-drivers-dev apollo-neo-cyber-bridge-dev

# start image_decompress component
$ nohup cyber_launch start  /opt/apollo/neo/packages/drivers-dev/latest/addition_data/tools/image_decompress/launch/image_decompress.launch &

# start cyber bridge
$ cyber_bridge
mgcho0608 commented 1 year ago

@WildBeast114514 Thanks for your answer! I followed your instructions and observed that tcp 8888, 9090 port were connected.

Screenshot from 2023-03-14 09-26-43

Unfortunately, I got two new issues.

  1. According to your answer, I should start image_decompress component before starting cyber bridge. However, I need another terminal to start cyber bridge as the image_decompress terminal was not usable (even '&' was at the end). I'm not sure this works in a right way. Screenshot from 2023-03-14 09-34-01

  2. As shown in the first screenshot, even though the tcp port of autopilot and dreamview were connected, any messages were not transmitted through the connection (Obviously, the car didn't move at all).

WildBeast114514 commented 1 year ago
  1. It looks like the image_decompress component is working properly, you can use the cyber_monitor command in another terminal to see if there is a topic like /apollo/sensor/camera/front_6mm/image/compressed
  2. What did you do after running cyber_bridge? To further confirm the cause, please enter the following command to start cyber_bridge:
    $ export GLOG_minloglevel=4 && cyber_bridge

    and then provide the log of cyber_bridge

mgcho0608 commented 1 year ago

Thanks for your answer!

  1. I used cyber_monitor but couldn't find topic like /apollo/sensor/camera/front_6mm/image/compressed.

Screenshot from 2023-03-14 12-39-36

  1. Unfortunately, 'export GLOG_minloglevel=4 && cyber_bridge' makes segmentation fault, while 'cyber_bridge' does not.

Screenshot from 2023-03-14 12-38-24

Note that my spec of local computer is NVIDIA GeForce RTX 3070 8GB GPU, 32GB * 2 memory, AMD Ryzen 7 5800X CPU.

WildBeast114514 commented 1 year ago
  1. try "ctrl+d" to turn down the page of cyber_montor 66465a0c1a4827ca1a4cd13d9808045f
  2. sorry for that mistake, the command should be:
$ export GLOG_alsologtostderr=1 && cyber_bridge
mgcho0608 commented 1 year ago

Thanks for your answer!

  1. Oh, I got it. I found the compressed topics and it works when I run the python code through lgsvl simulator (while other topics not working...)

Screenshot from 2023-03-14 15-19-07

  1. Here is the result log with the command.

Screenshot from 2023-03-14 15-24-56

This is the log right after entering the command.

Screenshot from 2023-03-14 15-25-11

After I run the simulator, this kind of logs repeated until I finished the simulation.

mgcho0608 commented 1 year ago

For 2, it seems the autopilot server couldn't receive messages for desired topics. But it is strange that I could check the lgsvl simulator publishing messages for those topics in a right way.

Screenshot from 2023-03-14 17-25-35

Jeffrey599 commented 1 year ago

I had the similar issue and I built the apollo 8.0 from source code (I did it like 7.0, and this was mentioned in Apollo 8.0 guide document). No message watched from Apollo in cyber_monitor, but the sensor data messages from simulator (lgsvl) could be watched in cyber_monitor. Is there any suggestion or clues?

WildBeast114514 commented 1 year ago

cyber_bridge receives the following types of messages from the socket connection, namely OP_REGISTER_DESC, OP_ADD_READER, OP_ADD_WRITER and OP_PUBLISH

According to the log, it looks like the lgsvl simulator has been sending messages of type OP_PUBLISH to cyber_bridge.

Before processing the OP_PUBLISH messages, cyber_bridge need to receive OP_ADD_WRITER messages to add the corresponding writer to the topic.

As the cyber_bridge code has not been changed since 6.0, I wonder if this is only the case in apollo 8.0?

If so, can you provide us with the detailed steps to follow after starting cyber_bridge so that we can further investigate the cause of this situation?

Jeffrey599 commented 1 year ago
  1. I built Apollo with the following command: git clone https://github.com/ApolloAuto/apollo.git cd ~/apollo bash docker/scripts/dev_start.sh bash docker/scripts/dev_into.sh bash apollo.sh build_optgpu

  2. Run Apollo in another terminal cd ~/apollo bash docker/scripts/dev_into.sh bash scripts/bootstrap.sh bash scripts/bootstrap_lgsvl.sh bash scripts/bridge.sh

  3. Run the lgsvl simulator in another terminal and select “Python API" for run

  4. Run the lgsvl Python script to start lgsvl simulator, pls review the following script :

!/usr/bin/env python3

import time from environs import Env import lgsvl

print("Python API Quickstart #22: Connecting to a bridge") env = Env()

sim = lgsvl.Simulator(env.str("LGSVLSIMULATOR_HOST", lgsvl.wise.SimulatorSettings.simulator_host), env.int("LGSVLSIMULATOR_PORT", lgsvl.wise.SimulatorSettings.simulator_port)) if sim.current_scene == lgsvl.wise.DefaultAssets.map_borregasave: sim.reset() else: sim.load(lgsvl.wise.DefaultAssets.map_borregasave)

spawns = sim.get_spawn()

state = lgsvl.AgentState() state.transform = spawns[0] ego = sim.add_agent(env.str("LGSVL__VEHICLE_0", lgsvl.wise.DefaultAssets.ego_lincoln2017mkz_apollo5_full_analysis), lgsvl.AgentType.EGO, state)

print("Bridge connected:", ego.bridge_connected)

ego.connect_bridge(env.str("LGSVL__AUTOPILOT_0_HOST", lgsvl.wise.SimulatorSettings.bridge_host), env.int("LGSVL__AUTOPILOT_0_PORT", lgsvl.wise.SimulatorSettings.bridge_port))

print("Waiting for connection...")

while not ego.bridge_connected: time.sleep(1)

print("Bridge connected:", ego.bridge_connected) print("Running the simulation for 30 seconds")

sim.run(1800)

  1. I got the same result with ”mgcho0608“

Notes: The above steps worked well in Apollo 7.0 and the same lgsvl simulator.