You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The next piece of code checks for compatibility of the plan's frame and the frame the controller is running in. This makes assumptions about the application. Does the user want you to control in the plan's frame, or do they want the controller to convert the plan to the controller's frame? There's no way of knowing.
Keep the the controller (and the entire ROS system) clean by assuming you're running in the standardized frames (map, odom, or maybe utm or something). In this case you're using the frame specified for move_base_flex. If the user wants to be flexible with respect to the reference frames of navigation plans, they should transform any incoming plans to the move_base_flex global frame in a separate rosnode with the isolated functionality of providing this flexible interface.
This clutters the implementation, and makes it harder to understand. I would suggest putting blocks of code like this (debug/visualization) in a separate file, so you can keep the code for actual functionality clean and concise.
6
A cancel request now blocks until the goal is no longer active (which will stay active until the robot has stopped).
This single function is close to 470 lines of code. (Makes you wonder if this is really just a PID controller...) We should at least split this up for readability:
1
Move base flex passes you the odometry at every call of
computeVelocityCommands
, so there is no need for this subscriber:path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Line 70 in 00202b4
2
The next piece of code checks for compatibility of the plan's frame and the frame the controller is running in. This makes assumptions about the application. Does the user want you to control in the plan's frame, or do they want the controller to convert the plan to the controller's frame? There's no way of knowing.
Keep the the controller (and the entire ROS system) clean by assuming you're running in the standardized frames (
map
,odom
, or maybeutm
or something). In this case you're using the frame specified formove_base_flex
. If the user wants to be flexible with respect to the reference frames of navigation plans, they should transform any incoming plans to themove_base_flex
global frame in a separate rosnode with the isolated functionality of providing this flexible interface.path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 96 to 117 in 00202b4
3
In the next piece of code, the
cmd_vel
is set to the controller state:path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 193 to 194 in 00202b4
Why not just use the current odom twist, provided as function argument to the (calling) function?
path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 252 to 265 in 00202b4
4
When a cancel is requested, the controller changes its own parameters
path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 214 to 239 in 00202b4
Why not just set another limit just like in the obstacle handling (just above these lines).
5
This next bit only constructs some visualization markers to publish for debugging purposes, but it takes up a lot of space in the file:
path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 275 to 339 in 00202b4
This clutters the implementation, and makes it harder to understand. I would suggest putting blocks of code like this (debug/visualization) in a separate file, so you can keep the code for actual functionality clean and concise.
6
A cancel request now blocks until the goal is no longer active (which will stay active until the robot has stopped).
path_tracking_pid/src/path_tracking_pid_local_planner.cpp
Lines 620 to 633 in 00202b4
This is not according to design, not sure if this causes any trouble with canceling, but it might. Instead, it should just return
true
immediately because you implemented a stopping behavior, like described here:https://github.com/magazino/move_base_flex/blob/a5c19cb8f3135679e4f8f36a9ec6123b121d69ab/mbf_abstract_nav/src/abstract_controller_execution.cpp#L257-L259
7
This single function is close to 470 lines of code. (Makes you wonder if this is really just a PID controller...) We should at least split this up for readability:
path_tracking_pid/src/controller.cpp
Line 399 in 00202b4
To be continued...
The text was updated successfully, but these errors were encountered: