Skip to content

Commit

Permalink
Merge pull request #16 from harveybia/main
Browse files Browse the repository at this point in the history
Fix for #15 and OpenCV 4.0 compatibility
  • Loading branch information
Giseop Kim authored Oct 8, 2021
2 parents 7ee4ac9 + 213f3fc commit b5e7eba
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 56 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
build
Log/*.png
Log/*.txt
Log/*.csv
Log/*.pdf
FAST-LIO/Log/*.png
FAST-LIO/Log/*.txt
FAST-LIO/Log/*.csv
FAST-LIO/Log/*.pdf
.vscode/c_cpp_properties.json
.vscode/settings.json
PCD/*.pcd
*.pyc
38 changes: 17 additions & 21 deletions FAST-LIO/rviz_cfg/loam_livox.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Panels:
- /Odometry1/Odometry1/Covariance1/Orientation1
- /MarkerArray1/Namespaces1
Splitter Ratio: 0.6432291865348816
Tree Height: 1146
Tree Height: 1137
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expand Down Expand Up @@ -61,7 +61,8 @@ Visualization Manager:
Plane Cell Count: 40
Reference Frame: <Fixed Frame>
Value: false
- Class: rviz/Axes
- Alpha: 1
Class: rviz/Axes
Enabled: false
Length: 0.699999988079071
Name: Axes
Expand All @@ -85,9 +86,7 @@ Visualization Manager:
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 163
Min Color: 0; 0; 0
Min Intensity: 0
Name: surround
Position Transformer: XYZ
Queue Size: 1
Expand Down Expand Up @@ -115,9 +114,7 @@ Visualization Manager:
Enabled: true
Invert Rainbow: true
Max Color: 255; 255; 255
Max Intensity: 0
Min Color: 0; 0; 0
Min Intensity: 0
Name: currPoints
Position Transformer: XYZ
Queue Size: 100000
Expand Down Expand Up @@ -145,9 +142,7 @@ Visualization Manager:
Enabled: false
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 151
Min Color: 0; 0; 0
Min Intensity: 0
Name: PointCloud2
Position Transformer: XYZ
Queue Size: 10
Expand Down Expand Up @@ -185,6 +180,7 @@ Visualization Manager:
Keep: 1
Name: Odometry
Position Tolerance: 0.0010000000474974513
Queue Size: 10
Shape:
Alpha: 1
Axes Length: 1
Expand All @@ -200,7 +196,8 @@ Visualization Manager:
Value: true
Enabled: true
Name: Odometry
- Class: rviz/Axes
- Alpha: 1
Class: rviz/Axes
Enabled: true
Length: 0.699999988079071
Name: Axes
Expand All @@ -224,6 +221,7 @@ Visualization Manager:
Z: 0
Pose Color: 25; 255; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.4000000059604645
Shaft Length: 0.4000000059604645
Expand Down Expand Up @@ -275,9 +273,7 @@ Visualization Manager:
Enabled: false
Invert Rainbow: false
Max Color: 138; 226; 52
Max Intensity: 248
Min Color: 138; 226; 52
Min Intensity: 0
Name: PointCloud2
Position Transformer: XYZ
Queue Size: 10
Expand Down Expand Up @@ -326,33 +322,33 @@ Visualization Manager:
Views:
Current:
Class: rviz/ThirdPersonFollower
Distance: 247.9972686767578
Distance: 76.899658203125
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 165.75035095214844
Y: -44.61741256713867
Z: 1.1274762073298916e-5
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: false
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 1.5697963237762451
Target Frame: global
Value: ThirdPersonFollower (rviz)
Yaw: 4.727225303649902
Yaw: 2.980398416519165
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1385
Height: 1376
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000001c8000004b7fc020000000dfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004b7000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650000000297000001dc0000000000000000fb0000000a0049006d0061006700650000000394000001600000000000000000fb0000000a0049006d00610067006501000002c5000000c70000000000000000fb0000000a0049006d00610067006501000002c5000000c70000000000000000fb0000000a0049006d00610067006501000002c5000000c700000000000000000000000100000152000004b7fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000004b7000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000009bd00000052fc0100000002fb0000000800540069006d00650100000000000009bd000002eb00fffffffb0000000800540069006d0065010000000000000450000000000000000000000697000004b700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd0000000400000000000001c8000004aefc020000000dfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004ae000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650000000297000001dc0000000000000000fb0000000a0049006d0061006700650000000394000001600000000000000000fb0000000a0049006d00610067006501000002c5000000c70000000000000000fb0000000a0049006d00610067006501000002c5000000c70000000000000000fb0000000a0049006d00610067006501000002c5000000c700000000000000000000000100000152000004aefc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000004ae000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000009b800000052fc0100000002fb0000000800540069006d00650100000000000009b8000002eb00fffffffb0000000800540069006d0065010000000000000450000000000000000000000692000004ae00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
Expand All @@ -361,6 +357,6 @@ Window Geometry:
collapsed: false
Views:
collapsed: false
Width: 2493
X: 67
Width: 2488
X: 72
Y: 27
2 changes: 1 addition & 1 deletion SC-PGO/launch/aloam_mulran.launch
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<remap from="/velodyne_points" to="/os1_points"/>

<!-- utils -->
<param name="save_directory" type="string" value="/home/user/Documents/catkin2021/catkin_scaloam_util/data/"/> <!-- CHANGE THIS and end with / -->
<param name="save_directory" type="string" value="$(env HOME)/Documents/catkin2021/catkin_scaloam_util/data/"/> <!-- CHANGE THIS and end with / -->

<!-- nodes -->
<node pkg="aloam_velodyne" type="ascanRegistration" name="ascanRegistration" output="screen" /> <!-- A-LOAM -->
Expand Down
2 changes: 1 addition & 1 deletion SC-PGO/launch/fastlio_ouster64.launch
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<remap from="/cloud_for_scancontext" to="/cloud_registered_lidar"/> <!-- because ScanContext requires lidar-ego-centric coordinate for the better performance -->

<!-- utils -->
<param name="save_directory" type="string" value="/home/user/Desktop/catkin_fastlio_slam/data/"/> <!-- CHANGE THIS and end with / -->
<param name="save_directory" type="string" value="$(env HOME)/Desktop/catkin_fastlio_slam/data/"/> <!-- CHANGE THIS and end with / -->

<!-- nodes -->
<node pkg="aloam_velodyne" type="alaserPGO" name="alaserPGO" output="screen" /> <!-- Scan Context-based PGO -->
Expand Down
10 changes: 5 additions & 5 deletions SC-PGO/src/kittiHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ int main(int argc, char** argv)

ros::Publisher pubOdomGT = n.advertise<nav_msgs::Odometry> ("/odometry_gt", 5);
nav_msgs::Odometry odomGT;
odomGT.header.frame_id = "/camera_init";
odomGT.header.frame_id = "camera_init";
odomGT.child_frame_id = "/ground_truth";

ros::Publisher pubPathGT = n.advertise<nav_msgs::Path> ("/path_gt", 5);
nav_msgs::Path pathGT;
pathGT.header.frame_id = "/camera_init";
pathGT.header.frame_id = "camera_init";

std::string timestamp_path = "sequences/" + sequence_number + "/times.txt";
std::ifstream timestamp_file(dataset_folder + timestamp_path, std::ifstream::in);
Expand All @@ -88,9 +88,9 @@ int main(int argc, char** argv)
float timestamp = stof(line);
std::stringstream left_image_path, right_image_path;
left_image_path << dataset_folder << "sequences/" + sequence_number + "/image_0/" << std::setfill('0') << std::setw(6) << line_num << ".png";
cv::Mat left_image = cv::imread(left_image_path.str(), CV_LOAD_IMAGE_GRAYSCALE);
cv::Mat left_image = cv::imread(left_image_path.str(), cv::IMREAD_GRAYSCALE);
right_image_path << dataset_folder << "sequences/" + sequence_number + "/image_1/" << std::setfill('0') << std::setw(6) << line_num << ".png";
cv::Mat right_image = cv::imread(left_image_path.str(), CV_LOAD_IMAGE_GRAYSCALE);
cv::Mat right_image = cv::imread(left_image_path.str(), cv::IMREAD_GRAYSCALE);

std::getline(ground_truth_file, line);
std::stringstream pose_stream(line);
Expand Down Expand Up @@ -153,7 +153,7 @@ int main(int argc, char** argv)
sensor_msgs::PointCloud2 laser_cloud_msg;
pcl::toROSMsg(laser_cloud, laser_cloud_msg);
laser_cloud_msg.header.stamp = ros::Time().fromSec(timestamp);
laser_cloud_msg.header.frame_id = "/camera_init";
laser_cloud_msg.header.frame_id = "camera_init";
pub_laser_cloud.publish(laser_cloud_msg);

sensor_msgs::ImagePtr image_left_msg = cv_bridge::CvImage(laser_cloud_msg.header, "mono8", left_image).toImageMsg();
Expand Down
16 changes: 8 additions & 8 deletions SC-PGO/src/laserMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void laserOdometryHandler(const nav_msgs::Odometry::ConstPtr &laserOdometry)
Eigen::Vector3d t_w_curr = q_wmap_wodom * t_wodom_curr + t_wmap_wodom;

nav_msgs::Odometry odomAftMapped;
odomAftMapped.header.frame_id = "/camera_init";
odomAftMapped.header.frame_id = "camera_init";
odomAftMapped.child_frame_id = "/aft_mapped";
odomAftMapped.header.stamp = laserOdometry->header.stamp;
odomAftMapped.pose.pose.orientation.x = q_w_curr.x();
Expand Down Expand Up @@ -817,7 +817,7 @@ void process()
sensor_msgs::PointCloud2 laserCloudSurround3;
pcl::toROSMsg(*laserCloudSurround, laserCloudSurround3);
laserCloudSurround3.header.stamp = ros::Time().fromSec(timeLaserOdometry);
laserCloudSurround3.header.frame_id = "/camera_init";
laserCloudSurround3.header.frame_id = "camera_init";
pubLaserCloudSurround.publish(laserCloudSurround3);
}

Expand All @@ -832,14 +832,14 @@ void process()
sensor_msgs::PointCloud2 laserCloudMsg;
pcl::toROSMsg(laserCloudMap, laserCloudMsg);
laserCloudMsg.header.stamp = ros::Time().fromSec(timeLaserOdometry);
laserCloudMsg.header.frame_id = "/camera_init";
laserCloudMsg.header.frame_id = "camera_init";
pubLaserCloudMap.publish(laserCloudMsg);
}

sensor_msgs::PointCloud2 laserCloudFullRes3Local;
pcl::toROSMsg(*laserCloudFullRes, laserCloudFullRes3Local);
laserCloudFullRes3Local.header.stamp = ros::Time().fromSec(timeLaserOdometry);
laserCloudFullRes3Local.header.frame_id = "/camera_init";
laserCloudFullRes3Local.header.frame_id = "camera_init";
pubLaserCloudFullResLocal.publish(laserCloudFullRes3Local);

int laserCloudFullResNum = laserCloudFullRes->points.size();
Expand All @@ -851,15 +851,15 @@ void process()
sensor_msgs::PointCloud2 laserCloudFullRes3;
pcl::toROSMsg(*laserCloudFullRes, laserCloudFullRes3);
laserCloudFullRes3.header.stamp = ros::Time().fromSec(timeLaserOdometry);
laserCloudFullRes3.header.frame_id = "/camera_init";
laserCloudFullRes3.header.frame_id = "camera_init";
pubLaserCloudFullRes.publish(laserCloudFullRes3);

//printf("mapping pub time %f ms \n", t_pub.toc());

//printf("whole mapping time %f ms ++++++++++\n", t_whole.toc());

nav_msgs::Odometry odomAftMapped;
odomAftMapped.header.frame_id = "/camera_init";
odomAftMapped.header.frame_id = "camera_init";
odomAftMapped.child_frame_id = "/aft_mapped";
odomAftMapped.header.stamp = ros::Time().fromSec(timeLaserOdometry);
odomAftMapped.pose.pose.orientation.x = q_w_curr.x();
Expand All @@ -881,7 +881,7 @@ void process()
laserAfterMappedPose.pose = odomAftMapped.pose.pose;

laserAfterMappedPath.header.stamp = odomAftMapped.header.stamp;
laserAfterMappedPath.header.frame_id = "/camera_init";
laserAfterMappedPath.header.frame_id = "camera_init";
laserAfterMappedPath.poses.push_back(laserAfterMappedPose);
pubLaserAfterMappedPath.publish(laserAfterMappedPath);

Expand All @@ -896,7 +896,7 @@ void process()
q.setY(q_w_curr.y());
q.setZ(q_w_curr.z());
transform.setRotation(q);
br.sendTransform(tf::StampedTransform(transform, odomAftMapped.header.stamp, "/camera_init", "/aft_mapped"));
br.sendTransform(tf::StampedTransform(transform, odomAftMapped.header.stamp, "camera_init", "/aft_mapped"));

frameCount++;
}
Expand Down
4 changes: 2 additions & 2 deletions SC-PGO/src/laserOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ int main(int argc, char **argv)

// publish odometry
nav_msgs::Odometry laserOdometry;
laserOdometry.header.frame_id = "/camera_init";
laserOdometry.header.frame_id = "camera_init";
laserOdometry.child_frame_id = "/laser_odom";
laserOdometry.header.stamp = ros::Time().fromSec(timeSurfPointsLessFlat);
laserOdometry.pose.pose.orientation.x = q_w_curr.x();
Expand All @@ -526,7 +526,7 @@ int main(int argc, char **argv)
laserPose.pose = laserOdometry.pose.pose;
laserPath.header.stamp = laserOdometry.header.stamp;
laserPath.poses.push_back(laserPose);
laserPath.header.frame_id = "/camera_init";
laserPath.header.frame_id = "camera_init";
pubLaserPath.publish(laserPath);

// transform corner features and plane features to the scan end point
Expand Down
14 changes: 7 additions & 7 deletions SC-PGO/src/laserPosegraphOptimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void pubPath( void )
// pub odom and path
nav_msgs::Odometry odomAftPGO;
nav_msgs::Path pathAftPGO;
pathAftPGO.header.frame_id = "/camera_init";
pathAftPGO.header.frame_id = "camera_init";
mKF.lock();
// for (int node_idx=0; node_idx < int(keyframePosesUpdated.size()) - 1; node_idx++) // -1 is just delayed visualization (because sometimes mutexed while adding(push_back) a new one)
for (int node_idx=0; node_idx < recentIdxUpdated; node_idx++) // -1 is just delayed visualization (because sometimes mutexed while adding(push_back) a new one)
Expand All @@ -302,7 +302,7 @@ void pubPath( void )
// const gtsam::Pose3& pose_est = isamCurrentEstimate.at<gtsam::Pose3>(node_idx);

nav_msgs::Odometry odomAftPGOthis;
odomAftPGOthis.header.frame_id = "/camera_init";
odomAftPGOthis.header.frame_id = "camera_init";
odomAftPGOthis.child_frame_id = "/aft_pgo";
odomAftPGOthis.header.stamp = ros::Time().fromSec(keyframeTimes.at(node_idx));
odomAftPGOthis.pose.pose.position.x = pose_est.x;
Expand All @@ -316,7 +316,7 @@ void pubPath( void )
poseStampAftPGO.pose = odomAftPGOthis.pose.pose;

pathAftPGO.header.stamp = odomAftPGOthis.header.stamp;
pathAftPGO.header.frame_id = "/camera_init";
pathAftPGO.header.frame_id = "camera_init";
pathAftPGO.poses.push_back(poseStampAftPGO);
}
mKF.unlock();
Expand All @@ -332,7 +332,7 @@ void pubPath( void )
q.setY(odomAftPGO.pose.pose.orientation.y);
q.setZ(odomAftPGO.pose.pose.orientation.z);
transform.setRotation(q);
br.sendTransform(tf::StampedTransform(transform, odomAftPGO.header.stamp, "/camera_init", "/aft_pgo"));
br.sendTransform(tf::StampedTransform(transform, odomAftPGO.header.stamp, "camera_init", "/aft_pgo"));
} // pubPath

void updatePoses(void)
Expand Down Expand Up @@ -436,12 +436,12 @@ std::optional<gtsam::Pose3> doICPVirtualRelative( int _loop_kf_idx, int _curr_kf
// loop verification
sensor_msgs::PointCloud2 cureKeyframeCloudMsg;
pcl::toROSMsg(*cureKeyframeCloud, cureKeyframeCloudMsg);
cureKeyframeCloudMsg.header.frame_id = "/camera_init";
cureKeyframeCloudMsg.header.frame_id = "camera_init";
pubLoopScanLocal.publish(cureKeyframeCloudMsg);

sensor_msgs::PointCloud2 targetKeyframeCloudMsg;
pcl::toROSMsg(*targetKeyframeCloud, targetKeyframeCloudMsg);
targetKeyframeCloudMsg.header.frame_id = "/camera_init";
targetKeyframeCloudMsg.header.frame_id = "camera_init";
pubLoopSubmapLocal.publish(targetKeyframeCloudMsg);

// ICP Settings
Expand Down Expand Up @@ -750,7 +750,7 @@ void pubMap(void)

sensor_msgs::PointCloud2 laserCloudMapPGOMsg;
pcl::toROSMsg(*laserCloudMapPGO, laserCloudMapPGOMsg);
laserCloudMapPGOMsg.header.frame_id = "/camera_init";
laserCloudMapPGOMsg.header.frame_id = "camera_init";
pubMapAftPGO.publish(laserCloudMapPGOMsg);
}

Expand Down
Loading

0 comments on commit b5e7eba

Please sign in to comment.