Skip to content

Instantly share code, notes, and snippets.

@techcaotri
Last active January 12, 2021 03:41
Show Gist options
  • Save techcaotri/975a3c1d6d67f7362766255207c9f3de to your computer and use it in GitHub Desktop.
Save techcaotri/975a3c1d6d67f7362766255207c9f3de to your computer and use it in GitHub Desktop.
Build Apollo 2.5 with Perception Visualizer

Requirement

Step 1: Setup Environment

Host Machine:

Docker

Step 2: Build source code:

Modify and remove unused code:

  • Go to file ./modules/perception/obstacle/onboard/visualization_subnode.cc. Remove those lines:

    if (lidar_event_id_ != -1 || fusion_event_id_ != -1) {
        lidar_object_data_ = dynamic_cast<LidarObjectData*>(
            shared_data_manager_->GetSharedData("LidarObjectData"));
        if (lidar_object_data_ == nullptr) {
          AERROR << "Failed to get LidarObjectData.";
          return false;
        }
        AINFO << "Init shared datas successfully, data: "
              << lidar_object_data_->name();
      }
    
    scene_shared_data_ = dynamic_cast<SceneSharedData*>(
         shared_data_manager_->GetSharedData("SceneSharedData"));
    
     if (scene_shared_data_ == nullptr) {
       AERROR << "Failed to get SceneSharedData.";
       return false;
     }
    
    SubnodeHelper::ProduceSharedDataKey(trigger_ts, trigger_device_id,
                                             &data_key_sensor);
    SetLidarContent(data_key_sensor, content, timestamp);
    
    AINFO << "set lidar content";
    SubnodeHelper::ProduceSharedDataKey(trigger_ts, trigger_device_id,
                                               &data_key_sensor);
    SetLidarContent(data_key_sensor, content, timestamp);
    
  • Go to file ./modules/perception/onboard/event_manager.cc. Add those lines below line 94, above queue->pop(event);

    if(queue->size() == 0){
        return true;
    }
    
  • Go to file ./modules/perception/obstacle/camera/visualizer/glfw_fusion_viewer.cc. Add this line above glfwCreateWindow called.

    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
    
  • Go to file ./module/perception/onboard/subnode.cc. Remove those lines:

    if (type_ == DAGConfig::SUBNODE_IN) {
        AINFO << "Subnode == SUBNODE_IN, EXIT THREAD. subnode:" << DebugString();
        return;
    }
    

Build & Run

  • In Docker:

    ./apollo.sh build_opt_gpu
    
  • After build, run bootstrap:

    bootstrap.sh
    
  • Open another terminal tab, get into the docker by using ./docker/script/dev_into.sh. Run rosbag file.

    rosbag play data/bag/demo_2.5.bag -l --clock
    
  • Keep rosbag playing, back to previous tab and launch perception with visulizer:

    ./scripts/perception_offline_visualizer.sh
    
  • The popup below will display: Apollo Perception Visualizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment