How to convert sensor_msgs::pointcloud to sensor_msgs::pointcloud2 - ros

I am using the code [here][1] which have sensor_msgs::pointcloud. Can someone help me how to convert it to sensor_msgs::pointcloud2
[1]: https://github.com/Vidicon/2dscantoPointcloud/blob/master/src/lidar_transform.cpp

This code is quite old and you shouldn't really be using PointCloud messages now. That being said, you can run the pointcloud_converter node to get your message out as a PointCloud2. Take this launch file for example:
<launch>
</node name="pointcloud_converter" type="point_cloud_converter" pkg="point_cloud_converter">
<remap from="points_in" to="/your_topic" />
<remap from="points_out" to="/your_output_topic" />
</node>
</launch>

You could use the method convertPointCloudToPointCloud2 from point_cloud_conversion.hpp

Related

No transform from [map] to [odom] in ros

I created a node to map the turtlebot3_world, since in turtlebot3_world.launch there is no map frame, i assigned map_msg.header.frame_id = "odom"inside my code. now i am going to use the created map for localization, I stuck all together in below launch file. the problem is with the origin of the map, although i set the origin of map at [-3,-3,0] it is located at [0,0,0] in rviz and never change, as well as there is another error in rviz ,"No transform from [map] to [odom]" (see the photo below). how can i handle these issues?
thanks in advance.
<launch>
<arg name="my_map" default="$(find robot_laser_grid_mapping)/maps/map.yaml"/>
<node pkg="just_for_learning" type="pointstamp.py" name="position_tracker">
<param name="map_file" value="$(find robot_laser_grid_mapping)/maps/map.yaml" />
</node>
<node pkg="map_server" type="map_server" name="map_server" args="$(arg my_map)"/>
<node pkg="teleoperat1" type="key_to_twist.py" name="keys_to_twist" ></node>
<node pkg="teleoperat1" type="keyboard_drive.py" name="keyboard_driver" ></node>
<include file="$(find turtlebot3_gazebo)/launch/turtlebot3_world.launch" ></include>
<include file="$(find turtlebot3_bringup)/launch/turtlebot3_model.launch"></include>
</launch>
rviz environment

How to set up parameter in hector_localization stack to fuse IMU and Barometer (Pressure sensor)?

Im checking the hector_localization stack, that provide the full 6DOF pose of a robot or platform. It uses various sensor sources, which are fused using an Extended Kalman filter. Acceleration and angular rates from an inertial measurement unit (IMU) serve as primary measurements and also support barometric pressure sensors. I check the launch which is this one
<?xml version="1.0"?>
<launch>
<node pkg="hector_pose_estimation" type="pose_estimation" name="hector_pose_estimation" />
<node pkg="rviz" type="rviz" name="hector_pose_estimation_rviz" args="-d $(find hector_pose_estimation)/rviz_cfg/hector_pose_estimation.rviz" />
</launch>
But can not find the way hot to set up the hector_pose_estimation node and the launch file to get IMU and Pressure (barometer) data as input. Any help?
Thanks
You have to remap the input topics hector is expecting to the topics you're systems are outputting. Check this page for a full list of topics and params. In the end your launch file should look something like this. Note you need to put in your own topic names.
<?xml version="1.0"?>
<launch>
<node pkg="hector_pose_estimation" type="pose_estimation" name="hector_pose_estimation">
<remap from="raw_imu" to="/your_imu_topic" />
<remap from="pressure_height" to="/your_barometric_topic" />
</node>
<node pkg="rviz" type="rviz" name="hector_pose_estimation_rviz" args="-d $(find hector_pose_estimation)/rviz_cfg/hector_pose_estimation.rviz" />
</launch>

How to publish a new topic to slam gmapping package in multiple-robot

