Apollo: How can I create a ROS node to publish fake perception obstacles to simulate?

Created on 27 Mar 2018  ·  3Comments  ·  Source: ApolloAuto/apollo

Hi, guys.

I'm following Apollo project steps to simulate (with dreamview) some algorithms without vehicle & hardware.

I opened an issue about publishing fake traffic light(#3488) and I could solve the problem.

Q. I also wonder about adding some obstacles in Dreamview.

At that time, @siyangy reply for that

  • You basically just need to fill in the fields to a PerceptionObstacles( proto and call a apollo::common::adapter::AdapterManager::PublishPerceptionObstacles(obstacles).

Because I have not understood about detail code yet, can I get some more information about adding obstacles?

Or I'd like to know that there is any reference.

Simulation & Dreamview Question

Most helpful comment

@CCodie  
you can refer to the code to manually send/switch traffic light info.
modules/tools/manual_traffic_light

As @siyangy pointed out before, it is very similar if you want to manually add an obstacle programmatically.
You need to construct and fill obstacles defined in this proto PerceptionObstacles(https://github.com/ApolloAuto/apollo/blob/master/modules/perception/proto/perception_obstacle.proto) first, and then call
apollo::common::adapter::AdapterManager::PublishPerceptionObstacles(obstacles)
to publish this msg via ROS.
But it may not be easy to manually define an obstacle this way.

Another way is to re-use obstacles in an existing ros bag.
(1) you can "rosbag play" an existing ros bag, and dump perception msg, and "borrow" that data to generate your own obstacle(s) in the above code.
(2) OR you can filter perception msg to generate a new bag, and then "rosbag play" this new bag with perception msg only, so that you can re-use all the obstacles from the ros bag.
But to re-use the obstacles by using an exsiting ros bag, the map used by this ros bag has to be the same one you are going to use.

Hope the information answered your question. If you have any follow up question, please leave a comment below. If we did not hear back from you in 72 hours, we will close the issue and we encourage you to open an new issue if you have any more questions.

Thank you for supporting Apollo!

All 3 comments

@CCodie  
you can refer to the code to manually send/switch traffic light info.
modules/tools/manual_traffic_light

As @siyangy pointed out before, it is very similar if you want to manually add an obstacle programmatically.
You need to construct and fill obstacles defined in this proto PerceptionObstacles(https://github.com/ApolloAuto/apollo/blob/master/modules/perception/proto/perception_obstacle.proto) first, and then call
apollo::common::adapter::AdapterManager::PublishPerceptionObstacles(obstacles)
to publish this msg via ROS.
But it may not be easy to manually define an obstacle this way.

Another way is to re-use obstacles in an existing ros bag.
(1) you can "rosbag play" an existing ros bag, and dump perception msg, and "borrow" that data to generate your own obstacle(s) in the above code.
(2) OR you can filter perception msg to generate a new bag, and then "rosbag play" this new bag with perception msg only, so that you can re-use all the obstacles from the ros bag.
But to re-use the obstacles by using an exsiting ros bag, the map used by this ros bag has to be the same one you are going to use.

Hope the information answered your question. If you have any follow up question, please leave a comment below. If we did not hear back from you in 72 hours, we will close the issue and we encourage you to open an new issue if you have any more questions.

Thank you for supporting Apollo!

I have tried this but I don't get it to work, do someone got a exempel code or something similar? Would be really helpful, thank you!

I also need detailed instruction about how to add obstacle into the dreamview.

Was this page helpful?
0 / 5 - 0 ratings