ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Best way to add new controller which has a custom path as input

asked 2020-02-19 09:44:02 -0600

madmax gravatar image

If I have a custom controller, like a pure pursuit for example, which has a custom path as input.
How could I add this controller to nav2?

I would like to have it as a plugin to the default controller server but then I need to implement the default interface which has nav_msgs::path as input:

virtual void setPlan(const nav_msgs::msg::Path & path) = 0;

And I have a custom one, say pure_pursuit::path.

So the best idea I have is to create a custom controller server with it's own costmap.
But then I have two copies of the same costmap running...

How would you guys accomplish this?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-02-19 11:14:26 -0600

Carl D gravatar image

Assuming you intend to use the rest of the Nav2 stack, and are just swapping out the controller ...

I'd still implement the pure_pursuit controller as a plugin to the controller server. I'd add the default interface setPlan and just make it convert from nav2_msgs::Path to pure_pursuit::path.

That effectively what the DWB plugin does now. It takes a nav2_msgs::Path and converts it to a nav_2d_msgs::Path2D.

edit flag offensive delete link more

Comments

1

To extend on this, you should at all times avoid nonstandard messages when standard messages exist. If you absolutely must change the message, you should create adaptors.

The Twist, Path, and Navigate actions are atandard and if you deviate you likely lose compatibility with the entire ecosystem (even robot localization, slam, etc).

stevemacenski gravatar image stevemacenski  ( 2020-02-19 12:11:17 -0600 )edit
1

But you are correct that if you cannot create an adaptor inside a plugin or change to the standard types, an option you have is to create a new server, plugin interface, and BT node plugin. I would caution you against this, but it is why we made the servers modular to enable extreme cases to do it. Given a pure pursuit plan sounds alot like a normal plan, I’d think you could take in a normal plan and then change the datatype over to pure pursuit when received like Carl suggests

stevemacenski gravatar image stevemacenski  ( 2020-02-19 12:20:45 -0600 )edit

Thanks for the comments.
I think my problem is, that my path has more information in it, like velocities for example.
And I didn‘t look in the code but I think Path2D is a subset of nav2_msgs::Path and therefore easily convertible. I mean I also could calculate velocities in the controller, but in our system we deploy paths from a central server.

madmax gravatar image madmax  ( 2020-02-19 12:30:02 -0600 )edit
1

Sounds like you may want to be using: http://docs.ros.org/melodic/api/traje... instead.

But anyhow, in order to use the navigation2 default controller server, you need to adhere to our interfaces, or propose a reasonable change to those interfaces to accommodate. You said it may be easily convertible, then why not convert it?

stevemacenski gravatar image stevemacenski  ( 2020-02-19 12:33:59 -0600 )edit

I meant for the DWB it‘s easily convertible. JointTrajectory looks good btw.

madmax gravatar image madmax  ( 2020-02-19 12:38:42 -0600 )edit
1

I think my problem is, that my path has more information in it, like velocities for example.

If you are using the NavFn planner that is part of Nav2, then you don't have any velocity information in the plan and you just need to make it up to use the pure pursuit controller. Maybe the missing information could be a parameter on your controller plugin or something like that.

If you are using some other planner that does provide velocity information, then you will need to modify the planner server, controller server and some of the BT nodes in order to pass that information through the Nav2 stack.

As a hack, you could have your custom planner publish the plan on a topic, and have your custom controller listen on that topic. In that case, the nav_msgs::Path is just passed around but is unused. I don't think ...(more)

Carl D gravatar image Carl D  ( 2020-02-19 13:53:00 -0600 )edit

He's running the planner from a separate central location. I don't think he'll need to do much of that other than the controller server.

stevemacenski gravatar image stevemacenski  ( 2020-02-19 16:24:48 -0600 )edit

Possibility of sharing a costmap would be great. Because now its fixed to a controller server, and I will have two servers with exactly the same costmap. So this could lead to a resource problem reagrding memory/cpu ..

madmax gravatar image madmax  ( 2020-02-20 03:27:49 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2020-02-19 09:44:02 -0600

Seen: 401 times

Last updated: Feb 19 '20