@@ -450,15 +450,59 @@ typedef enum : int32_t
450
450
} rgl_field_t ;
451
451
452
452
/* *
453
- * Kinds of return type for multi-return LiDAR output.
454
- */
455
- typedef enum : int32_t
453
+ * Bitshift and masks for coding return modes and types. Most significant byte encodes the number of returns. Return mode is
454
+ * encoded on 8 most significant bits (24-31) - 1 for single return mode, 2 for dual return. Remaining 24 bits are for encoding
455
+ * return type. First return is on 8 LEAST significant bits (0-7), and next 8 bits (8-15) are for second return. Bits 16-23 are
456
+ * not used at this moment - in the future e.g. the third return may be encoded there. Return type comes from rgl_return_type_t.
457
+ * Example: RGL_RETURN_LAST_STRONGEST would be encoded as:
458
+ * 0x02000201
459
+ * 02 - dual return
460
+ * 00 - not used bits
461
+ * 02 - second return - RGL_RETURN_TYPE_LAST
462
+ * 01 - first return - RGL_RETURN_TYPE_STRONGEST
463
+ */
464
+ const int32_t RGL_RETURN_MODE_BIT_SHIFT = 24 ;
465
+ const int32_t RGL_RETURN_MODE_SINGLE = 1 << RGL_RETURN_MODE_BIT_SHIFT;
466
+ const int32_t RGL_RETURN_MODE_DUAL = 2 << RGL_RETURN_MODE_BIT_SHIFT;
467
+ const int32_t RGL_RETURN_TYPE_BIT_SHIFT = 8 ;
468
+
469
+ /* *
470
+ * Kinds of return types for multi-return LiDAR output.
471
+ */
472
+ typedef enum : uint8_t
456
473
{
457
- RGL_RETURN_TYPE_NOT_DIVERGENT = 0 ,
458
- RGL_RETURN_TYPE_FIRST = 1 ,
474
+ RGL_RETURN_TYPE_UNKNOWN = 0 ,
475
+ RGL_RETURN_TYPE_STRONGEST = 1 ,
459
476
RGL_RETURN_TYPE_LAST = 2 ,
477
+ RGL_RETURN_TYPE_SECOND = 3 ,
478
+ RGL_RETURN_TYPE_FIRST = 4 ,
479
+ RGL_RETURN_TYPE_SECOND_STRONGEST = 5 ,
460
480
} rgl_return_type_t ;
461
481
482
+ /* *
483
+ * Kinds of return modes for multi-return LiDAR output.
484
+ */
485
+ typedef enum : int32_t
486
+ {
487
+ RGL_RETURN_UNKNOWN = RGL_RETURN_TYPE_UNKNOWN,
488
+ // Single return modes
489
+ RGL_RETURN_FIRST = RGL_RETURN_MODE_SINGLE | RGL_RETURN_TYPE_FIRST,
490
+ RGL_RETURN_SECOND = RGL_RETURN_MODE_SINGLE | RGL_RETURN_TYPE_SECOND,
491
+ RGL_RETURN_LAST = RGL_RETURN_MODE_SINGLE | RGL_RETURN_TYPE_LAST,
492
+ RGL_RETURN_STRONGEST = RGL_RETURN_MODE_SINGLE | RGL_RETURN_TYPE_STRONGEST,
493
+ // Dual return modes
494
+ RGL_RETURN_LAST_STRONGEST = RGL_RETURN_MODE_DUAL | (RGL_RETURN_TYPE_LAST) |
495
+ (RGL_RETURN_TYPE_STRONGEST << RGL_RETURN_TYPE_BIT_SHIFT),
496
+ RGL_RETURN_FIRST_LAST = RGL_RETURN_MODE_DUAL | (RGL_RETURN_TYPE_FIRST) |
497
+ (RGL_RETURN_TYPE_LAST << RGL_RETURN_TYPE_BIT_SHIFT),
498
+ RGL_RETURN_FIRST_STRONGEST = RGL_RETURN_MODE_DUAL | (RGL_RETURN_TYPE_FIRST) |
499
+ (RGL_RETURN_TYPE_STRONGEST << RGL_RETURN_TYPE_BIT_SHIFT),
500
+ RGL_RETURN_STRONGEST_SECOND_STRONGEST = RGL_RETURN_MODE_DUAL | (RGL_RETURN_TYPE_STRONGEST) |
501
+ (RGL_RETURN_TYPE_SECOND_STRONGEST << RGL_RETURN_TYPE_BIT_SHIFT),
502
+ RGL_RETURN_FIRST_SECOND = RGL_RETURN_MODE_DUAL | (RGL_RETURN_TYPE_FIRST) |
503
+ (RGL_RETURN_TYPE_SECOND << RGL_RETURN_TYPE_BIT_SHIFT),
504
+ } rgl_return_mode_t ;
505
+
462
506
/* *
463
507
* Helper enum for axis selection
464
508
*/
@@ -848,6 +892,18 @@ RGL_API rgl_status_t rgl_node_raytrace_configure_beam_divergence(rgl_node_t node
848
892
*/
849
893
RGL_API rgl_status_t rgl_node_raytrace_configure_default_intensity (rgl_node_t node, float default_intensity);
850
894
895
+ /* *
896
+ * Modifies RaytraceNode to set return mode.
897
+ * Point return types (RGL_FIELD_RETURN_TYPE_U8) will be set to corresponding rgl_return_type_t values, e.g. return mode
898
+ * RGL_RETURN_FIRST_LAST will result in point return types to be set to RGL_RETURN_TYPE_FIRST or RGL_RETURN_TYPE_LAST,
899
+ * interchangeably.
900
+ * Default return mode on RaytraceNode is RGL_RETURN_FIRST.
901
+ * Passing RGL_RETURN_UNKNOWN is an invalid operation and will fail - user can not set RGL_RETURN_UNKNOWN as return mode.
902
+ * @param node RaytraceNode to modify.
903
+ * @param return_mode Return mode to set.
904
+ */
905
+ RGL_API rgl_status_t rgl_node_raytrace_configure_return_mode (rgl_node_t node, rgl_return_mode_t return_mode);
906
+
851
907
/* *
852
908
* Creates or modifies FormatPointsNode.
853
909
* The Node converts internal representation into a binary format defined by the `fields` array.
@@ -886,7 +942,10 @@ RGL_API rgl_status_t rgl_node_points_compact_by_field(rgl_node_t* node, rgl_fiel
886
942
/* *
887
943
* Creates or modifies SpatialMergePointsNode.
888
944
* The Node merges point clouds spatially (e.g., multiple lidars outputs into one point cloud).
889
- * Only provided fields are merged (RGL_FIELD_DYNAMIC_FORMAT is not supported).
945
+ * Only provided fields are merged (RGL_FIELD_DYNAMIC_FORMAT is not supported). This Node do not resolve point return types
946
+ * (RGL_FIELD_RETURN_TYPE_U8) in any way - output return mode is always assumed to be RGL_RETURN_UNKNOWN and respective
947
+ * cloud points keep their return types. This may results in a case, where output point cloud contain points e.g. from
948
+ * four or more return types (rgl_return_type_t).
890
949
* Input point clouds must be unorganized (height == 1).
891
950
* Any modification to the Node's parameters clears accumulated data.
892
951
* Graph input: point cloud(s)
@@ -913,7 +972,9 @@ RGL_API rgl_status_t rgl_node_points_temporal_merge(rgl_node_t* node, const rgl_
913
972
914
973
/* *
915
974
* Creates or modifies FromArrayPointsNode.
916
- * The Node provides initial points for its children Nodes.
975
+ * The Node provides initial points for its children Nodes. This Node does not handle return mode - it is assumed that
976
+ * return mode is always RGL_RETURN_UNKNOWN. RGL_FIELD_RETURN_TYPE_U8 field values are still set according to data
977
+ * passed by user.
917
978
* Input: none
918
979
* Output: point cloud
919
980
* @param node If (*node) == nullptr, a new Node will be created. Otherwise, (*node) will be modified.
@@ -1059,17 +1120,6 @@ RGL_API rgl_status_t rgl_node_gaussian_noise_angular_hitpoint(rgl_node_t* node,
1059
1120
RGL_API rgl_status_t rgl_node_gaussian_noise_distance (rgl_node_t * node, float mean, float st_dev_base,
1060
1121
float st_dev_rise_per_meter);
1061
1122
1062
- /* *
1063
- * Creates or modifies MultiReturnSwitchNode
1064
- * This is a special node which does not modify the data but acts as an adapter to the multi-return feature.
1065
- * Thanks to this node, user can attach unchanged pipelines to work with specific return type from multi-return raytracing.
1066
- * Graph input: point cloud (with multi-return fields)
1067
- * Graph output: point cloud (with a selected field from parent's multi-return point cloud)
1068
- * @param node If (*node) == nullptr, a new Node will be created. Otherwise, (*node) will be modified.
1069
- * @param return_type Return type to select from multi-return point cloud.
1070
- */
1071
- RGL_API rgl_status_t rgl_node_multi_return_switch (rgl_node_t * node, rgl_return_type_t );
1072
-
1073
1123
/* *
1074
1124
* Assigns value true to out_alive if the given node is known and has not been destroyed,
1075
1125
* assigns value false otherwise.
0 commit comments