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 use/modify/implement new algorithm in planning module? #3462

Closed
lesun90 opened this issue Mar 18, 2018 · 15 comments
Closed

How to use/modify/implement new algorithm in planning module? #3462

lesun90 opened this issue Mar 18, 2018 · 15 comments
Assignees
Labels
Module: Planning Indicates planning module related issue Type: Question Indicates that an issue or pull request needs more information

Comments

@lesun90
Copy link

lesun90 commented Mar 18, 2018

Hi,

I want to implement a new planner algorithm, I am still new to Apollo, right now, I just want to know how the framework work.
I have several questions about using the planning module in Apollo.

  1. When running the demo (demo.bad and demo_2.bag), the log data recorded that routing not ready; skip the planning cycle. in planning.cc and Routing is not ready. in reference_line_provider.cc . I do turn on the planner and routing modules in the Module Controller, but the routing module keeps turning off.
    If it skips the planning cycle why the car still seems to have a planner line to follow in the DreamView visualization, can you explain what happens here?

  2. How to use RTK planner? I change the planning_config.proto but it still uses the EM planner.

Thank you.

@lianglia-apollo
Copy link
Contributor

You can implement a new planner (modules/planning/planner/planner.h) for your new algorithm.

@lesun90
Copy link
Author

lesun90 commented Mar 19, 2018

That not really what I looking for. Right now I just want to play around/modify the existing Planners, but it seems they do not work and I don't know why.
Like I said, in the log file planning.INFO, the output is routing not ready; skip the planning cycle. the EMPlanner only goto the Init() function, the plan() function is never called.
And if the planning cycle is skipped, why the car still shows the planning line in the dreaming view.

Can you explain/tell me what wrong here?

Thank you.

@lianglia-apollo
Copy link
Contributor

"Like I said, in the log file planning.INFO, the output is routing not ready; skip the planning cycle. the EMPlanner only goto the Init() function, the plan() function is never called."
--- Please make sure you published a routing for the planning. You can rosecho the routing topic to validate it is correct.

"And if the planning cycle is skipped, why the car still shows the planning line in the dreaming view."
--- Since the planning results were recorded in the rosbag, you will observe the trajectory by just playing the bag. You can filter the /apollo/planning topic from the rosbag in order to test your own planning.

@lesun90
Copy link
Author

lesun90 commented Mar 19, 2018

thank you for your reply.
--- Please make sure you published a routing for the planning. You can rosecho the routing topic to validate it is correct.
rostopic echo /apollo/routing_response /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
This what I get when echo the routing

@lianglia-apollo
Copy link
Contributor

Did you generate a routing? Only turning on the routing module will not generate one.

After you filtered the planning in the rosbag and started your own planning, you can click Default Routing in the Dreaview to generate a routing message.

@lesun90
Copy link
Author

lesun90 commented Mar 20, 2018

Thank you for being patient with me. I really appreciate your support.

This is what I done so far:
#filter the planning module
rosbag filter ./docs/demo_guide/demo_2.0.bag ./docs/demo_guide/demonew.bag "topic== '/apollo/planning'"
#run the new bag
rosbag play -l ./docs/demo_guide/demonew.bag

But in the Dreamview, nothing shows, the Default Routing button is grey out, could not select.
screenshot from 2018-03-19 20-49-46

After you filtered the planning in the rosbag and started your own planning, you can click Default Routing in the Dreamview to generate a routing message

How to start planning module?

Do you have any tutorial on start a 'helloworld' project where it shows how to start a project like making a car follow points?

Once again, thank for your support.

@lianglia-apollo
Copy link
Contributor

lianglia-apollo commented Mar 20, 2018

I think the filter should be "topic != '/apollo/planning'" (not == ). The topic will be kept if it the expression is true.

To start planning module, please (1) build the project you have modified (using bash apollo.sh build) (2) run the planning binary in a separate terminal (using bash scripts/planning.sh), or just turn on the planning from dreamview.

@lesun90
Copy link
Author

lesun90 commented Mar 22, 2018

I follow all your suggestion, but still not works.
Here is what I did, please tell me what I did wrong:

rosbag filter ./docs/demo_guide/demo_2.0.bag ./docs/demo_guide/new.bag "topic!= '/apollo/planning'"
rosbag play ./docs/demo_guide/new.bag

in new terminal:
bash scripts/planning.sh

In the Dreamview:
screenshot from 2018-03-21 23-50-53

And the log file for planning.INFO

I0321 23:35:00.377490 7123 em_planner.cc:78] In EMPlanner::Init()
I0321 23:35:00.377511 7123 em_planner.cc:83] Created task:DpPolyPathOptimizer
I0321 23:35:00.377516 7123 em_planner.cc:83] Created task:PathDecider
I0321 23:35:00.377523 7123 em_planner.cc:83] Created task:DpStSpeedOptimizer
I0321 23:35:00.377526 7123 em_planner.cc:83] Created task:SpeedDecider
I0321 23:35:00.377557 7123 em_planner.cc:83] Created task:QpSplineStSpeedOptimizer
I0321 23:35:00.377671 7123 planning.cc:144] Planning started
E0321 23:35:00.427840 7219 reference_line_provider.cc:184] Routing is not ready.
E0321 23:35:00.478001 7219 reference_line_provider.cc:184] Routing is not ready.
E0321 23:35:00.478160 7123 planning.cc:209] localization not ready; skip the planning cycle.
E0321 23:35:00.528249 7219 reference_line_provider.cc:184] Routing is not ready.
E0321 23:35:00.578413 7219 reference_line_provider.cc:184] Routing is not ready.
E0321 23:35:00.578434 7123 planning.cc:209] localization not ready; skip the planning cycle.
.....

Another question, how to switch to another planner. I search around and see someone mention to make a change in the planning.proto to switch planner. I did but it seems do not work.

Before

optional PlannerType planner_type = 1 [default = EM];

After

optional PlannerType planner_type = 1 [default = RTK];

I also try to change " planner_type = 0" but it give a build error

modules/planning/proto/planning_config.proto:36:39: Field numbers must be positive integers.

I also did try to change RTK = 5, and planner_type = 5, but it not work either.

Thank you for your support and being patient with me.

@jinghaomiao jinghaomiao added Type: Question Indicates that an issue or pull request needs more information Module: Planning Indicates planning module related issue labels Mar 22, 2018
@lianglia-apollo
Copy link
Contributor

Which routing did you choose? I tested "Route: sunnyvale loop" and it works.

@lesun90
Copy link
Author

lesun90 commented Mar 24, 2018

I figure it out, has to choose the "Route: sunnyvale loop reverse", only that I can see the route (red line).
Can you answer my question of how to switch to another planner, right now the code only call the EM planner.

Another question:
How do I test my own planning algorithm? I want to make the car follow path generated by my planner, but it seems that even if I turn off the planner module, it still just follow what is recorded in the bag.

@lianglia-apollo
Copy link
Contributor

lianglia-apollo commented Mar 26, 2018

--- to change to another planner, please (1) add your planner name in planning_config.proto (line 31 - 35); (2) define the config of your own planner in planning_config.proto (after line 29); (3) change "planner_type : EM" to the one you have in planning_config.pb.txt.

--- Because the car in the rosbag has position info pre-recorded, it cannot follow your planning trajectory. If you want to make the car follow a generated path, you need to turn on the "SimControl" button (tasks->others) in the dreamview. Under the sim-control mode, the dreamview will receive the planning trajectory and help to move the car for you to mimic the driving process.

@lesun90
Copy link
Author

lesun90 commented Mar 30, 2018

thank. I got all i need now.

@lesun90 lesun90 closed this as completed Mar 30, 2018
@freeyyc
Copy link

freeyyc commented Oct 11, 2018

choose the "Route: sunnyvale loop reverse"

How to choose the "Route: sunnyvale loop reverse"?

@marcusvinicius178
Copy link

Hi @lianglia-apollo I read you know how to add or switch to a new planner. I am using Apollo 6.0 now. And I tried to change the planner from ROAD_PUBLIC to LATTICE defined in the planning_config.pb.txt as you and this post #13650 suggested:

image

However the planner did not work. I mean the planning module is disabled on dreamview when I turn it on, as you can check here:
https://www.youtube.com/watch?v=bApS6gzyo7s&list=PL_d_YiRmUA3nnTRmF8QJKyPoEQhrdvpP2&index=3&t=253s

Then after this I also attempt to change the code below from file planning_config.proto:

image

I changed from 1 (Public_Road planner type) to 3 (Lattice planner) and compiled the workspace again with success.
However the planning module keeps being disabled.

What am I doing wrong? Is it possible to swich Apollo 6.0 planners?
I wish to do a test one by one of them (NAVI, ROAD_PUBLIC, LATTICE, OPEN_SPACE) to include in my master thesis:
#13763

Could you please provide a step-by-step to how to change the planners? Which files I need to modify the code and which lines?

Thanks a lot for some reply!

@marcusvinicius178
Copy link

Hi @lianglia-apollo could you kindly say me how to define the LATTICE planner config (just an example). It seems that this is the code missing for me enable/ change for the Lattice Planner.

I have done a lot of attempts to change the planner. Please take a look:
#13828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Planning Indicates planning module related issue Type: Question Indicates that an issue or pull request needs more information
Projects
None yet
Development

No branches or pull requests

5 participants