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

Add getRobotVelocity function and mbf_msgs/ExePathFeedback/actual_vel #189

Closed
wants to merge 1 commit into from

Conversation

q576333
Copy link

@q576333 q576333 commented Apr 24, 2020

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"

mbf_abstract_nav/src/abstract_navigation_server.cpp 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
Copy link
Collaborator

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)

Copy link
Author

@q576333 q576333 May 22, 2020

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_?

Copy link
Collaborator

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)

@@ -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
Copy link
Collaborator

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about odom_vel_?

Copy link
Author

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_ ?

Copy link
Collaborator

@corot corot Jun 10, 2020

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 😞

Copy link
Member

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.

mbf_utility/include/mbf_utility/navigation_utility.h Outdated Show resolved Hide resolved
mbf_utility/src/navigation_utility.cpp Outdated Show resolved Hide resolved
@spuetz spuetz self-assigned this Apr 30, 2020
@corot
Copy link
Collaborator

corot commented May 12, 2020

Hi @q576333, are you still working on this change? Please rebase master and address the review comments if so.

As for the Warning: class_loader.ClassLoader, don't worry, it always happen when using plugins in ROS, not only on MBF.

@q576333
Copy link
Author

q576333 commented May 22, 2020

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.

@q576333 q576333 changed the title Add getRobotVelocity function and mbf_msgs/ExePathFeedback/feedback_cmd_vel Add getRobotVelocity function and mbf_msgs/ExePathFeedback/actual_vel May 26, 2020
@q576333 q576333 requested a review from corot June 10, 2020 08:24
/**
* @brief Update the robot actual velocity;
*/
inline void updateActualRobotVelocity();
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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?

Copy link
Collaborator

@corot corot left a 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.
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Member

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

Copy link
Member

@spuetz spuetz left a 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.

@corot
Copy link
Collaborator

corot commented Jun 12, 2020

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.

@spuetz
Copy link
Member

spuetz commented Jun 12, 2020

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.

@spuetz
Copy link
Member

spuetz commented Jun 12, 2020

I'll implement this in the next week and open a new PR, then we can decide which one is better.

@spuetz
Copy link
Member

spuetz commented Nov 5, 2020

I'll address this in another PR.

@spuetz spuetz closed this Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants