Skip to content

Commit

Permalink
rename o3Rorganizer2D as O3Rorganizer
Browse files Browse the repository at this point in the history
  • Loading branch information
inbangsa committed Aug 25, 2023
1 parent 95d9a4f commit 5bbfe88
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
2 changes: 2 additions & 0 deletions modules/device/include/ifm3d/device/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extern IFM3D_DEVICE_EXPORT const int IFM3D_BUFFER_ID_NOT_AVAILABLE;
extern IFM3D_DEVICE_EXPORT const int IFM3D_NETWORK_ERROR;
extern IFM3D_DEVICE_EXPORT const int IFM3D_SYSTEM_ERROR;
extern IFM3D_DEVICE_EXPORT const int IFM3D_CORRUPTED_STRUCT;
extern IFM3D_DEVICE_EXPORT const int
IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER;
// sensor errors
extern IFM3D_DEVICE_EXPORT const int IFM3D_XMLRPC_OBJ_NOT_FOUND;
extern IFM3D_DEVICE_EXPORT const int IFM3D_INVALID_PARAM;
Expand Down
4 changes: 4 additions & 0 deletions modules/device/src/libifm3d_device/err.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const int IFM3D_BUFFER_ID_NOT_AVAILABLE = -100032;
const int IFM3D_NETWORK_ERROR = -100033;
const int IFM3D_SYSTEM_ERROR = -100034;
const int IFM3D_CORRUPTED_STRUCT = -100035;
const int IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER = -100036;
// sensor errors
const int IFM3D_XMLRPC_OBJ_NOT_FOUND = 100000;
const int IFM3D_INVALID_PARAM = 101000;
Expand Down Expand Up @@ -155,6 +156,9 @@ ifm3d::strerror(int errnum)
case IFM3D_CORRUPTED_STRUCT:
return "Lib: The given Buffer does not contain the expected struct or "
"the data is corrupted.";
case IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER:
return "Lib: The device's PCIC port does not match any compatible "
"organizers";
case IFM3D_XMLRPC_OBJ_NOT_FOUND:
return "Sensor: XMLRPC obj not found - trying to access dead session?";
case IFM3D_INVALID_PARAM:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <o3d_organizer.hpp>
#include <o3x_organizer.hpp>
#include <o3r_organizer3D.hpp>
#include <o3r_organizer2D.hpp>
#include <o3r_organizer.hpp>
#include <fmt/core.h>

namespace ifm3d
Expand Down Expand Up @@ -226,14 +226,21 @@ ifm3d::FrameGrabber::Impl::Impl(ifm3d::Device::Ptr cam,
{
this->SetOrganizer(std::make_unique<O3ROrganizer3D>());
}
if (port_info.type == "2D")
else
{
this->SetOrganizer(std::make_unique<O3ROrganizer2D>());
this->SetOrganizer(std::make_unique<O3ROrganizer>());
}
}
}
}

if (organizer_ == nullptr)
{
LOG_ERROR(
"The device's PCIC port does not match any compatible organizers");
throw ifm3d::Error(IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER);
}

LOG_INFO("Camera connection info: ip={}, port={}",
this->cam_ip_,
this->pcic_port_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <o3r_organizer2D.hpp>
#include <o3r_organizer.hpp>
#include <ifm3d/common/logging/log.h>
#include <ifm3d/device/err.h>
#include <ifm3d/fg/buffer.h>
#include <ifm3d/fg/organizer_utils.h>
#include <ifm3d/fg/distance_image_info.h>

ifm3d::Organizer::Result
ifm3d::O3ROrganizer2D::Organize(const std::vector<uint8_t>& data,
const std::set<buffer_id>& requested_images,
const bool masking)
ifm3d::O3ROrganizer::Organize(const std::vector<uint8_t>& data,
const std::set<buffer_id>& requested_images,
const bool masking)
{
std::map<buffer_id, Buffer> images;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef IFM3D_FG_O3R_ORGANIZER_2D_H
# define IFM3D_FG_O3D_ORGANIZER_2D_H
#ifndef IFM3D_FG_O3R_ORGANIZER_H
# define IFM3D_FG_O3D_ORGANIZER__H

# include <optional>
# include <ifm3d/fg/organizer.h>
Expand All @@ -13,13 +13,13 @@ namespace ifm3d
{

/**
* organizer for O3R 2D port
* organizer for O3R 2D and app port
*/
class O3ROrganizer2D : public Organizer
class O3ROrganizer : public Organizer
{
public:
O3ROrganizer2D() = default;
~O3ROrganizer2D() = default;
O3ROrganizer() = default;
~O3ROrganizer() = default;

Result Organize(const std::vector<uint8_t>& data,
const std::set<buffer_id>& requestedImages,
Expand All @@ -29,4 +29,4 @@ namespace ifm3d

} // end: namespace ifm3d

#endif // IFM3D_FG_O3D_ORGANIZER_H
#endif // IFM3D_FG_O3D_ORGANIZER__H
1 change: 1 addition & 0 deletions modules/pybind11/src/bindings/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ bind_error(pybind11::module_& m)
ifm3d::add_attr(error_class, "IFM3D_NETWORK_ERROR", IFM3D_NETWORK_ERROR);
ifm3d::add_attr(error_class, "IFM3D_SYSTEM_ERROR", IFM3D_SYSTEM_ERROR);
ifm3d::add_attr(error_class, "IFM3D_CORRUPTED_STRUCT", IFM3D_CORRUPTED_STRUCT);
ifm3d::add_attr(error_class, "IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER", IFM3D_DEVICE_PORT_INCOMPATIBLE_WITH_ORGANIZER);
ifm3d::add_attr(error_class, "IFM3D_XMLRPC_OBJ_NOT_FOUND", IFM3D_XMLRPC_OBJ_NOT_FOUND);
ifm3d::add_attr(error_class, "IFM3D_INVALID_PARAM", IFM3D_INVALID_PARAM);
ifm3d::add_attr(error_class, "IFM3D_INVALID_VALUE_TYPE", IFM3D_INVALID_VALUE_TYPE);
Expand Down

0 comments on commit 5bbfe88

Please sign in to comment.