Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to run simulator along with apollo #15

Closed
ImCabbage opened this issue Oct 17, 2018 · 17 comments
Closed

how to run simulator along with apollo #15

ImCabbage opened this issue Oct 17, 2018 · 17 comments

Comments

@ImCabbage
Copy link

I am a developer working with Apollo recently. I would like to know is there any tutorial on how to run the Apollo and this simulator together.

  1. How to deal with the map problem?
  2. Is there any way to adjust the camera angle?
  3. How to run them simultaneously?
  4. How to run multiple cars?

I think it would be better if there is a tutorial on that.
Thanks for your work. This project is interesting. :)

@andytolst
Copy link
Contributor

@ImCabbage we are in process of open-sourcing the instructions, stay tuned.

  1. How to deal with the map problem?
    we'll provide the map of our virtual San Francisco in the Apollo protobuf format. There is also a tool to annotate and export the map in the Unity project (see Assets/Scripts/HDMapTool.cs)
    Point cloud maps for msf localization can be done using lidar - rosbag - scripts/msf_simple_map_creator.sh in Apollo

  2. Is there any way to adjust the camera angle?
    Look at Prefabs/RobotCandidates/XE_Rigged-apollo.prefab it has 2 cameras for Apollo:
    CaptureCamera and TelephotoCamera

  3. How to run them simultaneously?
    We will provide the exact instructions and (most probaly) pre-built Apollo docker container

  4. How to run multiple cars?
    You can run other cars by ticking "Enable traffic" checkbox.
    Running multiple ego cars (controlled by Apollo) is in our plan and will be supported in future

@yangydavid
Copy link

Hi,

What time are you guys planning release the Apollo's instructions?

Thanks!

@andytolst
Copy link
Contributor

should be done by the end of next week

@andytolst
Copy link
Contributor

@ImCabbage @yangydavid see Apollo instructions here: https://github.com/lgsvl/apollo

@ImCabbage
Copy link
Author

@andytolst
Thanks for your instruction. It is helpful and I have successfully run Apollo along with the simulator. But I met a localization problem. I found when the localization module is on, the position of the vehicle is totally different in the simulator and dreamviewer. Is there any other configuration in the localization module? I think I do not have to open the sim-control option in the dreamviewer, right?

@andytolst
Copy link
Contributor

@ImCabbage can you attach a screenshot of incorrect position ? do you see the map of SF in the dreamview ?

make sure localization is in RTK mode:

$ cat modules/localization/conf/localization_config.pb.txt 
localization_type: RTK

make sure you have localization module running in Apollo.
make sure you selected "San Francisco" map in dreamview
make sure you enabled IMU and GPS sensors in Simulator and rosbridge is running:

rostopic echo /apollo/sensor/gnss/best_pose

---
header {
  timestamp_sec: 1224022974.02
  sequence_num: 21578
}
measurement_time: 1224022974.02
sol_status: SOL_COMPUTED
sol_type: NARROW_INT
latitude: 37.7908574786
longitude: -122.399391029
height_msl: 0.0
undulation: 0.0
datum_id: WGS84
latitude_std_dev: 0.00999999977648
longitude_std_dev: 0.00999999977648
height_std_dev: 0.00999999977648
base_station_id: "0"
differential_age: 2.0
solution_age: 0.0
num_sats_tracked: 15
num_sats_in_solution: 15
num_sats_l1: 15
num_sats_multi: 12
extended_solution_status: 33
galileo_beidou_used_mask: 0
gps_glonass_used_mask: 51

@ImCabbage
Copy link
Author

@andytolst
Thanks for your info. I think the problem is still unsolved. Let me explain my situation in detail. I may help solve the problem.

I follow the tutorial in your official Youtube channel along with the README file in the forked Apollo repo. According to my experience with the Apollo platform, I think I do it right and successfully get the topic "/apollo/sensor/gnss/best_pose", just like what you post above (RTK mode in localization for sure). But the map seems not loaded when I start the localization module (sim_control closed). What I saw is all black background. I got two feedback from the Dreamview panel.

  1. Hardware GPS triggers safety mode: No GNSS status message.
  2. Failed to load default POI. Please make sure the file exists at /apollo/modules/map/data/san_francisco/default_end_way_point.txt

I am not sure whether the second info will affect. As I know, the default_end_way_point.txt file is generated through the lane.csv. But it seems that this file is indeed missing.

When I open the sim_control option, I am able to see the map in the dreamview. I have a screenshot of what I met when this option is on, sadly, uploading pictures in issues is unavailable. If you could give a mail address or something, I think I can email you the pics. But still, the car is not in the right position. In dreamview, the vehicle always starts at the bottom right corner wherever it is in the simulator. I think it's the default start point for the map in Apollo.

BTW, sometimes I got error info when I start the rosbridge launch file, recorded as below:

the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
/use_sim_time is not set, will not subscribe to simulated time [/clock] topic
/apollo/ros_pkgs/src/rosbridge_suite/rosbridge_server/scripts/rosbridge_websocket:218 () [INFO] [1540261198.005100]: Rosbridge WebSocket server started on port 9090
/apollo/ros_pkgs/src/rosbridge_suite/rosbridge_server/src/rosbridge_server/websocket_handler.py:77 open() [INFO] [1540261198.010214]: Client connected. 1 clients total.
the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
/apollo/ros_pkgs/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py:383 log() [INFO] [1540261199.806602]: [Client 0] Subscribed to /apollo/control
/apollo/ros_pkgs/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py:379 log() [ERROR] [1540261200.237110]: [Client 0] publish: integer out of range for 'I' format code

@hadiTab
Copy link
Contributor

hadiTab commented Oct 23, 2018

@ImCabbage, the two feedback messages you are seeing in dreamview are ok. The GPS message will appear because Apollo is not able to communicate with the GPS driver (which is not used with the simulator). The default POI is related to routing but should not affect localization.

The sim_control mode should not be used with the simulator. That mode allows apollo to simulate driving at a high level on the HD map without any sensor data.

Since it seems like you are having issues with rosbridge, I suspect that the GPS messages are not going through which would cause localization issues.

To confirm, please try echoing the GNSS topic inside docker:
rostopic echo /apollo/sensor/gnss/best_pose

This should print the GNSS messages on the screen. I suspect that this will not happen.

Did you have any errors when building ros_pkgs?
I will look into the error message you have posted. In the meantime you can try rebuilding ros_pkgs to make sure it was built properly.

To rebuild, first delete the build and devel folders located in /apollo/ros_pkgs/.
Then (from within the docker container) run catkin_make. Make sure that there are no build errors.

@andytolst
Copy link
Contributor

@ImCabbage please make sure you are using the latest code of the simulator (we changed GPS origin a week ago and it has to be in sync with Apollo)
also make sure Apollo is in "Standard" mode, not in "Navigation"
please also post the exact contents of /apollo/sensor/gnss/best_pose so we can check latitude / longitude

@yangydavid
Copy link

@andytolst Hi, thanks so much for the released instruction, it is very helpful and i am able to run the simulator with Apollo now. However, when I try to start the dreamview with ./script/bootstrap.sh, I always failed and the error shows that unix://tmp/supervisor.sock refused connection. Have you ever met such issues before? Do you have any hints on it? Thanks so much!

@andytolst
Copy link
Contributor

@yangydavid
Copy link

@andytolst Thanks! I solve the issue following the suggestions there.

@yangydavid
Copy link

@andytolst one more question I have is that the simulator runs very slow, and I use top command and found that ~90% cpu were used, I'm wondering if there's any trick to boost it?

@andytolst
Copy link
Contributor

@yangydavid it depends on your HW config, good CPU and graphics card usually help

  • try to reduce the resolution of the simulator (especially if you are running it on 4k monitor) and run it in 'windowed' mode
  • disable Lidar if you don't need it (it consumes the most of CPU time, should be improved in future releases)
  • if you are running on Linux - install the latest Nvidia drivers (I guess this is done already)
  • if nothing helps - try to running it on separate machine with Windows

@yangydavid
Copy link

@andytolst
Thanks for your comments!

@ImCabbage
Copy link
Author

@andytolst @hadiTab
Thanks for your help. My problem is finally solved when I clone the simulator repo again. I think @andytolst mentioned it right.

@hadiTab
Copy link
Contributor

hadiTab commented Oct 25, 2018

I'm closing this issue since it seems to be resolved for everyone. Feel free to reopen it if needed.

@hadiTab hadiTab closed this as completed Oct 25, 2018
lokesku pushed a commit that referenced this issue Oct 2, 2021
* when rebuilding CubeTown many times in the same workspace I always get segfault like:

  19:06:26  Launched and connected shader compiler UnityShaderCompiler after 0.03 seconds
  19:06:44  Caught fatal signal - signo:11 code:1 errno:0 addr:0xd0000000e
  19:06:44  Obtained 25 stack frames.
  19:06:44  #0  0x007f72a328a3c0 in funlockfile
  19:06:44  #1  0x007f72a3141c5b in memcpy
  19:06:44  #2  0x007f71edcabf64 in vk_optimusGetDeviceProcAddr
  19:06:44  #3  0x0056107c6dad75 in vk::TaskExecutor::HandleCommandStream(GrowableBuffer*, VkCommandBuffer_T*)
  19:06:44  #4  0x0056107c6d9fe6 in vk::TaskExecutor::ExecuteCommandbuffers(vk::CommandBuffer**, int)
  19:06:44  #5  0x0056107c6d6c33 in vk::TaskExecutor::DoFlush(VkFence_T*, VkSemaphore_T*, unsigned long)
  19:06:44  #6  0x0056107c6a3e07 in GfxDeviceVK::SubmitCurrentCommandBuffers(VkSemaphore_T*)
  19:06:44  #7  0x0056107c6a5721 in GfxDeviceVK::FinishRendering()
  19:06:44  #8  0x0056107c61f4dd in GfxDeviceClient::FinishRendering()
  19:06:44  #9  0x0056107bf9b506 in AssetHotreload()
  19:06:44  #10 0x0056107f0fb8ff in AssetHotreload(core::hash_set<UnityGUID, core::hash<UnityGUID>, std::equal_to<UnityGUID> > const&)
  19:06:44  #11 0x0056107f1964e7 in RefreshInternalV2(AssetDatabase::UpdateAssetOptions, ScanFilter const&, InternalRefreshFlagsV2)
  19:06:44  #12 0x0056107f180712 in StopAssetImportingV2(AssetDatabase::UpdateAssetOptions, InternalRefreshFlagsV2, ScanFilter const*)
  19:06:44  #13 0x0056107f180cb1 in RefreshV2(AssetDatabase::UpdateAssetOptions)
  19:06:44  #14 0x0056107f0e5181 in AssetDatabase::Refresh(AssetDatabase::UpdateAssetOptions)
  19:06:44  #15 0x0056107e4fdeb3 in Application::InitializeProject()
  19:06:44  #16 0x0056107f03e606 in InitializeUnity(void*)
  19:06:44  #17 0x007f72a39c3be8 in g_source_get_time
  19:06:44  #18 0x007f72a39c304e in g_main_context_dispatch
  19:06:44  #19 0x007f72a39c3400 in g_main_context_dispatch
  19:06:44  #20 0x007f72a39c36f3 in g_main_loop_run
  19:06:44  #21 0x007f72a405837d in gtk_main
  19:06:44  #22 0x0056107f03dfce in main
  19:06:44  #23 0x007f72a30aa0b3 in __libc_start_main
  19:06:44  #24 0x0056107bd72029 in _start
  19:06:44  /usr/bin/unity-editor: line 11:    11 Segmentation fault      (core dumped) /opt/unity/Editor/Unity "$@"

  when building in workspace with empty "Library" directory and re-running
  it in the same workspace 2nd time (keeping "Library") finishes OK

  Rerun each bundle build upto 3 times before giving up and showing an error.

  Show summary at the end to easily find if some bundles still need to be
  re-triggered or fixed.

* re-try the initial "fetch license" as well as it was sometimes failing
  there already (before starting any bundle build)

* we do something similar in build-simulator.sh already, for "check" function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants