Skip to content

1121085292/ultrasonic_detection

Repository files navigation

Ultrasonic Detection

Table of Contents

Introduction

Implement distance measurement and parking spot recognition using ultrasonic based on the Apollo open-source Cyber RT framework.Modules inputs are ultrasonic signals and location information,outputs are obstacal position and parking spots infomation

Architecture

  • Hardware
hardware
  • Software
software

running the code

  1. clone the repository and copy the ultrasonic_detection folder to the apollo-master folder.

  2. install the required third-party libraries by running the following command in the apollo-master folder:

    bash docker/scripts/install_opencv.sh
    bash docker/scripts/install_qt.sh
  3. run the following command in the apollo-master folder:

    bash ultrasonic_detection/run_ultra_perception.sh

    open another terminal and run the following command to start the GUI:

    bash ultrasonic_detection/run_visualizer.sh
  4. open a new terminal and run the following command to start the Cyber RT monitor:

    cyber_monitor
    channels infomation
    channels infomation
    parking spots infomation
    parking spots infomation
  5. use your mouse to choose the target parking spot on the Qt display.And then, you can see the target parking spot's infomation on the cyber_monitor terminal.

    parking spots
    parking spots
    target spot
    target spot

line segment fitting algorithm test

The line segment fitting algorithm is used to boundary fitting. The algorithm introduces the LT(Line Tracking) method into the IEPF(Iterative End-Point Fitting) method to make the line segment extraction method better achieve adaptive fitting and it takes in the boundary points and returns a line segment.The algorithm is implemented in the common/line_segment.h file.You can run the following command to test the line segment fitting algorithm:

bash ultrasonic_detection/test/run_line_segment_test.sh

If you want to test the algorithm with your own data, you can modify the test/fit_line_segment_test.cc file.The test/fit_line_segment_test.cc file uses a listener to subscribe to channel messages to get the boundary points,you can to write a talker node to publish perception/ultrasonic channel message or use other methods to get the boundary points.

listener node
vector<Point2D> points;
auto listener_node = apollo::cyber::CreateNode("points");
auto point_listener = listener_node->CreateReader<UltrasonicList>(
      "perception/ultrasonic", [&points](const std::shared_ptr<UltrasonicList>& ultra){
        for(const auto& obj : ultra->ul_objs()){
          if(obj.orientation() == "FRONT_SIDE_RIGHT"){
            points.emplace_back(Point2D(obj.position_global().x(), obj.position_global().y()));
          }
        }
      });
talker node
auto talker_node = apollo::cyber::CreateNode("points");
auto point_writer = talker_node->CreateWriter<UltrasonicList>("perception/ultrasonic");
auto ultra_msg = std::make_shared<UltrasonicList>();
for(int i = 0; i < 10; i++){
  auto obj = ultra_msg->add_ul_objs();
  obj->set_position_global(Point2D(i, i));
  obj->set_orientation("FRONT_SIDE_RIGHT");
}
point_writer->Write(ultra_msg);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published