-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add getRobotVelocity function and mbf_msgs/ExePathFeedback/actual_vel #189
Conversation
mbf_abstract_nav/include/mbf_abstract_nav/abstract_navigation_server.h
Outdated
Show resolved
Hide resolved
mbf_abstract_nav/include/mbf_abstract_nav/abstract_controller_execution.h
Outdated
Show resolved
Hide resolved
@@ -91,6 +91,7 @@ class ControllerAction : | |||
|
|||
boost::mutex goal_mtx_; ///< lock goal handle for updating it while running | |||
geometry_msgs::PoseStamped robot_pose_; ///< Current robot pose | |||
geometry_msgs::TwistStamped robot_feedback_vel_; //Actual robot velocity feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better robot_vel_; ///< Actual robot velocity feedback
(why feedback?; and use inline docstring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In control field normally call sensor information be a feedback. I am worried that will not be able to clearly indicate the meaning of this robot_vel_ in the program (like cmd_vel or actual velocity). maybe follow the same naming rule call robot_actual_vel_?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use current_pose_
and current_vel_
, as in the ExePath feedback msg, but put both attributes in the RobotInformation class (and move the odom topic there, too, as I explain in the review)
mbf_msgs/action/ExePath.action
Outdated
@@ -57,3 +57,4 @@ float32 dist_to_goal | |||
float32 angle_to_goal | |||
geometry_msgs/PoseStamped current_pose | |||
geometry_msgs/TwistStamped last_cmd_vel # last command calculated by the controller | |||
geometry_msgs/TwistStamped feedback_cmd_vel # robot actual velocity feedback from wheel encoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like feedback
... what about current
? or actual
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about odom_vel_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer odom_vel_ too. but I think ExePath action's feedback is for user to monitor each mobile robot behavior, so maybe follow whole naming rule, call actual_vel_ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current_vel
, and move above last_cmd_vel;
mostly to match current_pose
; both are physical properties:
geometry_msgs/PoseStamped current_pose
geometry_msgs/TwistStamped current_vel # robot actual velocity from the odometry
geometry_msgs/TwistStamped last_cmd_vel # last command calculated by the controller
btw, given this interface change, and according to #191, this change won't be ever released 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jap, this line should be removed here. So we can not change the messages anymore. For noetic I think this will be ok, if we hurry a bit, but not for melodic and before.
Hi @q576333, are you still working on this change? Please rebase master and address the review comments if so. As for the |
Sorry, recently I working hard my master thesis and also this is my first pull requests, so let me to understand how to rebase master, sorry again for keeping you waiting so long. |
/** | ||
* @brief Update the robot actual velocity; | ||
*/ | ||
inline void updateActualRobotVelocity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why inline?
* @brief subscribe odom_topic callback | ||
* @param sub_odometry subscribe data from wheel odometry | ||
*/ | ||
void actualVelCallback(const nav_msgs::Odometry::ConstPtr& sub_odometry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback is for the odom topic, so... should be odometryCallback
@@ -72,6 +72,9 @@ AbstractNavigationServer::AbstractNavigationServer(const TFPtr &tf_listener_ptr) | |||
// init cmd_vel publisher for the robot velocity | |||
vel_pub_ = nh.advertise<geometry_msgs::Twist>("cmd_vel", 1); | |||
|
|||
// init odom_sub_ subscribe for the actual robot velocity | |||
odom_sub_ = nh.subscribe<nav_msgs::Odometry>("odom", 1, &mbf_utility::actualVelCallback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not subscribing on mbf_utility/include/mbf_utility/navigation_utility.h, if the callback is there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need some work.
Moreover, seems clear to me that the odom subscription should be in RobotInformation class. And that it should be updated on demand, so the updateActualRobotVelocity new method is not necessary. But we can let this for a further refactoring.
/** | ||
* @brief update the robot actual velocity. | ||
* @param tf_listener TransformListener. | ||
* @return true, if succeeded, false otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outdated
@@ -57,3 +57,4 @@ float32 dist_to_goal | |||
float32 angle_to_goal | |||
geometry_msgs/PoseStamped current_pose | |||
geometry_msgs/TwistStamped last_cmd_vel # last command calculated by the controller | |||
geometry_msgs/TwistStamped actual_vel # robot actual velocity feedback from wheel encoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont forget to rename this as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jap, this line should be removed here. So we can not change the messages anymore. For noetic I think this will be ok, if we hurry a bit, but not for melodic and before. See #191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the change from the action message for now. I would also prefer to not use the Robot Information. Keep things simple here: Add the subscriber to the AbstractControllerExecution
. This also has a hidden advantage of the namespace and using different odom topics.
Why not concentrating all robot's state-related code on RobotInformation (and keep the executions simple)? We already handled current pose there, so... handling velocity too sounds quite reasonable to me. But maybe we are making poor @q576333 dizzy... we can merge this with just the requested changes and refactor later with whatever we decide. |
But we are just receiving an odom message and hand it over to the plugins, I think it is a bit overkill and it looks hacky from my point of view. Furthermore, considering one mbf instance for multiple robots in the future a separate namespace is beneficial. |
I'll implement this in the next week and open a new PR, then we can decide which one is better. |
I'll address this in another PR. |
I have Implemented getRobotVelocity function in the RobotInformation class and updateActualRobotVelocity function in AbstractControllerExecution class and tested. Let CostmapController plugin interface can get actual robot_velocity in computeVelocityCommands() function.
Also I add new ExePath action feedback variable "feedback_cmd_vel". I think maybe useful for some action client scenario. But I notice this feedback_cmd_vel have timing issue with the computeVelocityCommands() function's robot_velocity.
In addition, There is some warning message when I ctrl + c the move_base_flex terminal. I need everyone help me to check my PR is correct or not?
The warning message is "Warning: class_loader.ClassLoader: SEVERE WARNING!!! Attempting to unload library while objects created by this loader exist in the heap! You should delete your objects before attempting to unload the library or destroying the ClassLoader. The library will NOT be unloaded. at line 108 in /tmp/binarydeb/ros-kinetic-class-loader-0.3.9/src/class_loader.cpp"