1414// limitations under the License.
1515//
1616// SPDX-License-Identifier: Apache-2.0
17- #include " occupancy_grid_projector.hpp"
17+
18+ #include < string>
19+ #include < utility>
1820
1921#include " occupancy_grid_projector.cu.hpp"
22+ #include " occupancy_grid_projector.hpp"
2023
21- #include " gxf/multimedia/video.hpp"
2224#include " gxf/core/parameter_parser_std.hpp"
25+ #include " gxf/multimedia/video.hpp"
2326#include " gxf/std/tensor.hpp"
2427#include " gxf/std/timestamp.hpp"
2528
26- namespace nvidia
27- {
28- namespace isaac_ros
29- {
30- namespace freespace_segmentation
31- {
29+ namespace nvidia {
30+ namespace isaac_ros {
31+ namespace freespace_segmentation {
3232
33- gxf_result_t OccupancyGridProjector::registerInterface (gxf::Registrar * registrar)
34- {
33+ gxf_result_t OccupancyGridProjector::registerInterface (gxf::Registrar * registrar) {
3534 gxf::Expected<void > result;
3635
3736 result &= registrar->parameter (
@@ -68,8 +67,7 @@ gxf_result_t OccupancyGridProjector::registerInterface(gxf::Registrar * registra
6867 return gxf::ToResultCode (result);
6968}
7069
71- gxf_result_t OccupancyGridProjector::start ()
72- {
70+ gxf_result_t OccupancyGridProjector::start () {
7371 // Extract 3D transform from camera frame to ground frame from parameter
7472 auto projection = projection_transform_param_.get ();
7573 if (projection.size () != 7 ) {
@@ -87,8 +85,7 @@ gxf_result_t OccupancyGridProjector::start()
8785 }
8886 if (cudaMemcpy (
8987 translation_device_, translation.data (),
90- sizeof (float ) * translation.size (), cudaMemcpyHostToDevice) != cudaSuccess)
91- {
88+ sizeof (float ) * translation.size (), cudaMemcpyHostToDevice) != cudaSuccess) {
9289 GXF_LOG_ERROR (" Failed to copy translation to device" );
9390 return GXF_FAILURE;
9491 }
@@ -108,8 +105,7 @@ gxf_result_t OccupancyGridProjector::start()
108105 }
109106 if (cudaMemcpy (
110107 rotation_matrix_device_, rotation_matrix.data (),
111- sizeof (float ) * rotation_matrix.size (), cudaMemcpyHostToDevice) != cudaSuccess)
112- {
108+ sizeof (float ) * rotation_matrix.size (), cudaMemcpyHostToDevice) != cudaSuccess) {
113109 GXF_LOG_ERROR (" Failed to copy rotation matrix to device" );
114110 return GXF_FAILURE;
115111 }
@@ -131,8 +127,7 @@ gxf_result_t OccupancyGridProjector::start()
131127 return GXF_SUCCESS;
132128}
133129
134- gxf_result_t OccupancyGridProjector::stop () noexcept
135- {
130+ gxf_result_t OccupancyGridProjector::stop () noexcept {
136131 if (cudaFree (rotation_matrix_device_) != cudaSuccess) {
137132 GXF_LOG_ERROR (" Failed to free rotation matrix" );
138133 return GXF_FAILURE;
@@ -145,8 +140,7 @@ gxf_result_t OccupancyGridProjector::stop() noexcept
145140 return GXF_SUCCESS;
146141}
147142
148- gxf_result_t OccupancyGridProjector::tick ()
149- {
143+ gxf_result_t OccupancyGridProjector::tick () {
150144 // Retrieve segmentation mask from Bi3D postprocessor
151145 const auto maybe_mask_message = mask_receiver_->receive ();
152146 if (!maybe_mask_message) {
@@ -217,8 +211,7 @@ gxf_result_t OccupancyGridProjector::tick()
217211
218212 if (cudaMemcpy (
219213 origin->pointer (), origin_pose.data (), sizeof (double ) * origin_pose.size (),
220- cudaMemcpyHostToDevice) != cudaSuccess)
221- {
214+ cudaMemcpyHostToDevice) != cudaSuccess) {
222215 GXF_LOG_ERROR (" Failed to copy origin to device" );
223216 return GXF_FAILURE;
224217 }
@@ -244,7 +237,7 @@ gxf_result_t OccupancyGridProjector::tick()
244237
245238 // Process segmentation map
246239 process_segmentation_mask (
247- ( float *) segmentation_mask->pointer (), occupancy_grid->data <int8_t >().value (),
240+ reinterpret_cast < float *>( segmentation_mask->pointer () ), occupancy_grid->data <int8_t >().value (),
248241 segmentation_mask->video_frame_info ().height ,
249242 segmentation_mask->video_frame_info ().width ,
250243 grid_height_, grid_width_, grid_resolution_, f_x_, f_y_, rotation_matrix_device_,
0 commit comments