Skip to content

Commit b68467b

Browse files
marcusabateGitHub Enterprise
authored and
GitHub Enterprise
committed
Merge pull request #52 from SPARK/feature/TESSE_0.4
Feature/tesse 0.4
2 parents 1ff95ed + bda1138 commit b68467b

File tree

9 files changed

+79
-19
lines changed

9 files changed

+79
-19
lines changed

include/spark-vio-ros/base-data-source.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ class RosBaseDataProvider : public DataProvider {
7575
// Publish all outputs by calling individual functions below
7676
void publishOutput(const SpinOutputPacket& vio_output);
7777

78+
void publishStaticTf(const gtsam::Pose3& pose,
79+
const std::string& parent_frame_id,
80+
const std::string& child_frame_id);
7881

7982
protected:
8083
VioFrontEndParams frontend_params_;
@@ -91,6 +94,9 @@ class RosBaseDataProvider : public DataProvider {
9194
// Define frame ids for odometry message
9295
std::string world_frame_id_;
9396
std::string base_link_frame_id_;
97+
std::string left_cam_frame_id_;
98+
std::string right_cam_frame_id_;
99+
94100

95101
// Queue to store and retrieve VIO output in a thread-safe way.
96102
ThreadsafeQueue<SpinOutputPacket> vio_output_queue_;

launch/spark_vio_ros.launch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@
3939
<!-- Frame IDs -->
4040
<arg name="world_frame_id" default="world"/>
4141
<arg name="base_link_frame_id" default="base_link"/>
42+
<arg name="left_cam_frame_id" default="left_cam"/>
43+
<arg name="right_cam_frame_id" default="right_cam"/>
4244

4345
<!-- General parameters -->
4446
<arg name="verbosity" default="0" />
4547
<!-- 0: for vanilla VIO, 1: for regular VIO -->
4648
<arg name="backend_type" default="1" />
4749
<!-- Visualize pipeline output in OpenCV. -->
4850
<!-- Note that this is duplicated from the flags file -->
49-
<arg name="visualize" default="true" />
51+
<arg name="visualize" default="false" />
5052

5153
<!-- Launch main node -->
5254
<node name="spark_vio_ros" pkg="spark_vio_ros" type="spark_vio_ros" output="screen"
@@ -70,6 +72,8 @@
7072
<!-- Frame IDs for Odometry -->
7173
<param name="world_frame_id" value="$(arg world_frame_id)"/>
7274
<param name="base_link_frame_id" value="$(arg base_link_frame_id)"/>
75+
<param name="left_cam_frame_id" value="$(arg left_cam_frame_id)"/>
76+
<param name="right_cam_frame_id" value="$(arg right_cam_frame_id)"/>
7377

7478
<!-- Subscriber topics -->
7579
<!-- if we run online, use remap -->
@@ -84,8 +88,6 @@
8488
<param name="ground_truth_odometry_rosbag_topic"
8589
value="$(arg odometry_ground_truth_topic)" unless="$(arg online)"/>
8690

87-
ground_truth_odometry_rosbag_topic
88-
8991
<!-- Other subscription topics -->
9092
<remap from="reinit_flag" to="/sparkvio/reinit_flag"/>
9193
<remap from="reinit_pose" to="/sparkvio/reinit_pose"/>

launch/spark_vio_ros_euroc.launch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@
2525
<arg name="base_link_frame_id" value="base_link"/>
2626

2727
<!-- Launch static TF node from IMU to Cam0 for Euroc -->
28+
<!-- TODO(Toni): this can be done programatically now, using the parsed
29+
calibration files -->
30+
<!--
2831
<node pkg="tf" type="static_transform_publisher" name="left_cam_broadcaster"
2932
args="-0.0216401454975 -0.064676986768 0.00981073058949
3033
-0.0077071797555374275 0.010499323370587278 0.7017528002919717 0.7123014606689537
3134
$(arg base_link_frame_id) cam0 100"/>
35+
-->
36+
<arg name="left_cam_frame_id" value="cam0"/>
37+
<arg name="right_cam_frame_id" value="cam1"/>
3238

3339
<!-- Launch actual pipeline -->
3440
<include file="$(find spark_vio_ros)/launch/spark_vio_ros.launch"

launch/spark_vio_ros_tesse.launch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
<!-- Frame IDs -->
2424
<arg name="base_link_frame_id" value="base_link_spark"/>
25+
<arg name="left_cam_frame_id" value="left_cam_spark"/>
26+
<arg name="right_cam_frame_id" value="right_cam_spark"/>
2527

2628
<!-- Subscriber Topics -->
2729
<arg name="left_cam_topic" value="/tesse/left_cam"/>

param/TESSE/calibration.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ distortion_model: radial-tangential
66
camera_rate_hz: 13.0
77
camera_resolution: [720, 480] # width, height
88

9-
left_camera_intrinsics: [700, 700, 360, 240] # fu, fv, cu, cv
9+
left_camera_intrinsics: [415.69219381653056, 415.69219381653056, 360, 240] # fu, fv, cu, cv
1010
left_camera_distortion_coefficients: [0.0, 0.0, 0.0, 0.0] # k1, k2, p1, p2
1111
left_camera_extrinsics: [1.0, 0.0, 0.0, 0.0,
1212
0.0, 1.0, 0.0, 0.0,
1313
0.0, 0.0, 1.0, 0.0,
1414
0.0, 0.0, 0.0, 1.0]
1515

16-
right_camera_intrinsics: [700, 700, 360, 240] # fu, fv, cu, cv
16+
right_camera_intrinsics: [415.69219381653056, 415.69219381653056, 360, 240] # fu, fv, cu, cv
1717
right_camera_distortion_coefficients: [0.0, 0.0, 0.0, 0.0] # k1, k2, p1, p2
18-
right_camera_extrinsics: [1.0, 0.0, 0.0, 0.05,
18+
right_camera_extrinsics: [1.0, 0.0, 0.0, 0.1,
1919
0.0, 1.0, 0.0, 0.0,
2020
0.0, 0.0, 1.0, 0.0,
2121
0.0, 0.0, 0.0, 1.0]

param/TESSE/flags/StereoVIO.flags

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
--backend_type=1
33
--regular_vio_backend_modality=0
44
--deterministic_random_number_generator=true
5-
--visualize=true
5+
--visualize=false
66
--visualize_lmk_type=false
7-
--visualize_mesh=true
7+
--visualize_mesh=false
88
--visualize_mesh_with_colored_polygon_clusters=false
9-
--visualize_point_cloud=true
9+
--visualize_point_cloud=false
1010
--visualize_convex_hull=false
1111
--visualize_plane_constraints=false
1212
--visualize_planes=false
1313
--visualize_plane_label=false
1414
--visualize_semantic_mesh=false
15-
--visualize_mesh_in_frustum=true
15+
--visualize_mesh_in_frustum=false
1616
#--visualize_load_mesh_filename=/home/tonirv/Downloads/tesse_multiscene_office1_3d_semantic_v4.ply
1717
--save_frontend_images_option=0
1818
--viz_type=3

param/TESSE/trackerParameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ block_size: 3
1212
use_harris_detector: 0
1313
k: 0.04
1414
equalizeImage: 0
15-
nominalBaseline: 0.05
15+
nominalBaseline: 0.1
1616
toleranceTemplateMatching: 0.15
1717
templ_cols: 101 #must be odd
1818
templ_rows: 11

rviz/sparkvio_tesse.rviz renamed to rviz/spark_vio_tesse.rviz

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Panels:
55
Property Tree Widget:
66
Expanded:
77
- /TF1
8-
- /TF1/Status1
98
- /TF1/Frames1
109
- /TF1/Tree1
1110
- /3D Mesh Textured1
@@ -113,6 +112,8 @@ Visualization Manager:
113112
Value: true
114113
base_link_spark:
115114
Value: true
115+
left_cam:
116+
Value: true
116117
right_cam:
117118
Value: true
118119
world:
@@ -124,6 +125,11 @@ Visualization Manager:
124125
Show Names: true
125126
Tree:
126127
world:
128+
base_link_gt:
129+
left_cam:
130+
{}
131+
right_cam:
132+
{}
127133
base_link_spark:
128134
{}
129135
Update Interval: 0
@@ -239,7 +245,7 @@ Visualization Manager:
239245
Views:
240246
Current:
241247
Class: rviz/ThirdPersonFollower
242-
Distance: 8.306986808776855
248+
Distance: 93.48534393310547
243249
Enable Stereo Rendering:
244250
Stereo Eye Separation: 0.05999999865889549
245251
Stereo Focal Distance: 1
@@ -254,10 +260,10 @@ Visualization Manager:
254260
Invert Z Axis: false
255261
Name: Current View
256262
Near Clip Distance: 0.009999999776482582
257-
Pitch: 0.784796416759491
263+
Pitch: 1.329796552658081
258264
Target Frame: base_link
259265
Value: ThirdPersonFollower (rviz)
260-
Yaw: 1.6003519296646118
266+
Yaw: 4.328537464141846
261267
Saved:
262268
- Class: rviz/ThirdPersonFollower
263269
Distance: 6.814720153808594

src/base-data-source.cpp

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <pcl_msgs/PolygonMesh.h>
2424
#include <pcl_ros/point_cloud.h>
2525

26+
#include <tf2_ros/static_transform_broadcaster.h>
27+
2628
namespace VIO {
2729

2830
RosBaseDataProvider::RosBaseDataProvider()
@@ -59,18 +61,34 @@ RosBaseDataProvider::RosBaseDataProvider()
5961
CHECK(!base_link_frame_id_.empty());
6062
CHECK(nh_private_.getParam("world_frame_id", world_frame_id_));
6163
CHECK(!world_frame_id_.empty());
64+
CHECK(nh_private_.getParam("left_cam_frame_id", left_cam_frame_id_));
65+
CHECK(!left_cam_frame_id_.empty());
66+
CHECK(nh_private_.getParam("right_cam_frame_id", right_cam_frame_id_));
67+
CHECK(!right_cam_frame_id_.empty());
6268

6369
// Publishers
64-
odometry_pub_ = nh_.advertise<nav_msgs::Odometry>("odometry", 10);
70+
odometry_pub_ = nh_.advertise<nav_msgs::Odometry>("odometry", 10, true);
6571
frontend_stats_pub_ =
6672
nh_.advertise<std_msgs::Float64MultiArray>("frontend_stats", 10);
6773
resiliency_pub_ =
6874
nh_.advertise<std_msgs::Float64MultiArray>("resiliency", 10);
6975
imu_bias_pub_ = nh_.advertise<std_msgs::Float64MultiArray>("imu_bias", 10);
7076
pointcloud_pub_ =
71-
nh_.advertise<PointCloudXYZRGB>("time_horizon_pointcloud", 10);
72-
mesh_3d_frame_pub_ = nh_.advertise<pcl_msgs::PolygonMesh>("mesh", 5);
73-
debug_img_pub_ = it_->advertise("debug_mesh_img", 10);
77+
nh_.advertise<PointCloudXYZRGB>("time_horizon_pointcloud", 10, true);
78+
mesh_3d_frame_pub_ = nh_.advertise<pcl_msgs::PolygonMesh>("mesh", 5, true);
79+
debug_img_pub_ = it_->advertise("debug_mesh_img", 10, true);
80+
81+
// Static TFs for left/right cameras
82+
const gtsam::Pose3& body_Pose_left_cam =
83+
stereo_calib_.left_camera_info_.body_Pose_cam_;
84+
const gtsam::Pose3& body_Pose_right_cam =
85+
stereo_calib_.right_camera_info_.body_Pose_cam_;
86+
publishStaticTf(body_Pose_left_cam,
87+
base_link_frame_id_,
88+
left_cam_frame_id_);
89+
publishStaticTf(body_Pose_right_cam,
90+
base_link_frame_id_,
91+
right_cam_frame_id_);
7492
}
7593

7694
RosBaseDataProvider::~RosBaseDataProvider() {}
@@ -743,6 +761,26 @@ void RosBaseDataProvider::publishImuBias(
743761
imu_bias_pub_.publish(imu_bias_msg);
744762
}
745763

764+
void RosBaseDataProvider::publishStaticTf(const gtsam::Pose3& pose,
765+
const std::string& parent_frame_id,
766+
const std::string& child_frame_id) {
767+
static tf2_ros::StaticTransformBroadcaster static_broadcaster;
768+
geometry_msgs::TransformStamped static_transform_stamped;
769+
// TODO(Toni): Warning: using ros::Time::now(), will that bring issues?
770+
static_transform_stamped.header.stamp = ros::Time::now();
771+
static_transform_stamped.header.frame_id = parent_frame_id;
772+
static_transform_stamped.child_frame_id = child_frame_id;
773+
static_transform_stamped.transform.translation.x = pose.x();
774+
static_transform_stamped.transform.translation.y = pose.y();
775+
static_transform_stamped.transform.translation.z = pose.z();
776+
const gtsam::Quaternion& quat = pose.rotation().toQuaternion();
777+
static_transform_stamped.transform.rotation.x = quat.x();
778+
static_transform_stamped.transform.rotation.y = quat.y();
779+
static_transform_stamped.transform.rotation.z = quat.z();
780+
static_transform_stamped.transform.rotation.w = quat.w();
781+
static_broadcaster.sendTransform(static_transform_stamped);
782+
}
783+
746784
void RosBaseDataProvider::printParsedParams() const {
747785
LOG(INFO) << std::string(80, '=') << '\n'
748786
<< ">>>>>>>>> RosDataProvider::print <<<<<<<<<<<" << '\n'

0 commit comments

Comments
 (0)