#include <DepthCamera.hpp>
|
| | Realsense () |
| |
| void | set_node (rclcpp::Node *ptr) |
| |
| void | init (std::string config) |
| | initializes camera with json settings More...
|
| |
| std::shared_ptr< std::pair< rclcpp::Time, pcl::PointCloud< pcl::PointXYZ >::Ptr > > | pop_last_grabbed_pcl (bool blocking) |
| |
| std::shared_ptr< std::pair< rclcpp::Time, pcl::PointCloud< pcl::PointXYZ >::Ptr > > | get_last_grabbed_pcl () |
| |
|
| pcl::PointCloud< pcl::PointXYZ >::Ptr | points_to_pcl (const rs2::points &points) |
| |
Definition at line 24 of file DepthCamera.hpp.
◆ Realsense()
◆ get_last_grabbed_pcl()
| std::shared_ptr< std::pair< rclcpp::Time, pcl::PointCloud< pcl::PointXYZ >::Ptr > > Realsense::get_last_grabbed_pcl |
( |
| ) |
|
◆ init()
| void Realsense::init |
( |
std::string |
config | ) |
|
initializes camera with json settings
Definition at line 14 of file DepthCamera.cpp.
15 log_warning(
"[Realsense::init] Configuration File ignored. (not implemented)");
17 log(
"Enable depth stream...");
18 m_cfg.enable_stream(RS2_STREAM_DEPTH, RS2_FORMAT_Z16);
21 auto callback = [&](
const rs2::frame& frame) {
22 log_debug(
"[Realsense::Callback] New Frame");
23 auto now = this->
m_nodePtr->get_clock()->now();
26 if(!frame.is<rs2::frameset>()) {
32 auto frameset = frame.as<rs2::frameset>();
34 auto it = frameset.begin();
35 if (it == frameset.end()) {
40 if((*it).get_profile().stream_type() != RS2_STREAM_DEPTH) {
41 log_warning(
"[Realsense::Callback] No Depth Frame");
46 rs2::depth_frame depthFrame = frameset.get_depth_frame();
47 rs2::pointcloud pointcloud;
48 rs2::points pc = pointcloud.calculate(depthFrame);
50 auto pointCloudPairSPtr = std::make_shared<std::pair<rclcpp::Time, pcl::PointCloud<pcl::PointXYZ>::Ptr>>();
51 std::get<0>(*pointCloudPairSPtr) = now;
74 log(
"Pipeline started...");
References galaxis::utils::log(), galaxis::utils::log_debug(), and galaxis::utils::log_warning().
Referenced by RealSenseNode::RealSenseNode().
◆ points_to_pcl()
| pcl::PointCloud< pcl::PointXYZ >::Ptr Realsense::points_to_pcl |
( |
const rs2::points & |
points | ) |
|
|
private |
Definition at line 162 of file DepthCamera.cpp.
164 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(
new pcl::PointCloud<pcl::PointXYZ>);
166 auto sp = points.get_profile().as<rs2::video_stream_profile>();
169 cloud->width = points.size();
171 cloud->is_dense =
true;
172 cloud->points.reserve(points.size());
174 auto ptr = points.get_vertices();
176 size_t pointsAppended = 0;
178 float m_minY = -0.08;
179 float m_maxY = 0.08f;
182 for (
size_t i = 0; i < points.size(); ++i) {
183 if(ptr->z <= m_maxZ && ptr->y >= m_minY && ptr->y <= m_maxY) {
184 cloud->push_back(pcl::PointXYZ(ptr->x, ptr->y, ptr->z));
192 cloud->points.resize(pointsAppended);
193 cloud->width = pointsAppended;
◆ pop_last_grabbed_pcl()
| std::shared_ptr< std::pair< rclcpp::Time, pcl::PointCloud< pcl::PointXYZ >::Ptr > > Realsense::pop_last_grabbed_pcl |
( |
bool |
blocking | ) |
|
◆ set_node()
| void Realsense::set_node |
( |
rclcpp::Node * |
ptr | ) |
|
◆ m_cfg
| rs2::config Realsense::m_cfg |
|
private |
◆ m_currentPointCloudPairNewData
| bool Realsense::m_currentPointCloudPairNewData = false |
|
private |
◆ m_currentPointCloudPairSPtr
| std::shared_ptr<std::pair<rclcpp::Time, pcl::PointCloud<pcl::PointXYZ>::Ptr> > Realsense::m_currentPointCloudPairSPtr = nullptr |
|
private |
◆ m_mtx
| std::mutex Realsense::m_mtx |
|
private |
◆ m_newPCLConditionVar
| std::condition_variable Realsense::m_newPCLConditionVar |
|
private |
◆ m_nodePtr
| rclcpp::Node* Realsense::m_nodePtr |
|
private |
◆ m_pipe
| rs2::pipeline Realsense::m_pipe |
|
private |
◆ m_profile
| rs2::pipeline_profile Realsense::m_profile |
|
private |
The documentation for this class was generated from the following files: