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

Ros2 Diagnostics - Fix for Frame_id naming #640

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "depthai-shared/common/CameraBoardSocket.hpp"
#include "depthai/pipeline/Node.hpp"
#include "depthai_ros_driver/param_handlers/camera_param_handler.hpp"
#include "depthai_ros_driver/utils.hpp"
#include "rclcpp/logger.hpp"

Expand Down Expand Up @@ -99,6 +100,8 @@ class BaseNode {
std::string baseDAINodeName;
bool intraProcessEnabled;
rclcpp::Logger logger;

std::unique_ptr<param_handlers::CameraParamHandler> ph;
};
} // namespace dai_nodes
} // namespace depthai_ros_driver
5 changes: 5 additions & 0 deletions depthai_ros_driver/src/dai_nodes/base_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace dai_nodes {
BaseNode::BaseNode(const std::string& daiNodeName, std::shared_ptr<rclcpp::Node> node, std::shared_ptr<dai::Pipeline> /*pipeline*/)
: baseNode(node), baseDAINodeName(daiNodeName), logger(node->get_logger()) {
intraProcessEnabled = node->get_node_options().use_intra_process_comms();
ph = std::make_unique<param_handlers::CameraParamHandler>(baseNode, "camera");
};
BaseNode::~BaseNode() = default;
void BaseNode::setNodeName(const std::string& daiNodeName) {
Expand Down Expand Up @@ -46,6 +47,10 @@ std::string BaseNode::getSocketName(dai::CameraBoardSocket socket) {
}

std::string BaseNode::getTFPrefix(const std::string& frameName) {
if(ph->getParam<bool>("i_publish_tf_from_calibration")) {
return ph->getParam<std::string>("i_tf_base_frame") + "_" + frameName;
}

return std::string(getROSNode()->get_name()) + "_" + frameName;
}

Expand Down
17 changes: 16 additions & 1 deletion depthai_ros_driver/src/dai_nodes/sys_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,22 @@ void SysLogger::produceDiagnostics(diagnostic_updater::DiagnosticStatusWrapper&
auto logData = loggerQ->get<dai::SystemInformation>(std::chrono::seconds(5), timeout);
if(!timeout) {
stat.summary(diagnostic_msgs::msg::DiagnosticStatus::OK, "System Information");
stat.add("System Information", sysInfoToString(*logData));
const dai::SystemInformation& sysInfo = *logData;
stat.add("Leon CSS CPU Usage", sysInfo.leonCssCpuUsage.average * 100);
stat.add("Leon MSS CPU Usage", sysInfo.leonMssCpuUsage.average * 100);
stat.add("Ddr Memory Usage", sysInfo.ddrMemoryUsage.used / (1024.0f * 1024.0f));
stat.add("Ddr Memory Total", sysInfo.ddrMemoryUsage.total / (1024.0f * 1024.0f));
stat.add("Cmx Memory Usage", sysInfo.cmxMemoryUsage.used / (1024.0f * 1024.0f));
stat.add("Cmx Memory Total", sysInfo.cmxMemoryUsage.total);
stat.add("Leon CSS Memory Usage", sysInfo.leonCssMemoryUsage.used / (1024.0f * 1024.0f));
stat.add("Leon CSS Memory Total", sysInfo.leonCssMemoryUsage.total / (1024.0f * 1024.0f));
stat.add("Leon MSS Memory Usage", sysInfo.leonMssMemoryUsage.used / (1024.0f * 1024.0f));
stat.add("Leon MSS Memory Total", sysInfo.leonMssMemoryUsage.total / (1024.0f * 1024.0f));
stat.add("Average Chip Temperature", sysInfo.chipTemperature.average);
stat.add("Leon CSS Chip Temperature", sysInfo.chipTemperature.css);
stat.add("Leon MSS Chip Temperature", sysInfo.chipTemperature.mss);
stat.add("UPA Chip Temperature", sysInfo.chipTemperature.upa);
stat.add("DSS Chip Temperature", sysInfo.chipTemperature.dss);
} else {
stat.summary(diagnostic_msgs::msg::DiagnosticStatus::ERROR, "No Data");
}
Expand Down
Loading