ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Schloern93's profile - activity

2022-11-07 01:45:30 -0500 received badge  Famous Question (source)
2022-11-07 01:45:30 -0500 received badge  Notable Question (source)
2022-10-28 04:44:00 -0500 received badge  Teacher (source)
2022-10-28 04:44:00 -0500 received badge  Self-Learner (source)
2022-09-26 06:11:19 -0500 received badge  Famous Question (source)
2022-03-30 15:44:03 -0500 received badge  Famous Question (source)
2022-03-30 15:44:03 -0500 received badge  Notable Question (source)
2021-08-09 09:28:59 -0500 received badge  Student (source)
2021-06-03 02:51:58 -0500 received badge  Famous Question (source)
2021-04-16 02:10:54 -0500 marked best answer Subscribe to PointClud2 Ros2

Hello together

I get a depth image from my intel d453 camera in a PointClud2 msgs. My problem is now the following. I do not understand how I can access the individual points, i.e. XYZ coordinates. It is only possible to access the whole data structure. Unfortunately it is not possible to sort the points correctly.

I need the following information for each point XYZ coordinates Color of the point

Is it possible to access the individual points within the data structure in this way?

Here is my Subscriber Callback:

void callback_depth_image_d435 (const sensor_msgs::msg::PointCloud2::SharedPtr depth_points)
{

  printf("Cloud: width = %u, height = %u\n", depth_points->width, depth_points->height);

 // Looking for Something like that
 //      BOOST_FOREACH(const Point& pt, depth_points->points)
 //      {
 //        printf("\tpos = (%f, %f, %f), w = %u, normal = (%f, %f, %f)\n",
 //               pt.pos.x, pt.pos.y, pt.pos.z, pt.w,
 //                 pt.normal[0], pt.normal[1], pt.normal[2]);
 //      }

  //test
  std::cout << "data_size" << depth_points->data.size() << "\n";
  std::cout << "point_step" << depth_points->point_step << "\n";
  //std::cout << "data_size" << depth_points-> << "\n";
  std::cout << "data_size" << depth_points->data.size() << "\n";
}

Many thanks in advance!

2021-04-16 02:10:21 -0500 marked best answer ROS 2 Subscribing to custom message type

Hello,

I use the following Intel package to run my Intel Ralsense cameras. https://github.com/IntelRealSense/rea...

I am now trying to subscribe to the topics that are opened by the realsense2_camera_node. I am still quite new to ROS and don't see what exactly I am doing wrong.

I have created a new package "tracking_pos" with which I want to subscribe the topic "/t265/accel/sample". The topic is published properly and I can view it with the command "ros2 topic echo" on the terminal.

Below is my code

#include <memory>
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include "realsense2_camera_msgs/msg/extrinsics.hpp"

using std::placeholders::_1;

class TrackingNode : public rclcpp::Node
{
public:
  TrackingNode()
    : Node("tracking_node")
{ 
  t265_linear_vel_sub_ = this->create_subscription<realsense2_camera_msgs::msg::Extrinsics>(
        "/t265/accel/sample", 10, std::bind(&TrackingNode::tracking_linear_vel_callback, this, _1));
}
private:
void tracking_linear_vel_callback(const realsense2_camera_msgs::msg::Extrinsics msg)
{
RCLCPP_INFO(this->get_logger(), "linear_vel_Callback");
} 
rclcpp::Subscription<realsense2_camera_msgs::msg::Extrinsics>::SharedPtr t265_linear_vel_sub_;    
};

int main(int argc, char * argv[])
{
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<TrackingNode>());
  rclcpp::shutdown();
  return 0;
}

CMakeList.txt

 cmake_minimum_required(VERSION 3.5)
 project(tracking_pos)

 # Default to C99
 if(NOT CMAKE_C_STANDARD)
   set(CMAKE_C_STANDARD 99)
 endif()

 # Default to C++14
 if(NOT CMAKE_CXX_STANDARD)
   set(CMAKE_CXX_STANDARD 14)
 endif()

 if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   add_compile_options(-Wall -Wextra -Wpedantic)
 endif()

 # find dependencies
 find_package(ament_cmake REQUIRED)
 find_package(rclcpp REQUIRED)
 find_package(std_msgs REQUIRED)
 find_package(realsense2_camera_msgs REQUIRED)

 add_executable(tracking src/tracking_node.cpp)
 ament_target_dependencies(tracking rclcpp std_msgs realsense2_camera_msgs)

 if(BUILD_TESTING)
   find_package(ament_lint_auto REQUIRED)
   ament_lint_auto_find_test_dependencies()
 endif()

 install(TARGETS
   tracking
   DESTINATION lib/${PROJECT_NAME})

 ament_package()

Relevant sections from the Package.xml

   <buildtool_depend>ament_cmake</buildtool_depend>

   <depend>rclcpp</depend>
   <depend>std_msgs</depend>

   <exec_depend>realsense2_camera_msgs</exec_depend>
   <build_depend>realsense2_camera_msgs</build_depend>

   <test_depend>ament_lint_auto</test_depend>
   <test_depend>ament_lint_common</test_depend>

   <export>
     <build_type>ament_cmake</build_type>
   </export>
 </package>

The project cannot be built like this. My question now is how to specify the data type in the subscriber correctly to receive the published data of the topic. Many thanks for the help in advance.

2021-04-16 02:09:59 -0500 received badge  Notable Question (source)
2021-04-10 12:17:26 -0500 received badge  Famous Question (source)
2021-04-06 11:46:02 -0500 received badge  Notable Question (source)
2021-04-06 11:46:02 -0500 received badge  Popular Question (source)
2021-04-06 11:27:10 -0500 received badge  Famous Question (source)
2021-04-06 09:54:08 -0500 received badge  Popular Question (source)
2021-04-06 09:54:03 -0500 received badge  Popular Question (source)
2021-03-26 05:16:14 -0500 received badge  Notable Question (source)
2021-02-01 11:05:07 -0500 asked a question Can not publish to self crated messages

Can not publish to self crated messages Hello, I have the following problem. I have three self-made ros messages which

2021-01-28 17:06:21 -0500 received badge  Famous Question (source)
2021-01-18 09:54:09 -0500 asked a question Pointcloud value at a given pixel

Pointcloud value at a given pixel Hallo, I need some help in understanding a PointCloud message. I have a /image_raw i

2021-01-18 02:48:41 -0500 received badge  Popular Question (source)
2021-01-14 05:03:54 -0500 asked a question Visualization rviz2

Visualization rviz2 Hello I am using the Intel Realsense D435 camera and the depth_image_proc package to create me a s

2021-01-12 17:17:12 -0500 received badge  Notable Question (source)
2021-01-12 04:18:34 -0500 edited question Cant subscribe to PoinCloud2

Cant subscribe to PoinCloud2 Hallo, Can someone explain me the difference of the two publishers? (1) pub_point_cloud_

2021-01-12 04:12:20 -0500 edited question Cant subscribe to PoinCloud2

Cant subscribe to PoinCloud2 Hallo, Can someone explain me the difference of the two publishers? (1) pub_point_cloud_

2021-01-12 04:12:20 -0500 received badge  Editor (source)
2021-01-12 04:11:23 -0500 asked a question Cant subscribe to PoinCloud2

Cant subscribe to PoinCloud2 Hallo, Can someone explain me the difference of the two publishers? (1) pub_point_cloud_

2021-01-04 03:52:36 -0500 received badge  Notable Question (source)
2021-01-04 02:57:13 -0500 received badge  Popular Question (source)
2020-12-31 04:05:36 -0500 asked a question Determine depth of a pixel via PointCloud2

Determine depth of a pixel via PointCloud2 Hello, I subscribe to a Point Cloud2 message. Here is my callback: void c

2020-12-29 06:41:30 -0500 answered a question Subscribe to PointClud2 Ros2

Here is a solution. Install pcl_conversion (sudo apt install ros-eloquent-pcl-conversions) CMakeList find_packa

2020-12-29 06:32:34 -0500 received badge  Popular Question (source)
2020-12-23 02:34:00 -0500 received badge  Enthusiast
2020-12-22 10:46:22 -0500 asked a question Subscribe to PointClud2 Ros2

Subscribe to PointClud2 Hello together I get a depth image from my intel d453 camera in a PointClud2 msgs. My problem i

2020-12-18 10:40:30 -0500 received badge  Popular Question (source)
2020-12-07 15:23:26 -0500 asked a question rviz2: Message Filter dropping message

rviz2: Message Filter dropping message Hello, I have the following problem. I get a speed vector from a subscriber. As

2020-12-04 09:31:24 -0500 answered a question ROS 2 Subscribing to custom message type

I solved the problem.

2020-12-04 09:31:24 -0500 asked a question ROS 2 Subscribing to custom message type

ROS 2 Subscribing to custom message type Hello, I use the following Intel package to run my Intel Ralsense cameras. htt

2020-12-04 08:18:46 -0500 received badge  Rapid Responder (source)