I have used this command in the terminal to publish /scan_new topic to the gmapping package in tb3_0 robot ROS_NAMESPACE=tb3_0 rosrun gmapping slam_gmapping scan:=scan_new set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map, but the gampping package is not subscribe to the /scan_new topic. What is the correct command to make sure that gmapping package of the tb3_0 robot is subscribe to the /scan_new topic?
*notes: As in the figure, red word is the ann_publisher node publish to the /scan_new and the gmapping package subscribe to /scan_new topic
This isn't working as expected because you're giving the node a namespace. When doing this, topic remaps that don't specify a namespace will default to the node's namespace. Here it's /tb3_0, meaning it's actually trying to subscribe to /tb3_0/scan_new. There are a few different ways to fix this, the first being that you can just specify the global namespace with a / like so: scan:=/scan_new . You can also do the same thing, but in a launch file:
<?xml version="1.0"?>
<launch>
<node ns="tb3_0" name="slam_gmapping" pkg="gmapping" type="slam_gmapping" output="screen">
<param name="base_frame" value="tb3_0/base_footprint" />
<param name="odom_frame" value="tb3_0/odom" />
<param name="map_frame" value="tb3_0/map" />
<remap from="scan" to="/scan_new" />
</node>
</launch>
I would highly suggest using the launch file method. It is much cleaner and will be much easier to expand as the number of nodes you want to run increase.

ros image_view video_recorder does not record anything

I am using image_view video_recorder(http://wiki.ros.org/image_view) to record videos from a bag file. I followed this tutorial (https://wiki.ros.org/rosbag/Tutorials/Exporting%20image%20and%20video%20data), and decide to change the launch file to the following.
<launch>
<node pkg="rosbag" type="play" name="rosbag" required="true" args="/home/frankbu/bagfiles/2020-07-11-16-55-10.bag"/>
<node name="extract" pkg="image_view" type="video_recorder" respawn="false" required="true" output="screen" cwd="ROS_HOME">
<remap from="image" to="/camera/ceiling_image/"/>
<param name="filename" value="ceiling.avi"/>
</node>
</launch>
Interestingly, nothing is recorded. The topic is definitely publishing. I can visualize the video using rosrun image_view image_view image:=/camera/ceiling_image. But when I run the launch file, it got stuck at
[ INFO] [1594509115.442671189]: Waiting for topic /camera/ceiling_image...
[ INFO] [1594509115.715676818]: Starting to record MJPG video at [640 x 480]#10fps. Press Ctrl+C to stop recording.
Any help? Thanks!

How to make viso2_ros work with realsense r200?

I have been trying to make viso2_ros work with intel realsense r200. But there is a problem with the synchronisation(I think) and viso2_ros is not getting any image data. I get the following warning:
Following is my launch file:
<launch>
<arg name="camera" default="stereo_forward"/> <node ns="$(arg camera)" pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc"/> --> <node pkg="viso2_ros" type="stereo_odometer" name="stereo_odometer" output="screen">
<remap from ="stereo" to="$(arg camera)"/>
<remap from="image" to="image_rect"/>
<remap from="/$(arg camera)/left/image_rect" to="/camera/ir/image_raw"/>
<remap from="/$(arg camera)/left/camera_info" to="/camera/ir/camera_info"/>
<remap from="/$(arg camera)/right/image_rect" to="/camera/ir2/image_raw"/>
<remap from="/$(arg camera)/right/camera_info" to="/camera/ir2/camera_info"/>
<remap from="odom" to="/stereo_odometer/odometry"/>
<param name="queue_size" type="int" value="100"/>
<param name="approximate_sync" type="bool" value="true"/>
<param name="base_link_frame_id" value="$(arg camera)"/>
<param name="odom_frame_id" value="/odom"/>
</node>
</launch>
The rqt_graph:
which does not show a connection for /stereo_forward/right/image_rect. I am using Ubuntu 16.04 with ROS Kinetic. If anyone has any idea or suggestion about a resolution, I would really appreciate that. Thanks in advance!
From a quick google search it looks like Intel R200 only has 1 RGB camera. So I think you'd have to use monocular VO.

Resources