Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
fed6f70
Add internal IMU data publisher by ros::Timer
tongtybj Jun 5, 2018
291ccf5
Modification for a correct merge
Myzhar Jun 25, 2018
c218cd2
Merge branch 'tongtybj-imu_pub' into devel
Myzhar Jun 25, 2018
4378c2e
Merge pull request #217 from stereolabs/master
Myzhar Jun 25, 2018
e1c80d9
Merge pull request #218 from stereolabs/master
Myzhar Jun 25, 2018
90fe983
Corrected issue with IMU reference frame
Myzhar Jun 26, 2018
845e96b
Code reformatting
Myzhar Jun 26, 2018
c893e79
Removed unuseful parameters from publisher functions that were using …
Myzhar Jun 26, 2018
1a7857c
Merged PR #189 : Add publisher for disparity
Myzhar Jun 26, 2018
f2bbd93
Added launch example to run ZED as a nodelet with ROS nodelet manager
Myzhar Jun 27, 2018
9571146
Code refactoring
Myzhar Jun 27, 2018
7c45753
Code refactoring
Myzhar Jun 27, 2018
19e1f0c
Added coordinate system conversion to ROS according to ZED SDK version
Myzhar Jun 27, 2018
633b848
Improved performances using OpenMP
Myzhar Jun 28, 2018
4870071
Modify resolution by launch file
Myzhar Jun 28, 2018
1157cfe
Coordinate changes for Z_UP-X_FWD removed
Myzhar Jun 28, 2018
68d472d
Added ROS service to request resetTracking to ZED SDK
Myzhar Jun 29, 2018
5d0d7fe
Reorganized ZED TF Tree according to ROS conventions
Myzhar Jun 29, 2018
027aabc
Minor changes to file names and code order
Myzhar Jul 2, 2018
f44f0e3
Fixed compilation error with SDK minor than v2.5.x
Myzhar Jul 2, 2018
7f939a5
Fixed issue #212 : zed-wrapper-node running on TX2 freezes when no
Myzhar Jul 2, 2018
a5eec02
Publishing odometry when depth_map topic is subscribed (same as for
Myzhar Jul 2, 2018
2563432
Added publishers for Confidence Image (8 bit) and Confidence Map (float)
Myzhar Jul 2, 2018
d9e88e9
Exposed enable_pose_smoothing and enable_spatial_memory params for
Myzhar Jul 3, 2018
8fa4b52
Exposed "initial_pose" to initialize tracking position
Myzhar Jul 3, 2018
f664f87
Modified "reset_tracking" to reset to "initial_pose" from Param Server
Myzhar Jul 3, 2018
452aaa8
Added service to set pose
Myzhar Jul 4, 2018
29c681b
Fixed issue with "Camera info" when setting new "mat_resize_factor"
Myzhar Jul 5, 2018
9f44001
Added missing set_pose.srv
Myzhar Jul 5, 2018
8c279bd
Removed odometry and replaced with "map pose"
Myzhar Jul 5, 2018
ae74d6c
Fixes the "unchecking/checking" depth cloud problem
Myzhar Jul 5, 2018
9178296
Added tool function slTime2Ros to fix timestamp
Myzhar Jul 5, 2018
195fd68
Coordinate changing code cleaned
Myzhar Jul 6, 2018
95bdebd
Added "imu/data_raw" topic according to ROS REP145
Myzhar Jul 6, 2018
f0be773
Update to publish IMU TF and topics at about 500 Hz
Myzhar Jul 6, 2018
d7ccb07
Added IMU R,t transform to zed_camera_center [TO BE CHECKED]
Myzhar Jul 6, 2018
a6f4136
Fixed issue with IMU link timestamp
Myzhar Jul 9, 2018
c226489
Added back odometry frame (together with map)
Myzhar Jul 9, 2018
b9b9659
Fixed IMU reference frame
Myzhar Jul 10, 2018
5087218
Fixed odometry transformation. Delta movements that are in camera frame
Myzhar Jul 11, 2018
ffc7ad3
Fixed IMU frame publishing
Myzhar Jul 12, 2018
22014ee
Added "verbose" parameter as for zendesk request
Myzhar Jul 12, 2018
668911d
Removed unuseful `include`
Myzhar Jul 13, 2018
e627f2c
Uniformed member variable names to camel case
Myzhar Jul 13, 2018
9c5c346
Modified logger level automatically to "Debug" if node is compiled with
Myzhar Jul 13, 2018
832be65
Added debug info about working thread duration in case it does not
Myzhar Jul 13, 2018
0c38c3a
Exposed "frame_rate" to "zed.launch" file
Myzhar Jul 13, 2018
6f04504
Added option "init_odom_with_imu" to initialize odometry with first pose
Myzhar Jul 16, 2018
8d7220b
Added check on the couple "resolution/framerate".
Myzhar Jul 16, 2018
544f74d
Updated all launch files to latest modifications
Myzhar Jul 16, 2018
3a98446
Fixed bug when the couple "resolution/framerate" was valid
Myzhar Jul 16, 2018
edc4e0f
Added service to reset odometry and clear drift errors.
Myzhar Jul 16, 2018
88bffb2
Exposed the SVO and Odometry Frame parameters to "zed.launch"
Myzhar Jul 16, 2018
7f8d8cf
Reduced the number of warning messages in the case that elaboration time
Myzhar Jul 16, 2018
775a963
Fixed "SIGTERM if no ZED was open" using the Serial Number
Myzhar Jul 16, 2018
1f0d41d
Code cleaning
Myzhar Jul 16, 2018
9c7c434
Fix for IMU TF not propagating in Rviz
Myzhar Jul 16, 2018
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
Prev Previous commit
Next Next commit
Merged PR #189 : Add publisher for disparity
  • Loading branch information
Myzhar committed Jun 26, 2018
commit 1a7857c5344377af1383c3cf0c9d9146aa07185f
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ find_package(catkin COMPONENTS
roscpp
rosconsole
sensor_msgs
stereo_msgs
dynamic_reconfigure
tf2_ros
pcl_conversions
Expand All @@ -54,6 +55,7 @@ checkPackage("image_transport" "")
checkPackage("roscpp" "")
checkPackage("rosconsole" "")
checkPackage("sensor_msgs" "")
checkPackage("stereo_msgs" "")
checkPackage("dynamic_reconfigure" "")
checkPackage("tf2_ros" "")
checkPackage("pcl_conversions" "")
Expand All @@ -69,6 +71,7 @@ catkin_package(
roscpp
rosconsole
sensor_msgs
stereo_msgs
opencv3
image_transport
dynamic_reconfigure
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ The zed_ros_wrapper is a catkin package. It depends on the following ROS package
- roscpp
- rosconsole
- sensor_msgs
- opencv
- stereo_msgs
- opencv3
- image_transport
- dynamic_reconfigure
- urdf
Expand Down
2 changes: 2 additions & 0 deletions launch/zed_camera.launch
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<arg name="base_frame" default="zed_center" />
<arg name="camera_frame" default="zed_left_camera" />
<arg name="depth_frame" default="zed_depth_camera" />
<arg name="disparity_frame" default="zed_depth_camera" />
<arg name="imu_frame" default="imu_link" />

<!-- Publish urdf zed -->
Expand All @@ -49,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<param name="base_frame" value="$(arg base_frame)" />
<param name="camera_frame" value="$(arg camera_frame)" />
<param name="depth_frame" value="$(arg depth_frame)" />
<param name="disparity_frame" value="$(arg disparity_frame)" />

<!-- SVO file path -->
<param name="svo_filepath" value="$(arg svo_file)" />
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<depend>roscpp</depend>
<depend>rosconsole</depend>
<depend>sensor_msgs</depend>
<depend>stereo_msgs</depend>
<depend>opencv3</depend>
<depend>image_transport</depend>
<depend>dynamic_reconfigure</depend>
Expand Down
9 changes: 9 additions & 0 deletions src/nodelet/include/zed_wrapper_nodelet.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <sensor_msgs/image_encodings.h>
#include <sensor_msgs/Imu.h>
#include <image_transport/image_transport.h>
#include <stereo_msgs/DisparityImage.h>
#include <dynamic_reconfigure/server.h>
#include <zed_wrapper/ZedConfig.h>
#include <nav_msgs/Odometry.h>
Expand Down Expand Up @@ -138,6 +139,12 @@ namespace zed_wrapper {
*/
void publishCamInfo(sensor_msgs::CameraInfoPtr cam_info_msg, ros::Publisher pub_cam_info, ros::Time t);

/* \brief Publish a cv::Mat disparity image with a ros Publisher
* \param disparity : the disparity image to publish
* \param t : the ros::Time to stamp the depth image
*/
void publishDisparity(cv::Mat disparity, ros::Time t);

/* \brief Get the information of the ZED cameras and store them in an information message
* \param zed : the sl::zed::Camera* pointer to an instance
* \param left_cam_info_msg : the information message to fill with the left camera informations
Expand Down Expand Up @@ -168,6 +175,7 @@ namespace zed_wrapper {
image_transport::Publisher pub_right;
image_transport::Publisher pub_raw_right;
image_transport::Publisher pub_depth;
ros::Publisher pub_disparity; // TODO use image_transport?
ros::Publisher pub_cloud;
ros::Publisher pub_rgb_cam_info;
ros::Publisher pub_left_cam_info;
Expand All @@ -186,6 +194,7 @@ namespace zed_wrapper {
std::string right_frame_id;
std::string rgb_frame_id;
std::string depth_frame_id;
std::string disparity_frame_id;
std::string cloud_frame_id;
std::string odometry_frame_id;
std::string base_frame_id;
Expand Down
39 changes: 36 additions & 3 deletions src/nodelet/src/zed_wrapper_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace zed_wrapper {
nh_ns.param<std::string>("base_frame", base_frame_id, "base_frame");
nh_ns.param<std::string>("camera_frame", camera_frame_id, "camera_frame");
nh_ns.param<std::string>("depth_frame", depth_frame_id, "depth_frame");
nh_ns.param<std::string>("disparity_frame", disparity_frame_id, "dispairty_frame");
nh_ns.param<std::string>("imu_frame", imu_frame_id, "imu_link");

// Get parameters from launch file
Expand Down Expand Up @@ -138,6 +139,8 @@ namespace zed_wrapper {

string depth_cam_info_topic = "depth/camera_info";

string disparity_topic = "disparity/disparity_image";

string point_cloud_topic = "point_cloud/cloud_registered";
cloud_frame_id = camera_frame_id;

Expand All @@ -162,6 +165,8 @@ namespace zed_wrapper {
nh_ns.getParam("depth_topic", depth_topic);
nh_ns.getParam("depth_cam_info_topic", depth_cam_info_topic);

nh_ns.getParam("disparity_topic", disparity_topic);

nh_ns.getParam("point_cloud_topic", point_cloud_topic);

nh_ns.getParam("odometry_topic", odometry_topic);
Expand Down Expand Up @@ -267,6 +272,10 @@ namespace zed_wrapper {
pub_depth = it_zed.advertise(depth_topic, 1); //depth
NODELET_INFO_STREAM("Advertized on topic " << depth_topic);

// Disparity publisher
pub_disparity = nh.advertise<stereo_msgs::DisparityImage>(disparity_topic, 1);
NODELET_INFO_STREAM("Advertized on topic " << disparity_topic);

//PointCloud publisher
pub_cloud = nh.advertise<sensor_msgs::PointCloud2> (point_cloud_topic, 1);
NODELET_INFO_STREAM("Advertized on topic " << point_cloud_topic);
Expand Down Expand Up @@ -464,6 +473,20 @@ namespace zed_wrapper {
pub_depth.publish(imageToROSmsg(depth, encoding, depth_frame_id, t));
}

void ZEDWrapperNodelet::publishDisparity(cv::Mat disparity, ros::Time t) {
sl::CameraInformation zedParam = zed.getCameraInformation();
sensor_msgs::ImagePtr disparity_image = imageToROSmsg(disparity, sensor_msgs::image_encodings::TYPE_32FC1, disparity_frame_id, t);

stereo_msgs::DisparityImage msg;
msg.image = *disparity_image;
msg.header = msg.image.header;
msg.f = zedParam.calibration_parameters.left_cam.fx;
msg.T = zedParam.calibration_parameters.T.x;
msg.min_disparity = msg.f * msg.T / zed.getDepthMaxRangeValue();
msg.max_disparity = msg.f * msg.T / zed.getDepthMinRangeValue();
pub_disparity.publish(msg);
}

void ZEDWrapperNodelet::publishPointCloud(int width, int height) {
pcl::PointCloud<pcl::PointXYZRGB> point_cloud;
point_cloud.width = width;
Expand Down Expand Up @@ -692,7 +715,7 @@ namespace zed_wrapper {
trackParams.area_file_path = odometry_DB.c_str();


sl::Mat leftZEDMat, rightZEDMat, depthZEDMat;
sl::Mat leftZEDMat, rightZEDMat, depthZEDMat, disparityZEDMat;
// Main loop
while (nh_ns.ok()) {
// Check for subscribers
Expand All @@ -703,9 +726,11 @@ namespace zed_wrapper {
int right_SubNumber = pub_right.getNumSubscribers();
int right_raw_SubNumber = pub_raw_right.getNumSubscribers();
int depth_SubNumber = pub_depth.getNumSubscribers();
int disparity_SubNumber = pub_disparity.getNumSubscribers();
int cloud_SubNumber = pub_cloud.getNumSubscribers();
int odom_SubNumber = pub_odom.getNumSubscribers();
bool runLoop = (rgb_SubNumber + rgb_raw_SubNumber + left_SubNumber + left_raw_SubNumber + right_SubNumber + right_raw_SubNumber + depth_SubNumber + cloud_SubNumber + odom_SubNumber) > 0;
bool runLoop = (rgb_SubNumber + rgb_raw_SubNumber + left_SubNumber + left_raw_SubNumber + right_SubNumber +
right_raw_SubNumber + depth_SubNumber + disparity_SubNumber + cloud_SubNumber + odom_SubNumber) > 0;

runParams.enable_point_cloud = false;
if (cloud_SubNumber > 0)
Expand All @@ -723,7 +748,7 @@ namespace zed_wrapper {
zed.disableTracking();
tracking_activated = false;
}
computeDepth = (depth_SubNumber + cloud_SubNumber + odom_SubNumber) > 0; // Detect if one of the subscriber need to have the depth information
computeDepth = (depth_SubNumber + disparity_SubNumber + cloud_SubNumber + odom_SubNumber) > 0; // Detect if one of the subscriber need to have the depth information
ros::Time t = ros::Time::now(); // Get current time

grabbing = true;
Expand Down Expand Up @@ -849,6 +874,14 @@ namespace zed_wrapper {
publishDepth(toCVMat(depthZEDMat), t); // in meters
}

// Publish the disparity image if someone has subscribed to
if (disparity_SubNumber > 0) {
zed.retrieveMeasure(disparityZEDMat, sl::MEASURE_DISPARITY);
// Need to flip sign, but cause of this is not sure
cv::Mat disparity = toCVMat(disparityZEDMat) * -1.0;
publishDisparity(disparity, t);
}

// Publish the point cloud if someone has subscribed to
if (cloud_SubNumber > 0) {
// Run the point cloud conversion asynchronously to avoid slowing down all the program
Expand Down