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

fuse -> ROS 2 : Port Logging #279

Merged
merged 6 commits into from
Nov 3, 2022

Conversation

methylDragon
Copy link
Collaborator

@methylDragon methylDragon commented Oct 8, 2022

See: #276

This PR ports logging calls to RCLCPP across the entire stack.

Note that it won't compile since only logging's been ported (and that requires ROS 2 constructs like node pointers, which have yet to be integrated.)

Additionally, the delayed throttle filter was ported to use std::chrono to separate its functionality from ROS. (Also because ROS doesn't support negative time (: )

It's recommended to take a look at how the logging calls have been ported: 3581bd7
I also left behind comments for future edits (mostly porting node handles -> nodes)

PS: Would a std::chrono::steady_clock be preferable for the console throttler? It's a bit of a roundabout to be using it if yes, so if it's not critical I'd continue using system_clock.

Also pinging @svwilliams for visibility.

@methylDragon methylDragon force-pushed the rolling-logging branch 3 times, most recently from df05a41 to 3581bd7 Compare October 8, 2022 01:15
@methylDragon methylDragon force-pushed the rolling-logging branch 2 times, most recently from a75269b to e65f256 Compare October 12, 2022 01:01
@methylDragon methylDragon changed the base branch from rolling to rolling-fuse_core-common October 12, 2022 01:03
@@ -135,6 +136,7 @@ class AsyncPublisher : public Publisher
protected:
ros::CallbackQueue callback_queue_; //!< The local callback queue used for all subscriptions
std::string name_; //!< The unique name for this publisher instance
// rclcpp::Node::SharedPtr node_; //!< The node for this publisher (TODO(CH3): Uncomment when it's time)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might end up being a shared pointer to the NodeTopicsInterface , so that lifecycle nodes can be used too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment updated 771e4f4

Pending merge of ros2/rclcpp#2041 , but if we expect that to take too long I can duplicate an implementation in fuse_core...

Copy link
Collaborator Author

@methylDragon methylDragon Nov 3, 2022

Choose a reason for hiding this comment

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

Reverting the comment update since it turns out we do have to store a SharedPtr to a node after all (for now at least)
e9a0a40

@@ -190,7 +190,7 @@ CERES_OPTION_STRING_DEFINITIONS(VisibilityClusteringType)
* @param[in] default_value - A default value to use if the provided parameter name does not exist
* @return The loaded (or default) value
*/
template <class T>
template <class T> // TODO(CH3): Replace nh with a node
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd recommend it takes a NodeLoggingInterface and NodeParamsInterface with another convenience method that gets those off of "Node like" objects. That will allow it to work with Lifecycle nodes too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment updated 771e4f4

Pending merge of ros2/rclcpp#2041 , but if we expect that to take too long I can duplicate an implementation in fuse_core...

Copy link
Collaborator Author

@methylDragon methylDragon Nov 3, 2022

Choose a reason for hiding this comment

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

Reverting the comment update since it turns out we do have to store a SharedPtr to a node after all (for now at least)
e9a0a40

@@ -70,7 +70,7 @@ struct Odometry2DPublisherParams : public ParameterBase
*
* @param[in] nh - The ROS node handle with which to load parameters
*/
void loadFromROS(const ros::NodeHandle& nh) final
void loadFromROS(const ros::NodeHandle& nh) final // TODO(CH3): Replace with a NodePtr
Copy link
Collaborator

Choose a reason for hiding this comment

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

NodeParamsInterface probably

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment updated 771e4f4

Pending merge of ros2/rclcpp#2041 , but if we expect that to take too long I can duplicate an implementation in fuse_core...

Copy link
Collaborator Author

@methylDragon methylDragon Nov 3, 2022

Choose a reason for hiding this comment

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

Reverting the comment update since it turns out we do have to store a SharedPtr to a node after all (for now at least)
e9a0a40

@@ -84,12 +85,14 @@ bool findPose(
}
catch (const std::exception& e)
{
ROS_WARN_STREAM_THROTTLE(10.0, "Failed to find a pose at time " << stamp << ". Error" << e.what());
RCLCPP_WARN_STREAM_THROTTLE(rclcpp::get_logger("pose_2d_publisher"), rclcpp::Clock(), 10.0 * 1000,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any places where we don't have a logger, I'd recommend using the package name as the logger name. I think that will make it easier for users to know where messages are coming from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ayrton04 and others added 3 commits November 1, 2022 17:32
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
@methylDragon methylDragon changed the base branch from rolling-fuse_core-common to rolling November 3, 2022 19:36
Signed-off-by: methylDragon <methylDragon@gmail.com>
Copy link
Collaborator

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

Approving knowing the changes won't build yet, but are necessary in the long run.

@methylDragon methylDragon merged commit 3c488a2 into locusrobotics:rolling Nov 3, 2022
@methylDragon methylDragon deleted the rolling-logging branch November 3, 2022 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants