Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

[WIP] Ros1 conversion #1

Merged
merged 10 commits into from
Aug 9, 2019
Merged

[WIP] Ros1 conversion #1

merged 10 commits into from
Aug 9, 2019

Conversation

cevans87
Copy link

@cevans87 cevans87 commented Feb 7, 2019

DO NOT MERGE.
This pull request is currently incomplete. It is missing

  • Code coverage from 0% -> 80%
  • Documentation updates

Description of changes:

  1. Pulled in master branch of github.com/aws-robotics/cloudwatchlogs-ros1
  2. Made minimal changes to all files related to building and running cloudwatch_logger to support ROS2.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@cevans87 cevans87 changed the title Ros1 conversion [WIP] Ros1 conversion Feb 7, 2019
Copy link

@juanrh juanrh left a comment

Choose a reason for hiding this comment

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

The general approach looks good, but I think some refactoring would be beneficial to improve the testeability of the code, and to avoid to repeat ourselves by moving code to the common package

cloudwatch_logger/include/cloudwatch_logger/log_node.h Outdated Show resolved Hide resolved
cloudwatch_logger/src/log_node.cpp Outdated Show resolved Hide resolved
cloudwatch_logger/src/log_node.cpp Outdated Show resolved Hide resolved
this->min_log_severity_ = min_log_severity;
}

void LogNode::RecordLogs(const rcl_interfaces::msg::Log::SharedPtr log_msg)
Copy link

Choose a reason for hiding this comment

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

This method looks exactly the same as LogNode::RecordLogs in the ROS 1 version, but taking const rcl_interfaces::msg::Log::SharedPt instead of const rosgraph_msgs::Log::ConstPtr &. This code duplication is not very nice, instead we could work on moving this to cloudwatch_logs_common, for example which a simple type to represent logs, and a method RecordLogs that uses a conversion method of function from a ROS message into that log type. We could for example use the template method or the strategy pattern for the conversion function

}
}

void LogNode::TriggerLogPublisher() { this->log_manager_->Service(); }
Copy link

Choose a reason for hiding this comment

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

return log_severity_level >= this->min_log_severity_;
}

const std::string LogNode::FormatLogs(const rcl_interfaces::msg::Log::SharedPtr & log_msg)
Copy link

Choose a reason for hiding this comment

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

This is a slight variant of LogNode::FormatLogs of ROS 1 but we could also arrange the code to avoid repetition in several ways, for example converting to a ROS inpendent ROS type so we can have a single method FormatLogs that works on the conversion of a ROS 1 or ROS 2 message

wiki/images/cpu.svg Outdated Show resolved Hide resolved
wiki/images/memory.svg Outdated Show resolved Hide resolved
constexpr double kNodePublishFrequencyDefaultValue = 5.0;
constexpr bool kNodeSubscribeToRosoutDefaultValue = true;

Aws::AwsError ReadPublishFrequency(
Copy link

Choose a reason for hiding this comment

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

The ROS 1 version of this node also has something similar to this, I personally prefer a param helper like in the Lex node for parameter handling. However Avishay commented once that he thinks that these methods are somewhat redundant, and that are duplicating what the parameter reader does. So I'd check with him to try to avoid this, ideally replacing all the ReadX methods for straightforward usages of ParameterReaderInterface

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to move some of this to the common libs as the params are specific to the client config. It would be nice to break out non-AWS config components and maybe we can avoid code duplication between each implementation.

cloudwatch_logger/src/log_client.cpp Outdated Show resolved Hide resolved
@ross-desmond
Copy link

@juanrh has done a fantastic job summarizing changes that should be done before this goes into master. Since this PR is in an org public branch, let's keep this PR open and revisit it when re prioritizing.

Copy link
Contributor

@dabonnie dabonnie left a comment

Choose a reason for hiding this comment

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

I don't see any obvious issues, especially if it's working well.

@mm318
Copy link
Contributor

mm318 commented Aug 8, 2019

Unfortunately, this is not working at all right now because of ros2/rmw_fastrtps#265. I have not yet succeeded in getting the workaround (__log_disable_rosout:=true) to work either.

Copy link

@nburek nburek left a comment

Choose a reason for hiding this comment

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

Haven't made it through everything yet, but here are some initial comments.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated
Send logs in a ROS system to AWS CloudWatch Logs service.

#### Subscribed Topics
- **`/rosout_agg`**
Copy link

Choose a reason for hiding this comment

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

Outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the /other_topics part actually presenting correct information?

Copy link

Choose a reason for hiding this comment

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

The way it's presented seems a bit odd, but it does have the ability to subscribe to whatever topics you define in the list in your config file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's saying all topics named /cloudwatch_logger/* are implicitly subscribed to. Is this information correct, @dabonnie?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's saying all topics named /cloudwatch_logger/* are implicitly subscribed to. Is this information correct, @dabonnie?

If I read this (https://github.com/aws-robotics/cloudwatchlogs-ros1), it doesn't appear to match what you're saying.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then explain to me what the sentence "The cloudwatch_logger subscribes to other topics if the parameter server has the topic names in cloudwatch_logger namespace" means.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, don't bother explaining, just say if that sentence presents correct information or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the answer and would have to dig into ROS2 logging (https://index.ros.org/doc/ros2/Concepts/Logging/). Not sure if this is what @nburek was referencing when mentioning outdated.

As part of porting the application you might want to verify that the behavior detailed in the ROS1 README matches this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if it applies to ROS1 logging? Because that sentence is from the ROS1 CloudWatch Logs README.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, if you look at the "topics" config param and the ReadSubscriberList method, the doc appears to be accurate.

cloudwatch_logger/CMakeLists.txt Outdated Show resolved Hide resolved
cloudwatch_logger/CMakeLists.txt Outdated Show resolved Hide resolved
from launch_ros.actions import Node


def generate_launch_description():
Copy link

Choose a reason for hiding this comment

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

The ros1 CE had a lot more in its launch file that was meant as a way to provide automated integration with RoboMaker (such as detecting environment variables and such). Is this not possible in ROS2 launch files or did we decide not to support that anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

@AAlon, can you comment on this?

cloudwatch_logger/CMakeLists.txt Show resolved Hide resolved

bool LogNode::checkIfOnline(std_srvs::srv::Trigger::Request & request, std_srvs::srv::Trigger::Response & response)
{
// AWS_LOGSTREAM_DEBUG(__func__, "received request " << request);
Copy link
Contributor

Choose a reason for hiding this comment

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

why commented out?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's no operator<<() for std_srvs::srv::Trigger::Request for some reason.

cloudwatch_logger/src/log_node.cpp Outdated Show resolved Hide resolved
ss << log_msg->level << " ";
}
ss << "[node name: " << log_msg->name << "] ";

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this missing the topics section from the ROS1 code?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not available in rcl_interfaces::msg::Log.

Signed-off-by: Miaofei <[email protected]>
@mm318 mm318 merged commit 8323a52 into master Aug 9, 2019
@timrobotson timrobotson deleted the ros1-conversion branch August 12, 2019 22:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants