generated from tier4/ros2-project-template
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hesai): add support for xt16 (#241)
* Added XT16 references, added XT16 packet header file, added XT16 params and correction files. TO DO: - Check nebula_tests/hesai/hesai_ros_decoder_test_main.cpp - Check hardware and launch files - Run tests Signed-off-by: jemmmel <[email protected]> * Added test pcd for xt16 Signed-off-by: jemmmel <[email protected]> * Added XT16 to docs, modified max_scan_buffer_points, changed struct to use TailXT32 * Added header for XT32 packet struct Co-authored-by: Max Schmeller <[email protected]> * Added missing vendor file Signed-off-by: jemmmel <[email protected]> * Updated json for XT16 with changes from develop Signed-off-by: jemmmel <[email protected]> --------- Signed-off-by: jemmmel <[email protected]> Co-authored-by: Max Schmeller <[email protected]>
- Loading branch information
Showing
23 changed files
with
345 additions
and
9 deletions.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ json_to_markdown("nebula_ros/schema/PandarXT16.schema.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
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 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 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 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,17 @@ | ||
Channel,Elevation,Azimuth | ||
1,15,0 | ||
2,13,0 | ||
3,11,0 | ||
4,9,0 | ||
5,7,0 | ||
6,5,0 | ||
7,3,0 | ||
8,1,0 | ||
9,-1,0 | ||
10,-3,0 | ||
11,-5,0 | ||
12,-7,0 | ||
13,-9,0 | ||
14,-11,0 | ||
15,-13,0 | ||
16,-15,0 |
84 changes: 84 additions & 0 deletions
84
nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/pandar_xt16.hpp
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,84 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "nebula_decoders/nebula_decoders_hesai/decoders/hesai_packet.hpp" | ||
#include "nebula_decoders/nebula_decoders_hesai/decoders/hesai_sensor.hpp" | ||
#include "nebula_decoders/nebula_decoders_hesai/decoders/pandar_xt32.hpp" | ||
|
||
#include <vector> | ||
|
||
namespace nebula::drivers | ||
{ | ||
|
||
namespace hesai_packet | ||
{ | ||
|
||
#pragma pack(push, 1) | ||
|
||
using TailXT16 = TailXT32; | ||
|
||
struct PacketXT16 : public PacketBase<8, 16, 2, 100> | ||
{ | ||
using body_t = Body<Block<Unit4B, PacketXT16::n_channels>, PacketXT16::n_blocks>; | ||
Header12B header; | ||
body_t body; | ||
TailXT16 tail; | ||
uint32_t udp_sequence; | ||
}; | ||
|
||
#pragma pack(pop) | ||
|
||
} // namespace hesai_packet | ||
|
||
class PandarXT16 : public HesaiSensor<hesai_packet::PacketXT16> | ||
{ | ||
public: | ||
static constexpr float min_range = 0.05f; | ||
static constexpr float max_range = 120.0f; | ||
static constexpr size_t max_scan_buffer_points = 128000; | ||
|
||
int get_packet_relative_point_time_offset( | ||
uint32_t block_id, uint32_t channel_id, const packet_t & packet) override | ||
{ | ||
auto n_returns = hesai_packet::get_n_returns(packet.tail.return_mode); | ||
int block_offset_ns = 5632 - 50000 * ((8 - block_id - 1) / n_returns); | ||
int channel_offset_ns = 368 + 3024 * channel_id; | ||
return block_offset_ns + channel_offset_ns; | ||
} | ||
|
||
ReturnType get_return_type( | ||
hesai_packet::return_mode::ReturnMode return_mode, unsigned int return_idx, | ||
const std::vector<const typename packet_t::body_t::block_t::unit_t *> & return_units) override | ||
{ | ||
auto return_type = | ||
HesaiSensor<packet_t>::get_return_type(return_mode, return_idx, return_units); | ||
if (return_type == ReturnType::IDENTICAL) { | ||
return return_type; | ||
} | ||
|
||
// This sensor orders returns in the opposite order, so the return_type needs to be flipped too | ||
if (return_mode == hesai_packet::return_mode::DUAL_FIRST_LAST) { | ||
if (return_type == ReturnType::FIRST) | ||
return_type = ReturnType::LAST; | ||
else if (return_type == ReturnType::LAST) | ||
return_type = ReturnType::FIRST; | ||
} | ||
|
||
return return_type; | ||
} | ||
}; | ||
|
||
} // namespace nebula::drivers |
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 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 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 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 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 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 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,29 @@ | ||
/**: | ||
ros__parameters: | ||
host_ip: 255.255.255.255 | ||
sensor_ip: 192.168.1.201 | ||
multicast_ip: "" | ||
data_port: 2368 | ||
gnss_port: 10110 | ||
packet_mtu_size: 1500 | ||
launch_hw: true | ||
setup_sensor: true | ||
udp_only: false | ||
frame_id: hesai | ||
diag_span: 1000 | ||
min_range: 0.05 | ||
max_range: 120.0 | ||
cloud_min_angle: 0 | ||
cloud_max_angle: 360 | ||
sync_angle: 0 | ||
cut_angle: 0.0 | ||
sensor_model: PandarXT16 | ||
calibration_file: $(find-pkg-share nebula_decoders)/calibration/hesai/$(var sensor_model).csv | ||
rotation_speed: 600 | ||
return_mode: Dual | ||
ptp_profile: 1588v2 | ||
ptp_domain: 0 | ||
ptp_transport_type: UDP | ||
ptp_switch_type: TSN | ||
retry_hw: true | ||
dual_return_distance_threshold: 0.1 |
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 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 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 |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"PandarAT128", | ||
"PandarQT64", | ||
"PandarQT128", | ||
"PandarXT16", | ||
"PandarXT32", | ||
"PandarXT32M", | ||
] | ||
|
Oops, something went wrong.