-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/v0.10 #13
Open
jhughes50
wants to merge
12
commits into
main
Choose a base branch
from
refactor/v0.10
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Refactor/v0.10 #13
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3775b48
started refactor for v0.10 compatability
jhughes50 009fd7c
reworked driver
jhughes50 aa7c178
working on ouster
jhughes50 4af3a6a
working with bags and ouster
jhughes50 f5a86b3
added launch file for singular command
jhughes50 9ae5f0c
New launch file, namespace handling, and disaster handling
jhughes50 3a7218f
added documentation and tested
jhughes50 d0a951b
minor documentation changes
jhughes50 179dcd3
add sdk version
jhughes50 eab0a1f
removed depricated driver node
jhughes50 1341823
fixed docs, defaults and matched formatting
jhughes50 564b328
reformatted header files
jhughes50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ | |
build/ | ||
.vscode/ | ||
ouster_decoder.* | ||
metadata.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
cmake_minimum_required(VERSION 3.0.2) | ||
project(ouster_decoder) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | ||
include(CompilerWarnings) | ||
## Compile as C++11, supported in ROS Kinetic and newer | ||
# add_compile_options(-std=c++11) | ||
|
||
find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport pcl_ros | ||
sensor_msgs ouster_ros) | ||
catkin_package() | ||
## Find catkin macros and libraries | ||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) | ||
## is used, also find other catkin packages | ||
find_package(catkin REQUIRED COMPONENTS | ||
roscpp | ||
sensor_msgs | ||
cv_bridge | ||
image_transport | ||
pcl_ros | ||
ouster_ros | ||
) | ||
catkin_package( | ||
# INCLUDE_DIRS include | ||
# LIBRARIES ouster_decoder2 | ||
# CATKIN_DEPENDS roscpp sensor_msgs | ||
# DEPENDS system_lib | ||
) | ||
|
||
add_executable(ouster_decoder src/lidar.cpp src/decoder.cpp) | ||
target_include_directories(ouster_decoder PRIVATE src ${catkin_INCLUDE_DIRS}) | ||
target_link_libraries(ouster_decoder PRIVATE ${catkin_LIBRARIES}) | ||
enable_warnings(ouster_decoder) | ||
include_directories( | ||
include | ||
${catkin_INCLUDE_DIRS} | ||
) | ||
|
||
add_executable(decoder_node src/decoder.cpp src/decoder_node.cpp src/lidar.cpp) | ||
target_link_libraries(decoder_node PRIVATE ${catkin_LIBRARIES}) | ||
|
||
add_executable(driver_node src/driver.cpp src/driver_node.cpp) | ||
target_link_libraries(driver_node PRIVATE ${catkin_LIBRARIES}) | ||
|
||
add_executable(ouster_driver src/driver.cpp) | ||
target_include_directories(ouster_driver PRIVATE ${catkin_INCLUDE_DIRS}) | ||
target_link_libraries(ouster_driver PRIVATE ${catkin_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/*! | ||
* Kumar Robotics | ||
* Januart 2024 refactor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
* @breif: decodes incoming lidar and imu packets and publishes them | ||
* on appropriate ROS topics | ||
* Authors: Chao Qu and Jason Hughes | ||
*/ | ||
|
||
#ifndef DECODER_H | ||
#define DECODER_H | ||
|
||
#include <cv_bridge/cv_bridge.h> | ||
#include <image_transport/image_transport.h> | ||
#include <ros/ros.h> | ||
#include <tf2_ros/static_transform_broadcaster.h> | ||
|
||
#include "ouster_ros/GetMetadata.h" | ||
#include "ouster_ros/PacketMsg.h" | ||
|
||
#include "lidar.h" | ||
|
||
constexpr double kDefaultGravity = 9.807; | ||
|
||
class Decoder | ||
{ | ||
public: | ||
/*! | ||
* @breif: call to set ros params, initial ros and ouster | ||
* @param: ros nodehandle | ||
*/ | ||
explicit Decoder(const ros::NodeHandle& pnh); | ||
|
||
// No copy no move | ||
Decoder(const Decoder&) = delete; | ||
Decoder& operator=(const Decoder&) = delete; | ||
Decoder(Decoder&&) = delete; | ||
Decoder& operator=(Decoder&&) = delete; | ||
|
||
/*! | ||
* @breif: lidar packet callback | ||
* @param: PacketMsg, ros msg containing lidar packet | ||
* data. | ||
*/ | ||
void LidarPacketCb(const ouster_ros::PacketMsg& lidar_msg); | ||
/*! | ||
* @brief: imu packet callback | ||
* @param: PacketMsg, ros msg containing imu packet | ||
*/ | ||
void ImuPacketCb(const ouster_ros::PacketMsg& imu_msg); | ||
|
||
private: | ||
/*! | ||
* @brief: initialize ros publishers/ subscribers and frames | ||
*/ | ||
void InitRos(); | ||
/*! | ||
* @breif: initialize all ros params. | ||
*/ | ||
void InitParams(); | ||
/*! | ||
* @breif: get metadata from ros client from driver, | ||
* call lidar initializers | ||
*/ | ||
void InitOuster(); | ||
/*! | ||
* @breif: initialize LidarModel object, | ||
* generate camera info for topic | ||
* @param: string of metadata recieved from ros client. | ||
*/ | ||
void InitModel(const std::string& metadata); | ||
/*! | ||
* @breif: Allocate the memory for pointcloud | ||
* based on the number of subscans gotten by the "divide" param. | ||
* @param: lidar model object, containing all the lidar information. | ||
*/ | ||
void InitScan(const LidarModel& model); | ||
/*! | ||
* @breif: send imu and lidar transforms to tf. | ||
* @param: lidar model object, containing all the lidar information. | ||
*/ | ||
void SendTransform(const LidarModel& model); | ||
|
||
/*! | ||
* @breif: check if decoder is still waiting for alignment to mid 0. | ||
* @param: mid, column measurment id from the column buffer. | ||
* @return: true if mid == 0 | ||
*/ | ||
[[nodiscard]] bool NeedAlign(int mid); | ||
|
||
/*! | ||
* @breif: publish the pointcloud, range and signal images, and | ||
* camera info. Reset the lidar scan. | ||
*/ | ||
void PublishAndReset(); | ||
|
||
/*! | ||
* @breif: record processing time of lidar callback, print warning if it | ||
* exceeds window between two packets | ||
* @param: ros time when the lidar packet was recieved. | ||
*/ | ||
void Timing(const ros::Time& start) const; | ||
|
||
// ROS | ||
// @brief: ros noehandler. | ||
ros::NodeHandle pnh_; | ||
// @brief: tos image transporter. | ||
image_transport::ImageTransport it_; | ||
// @breif: lidar imu and metadata subscribers. | ||
ros::Subscriber lidar_sub_, imu_sub_, meta_sub_; | ||
// @breif: point cloud and imu publisher. | ||
ros::Publisher cloud_pub_, imu_pub_; | ||
// @breif: range and signal image publishers. | ||
ros::Publisher range_pub_, signal_pub_; | ||
// @breif: camera info publisher. | ||
image_transport::CameraPublisher camera_pub_; | ||
// @brief: tf2 static transform broadcaster | ||
tf2_ros::StaticTransformBroadcaster static_tf_; | ||
// @brief: frames, defined in launch file and gotten | ||
// as ros params. | ||
std::string sensor_frame_, lidar_frame_, imu_frame_; | ||
|
||
// DATA | ||
// @breif: object to hold incoming lidar data | ||
LidarScan scan_; | ||
// @breif: object to hold lidar metadata | ||
LidarModel model_; | ||
// @brief: ros msg for camera info | ||
sensor_msgs::CameraInfoPtr cinfo_msg_; | ||
|
||
// PARAMS | ||
// @breif: gravity | ||
double gravity_{}; | ||
// @brief: replay mode will reinitialize on jump | ||
bool replay_{false}; | ||
// @breif: whether to align scan | ||
bool need_align_{true}; | ||
// @breif: discrete time accelerometer noise variance | ||
double acc_noise_var_{}; | ||
// @breif: discrete time gyro noise varaince | ||
double gyr_noise_var_{}; | ||
// @breif: scal signal visualization | ||
double vis_signal_scale_{1.0}; | ||
}; | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if ouster's official decoder still has >3ms latency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhughes50 put together a few tests and I am stealing his slide here: