Skip to content
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

Add BoundingBox Sensor #136

Merged
merged 37 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9c0f77c
Add BoundingBox Sensor
AmrElsersy Jun 16, 2021
207f3bb
Add Integration Test
AmrElsersy Jun 16, 2021
6429fb9
Edit format 2D boxes
AmrElsersy Jul 15, 2021
8a4ea0d
Add 3D Boxes
AmrElsersy Jul 15, 2021
907302b
Testing 3D
AmrElsersy Jul 15, 2021
026a869
Fix 3D testing
AmrElsersy Jul 16, 2021
f7cecfb
Near/Far plane
AmrElsersy Jul 16, 2021
8a6b5e3
Merge branch 'main' into BoundingBox
adlarkin Jul 18, 2021
79355fb
style
AmrElsersy Jul 22, 2021
f7741e8
Merge branch 'BoundingBox' of https://github.com/AmrElsersy/ign-senso…
AmrElsersy Jul 22, 2021
a5732c4
Merge branch 'main' into BoundingBox
adlarkin Jul 30, 2021
ff5e94a
style
AmrElsersy Aug 5, 2021
cfdece7
Add Tutorial
AmrElsersy Aug 6, 2021
46b0a6e
style
AmrElsersy Aug 16, 2021
ea6dab5
Merge branch 'main' of https://github.com/ignitionrobotics/ign-sensor…
AmrElsersy Aug 16, 2021
d4608e3
Rename integration test files
AmrElsersy Aug 16, 2021
8ec4daf
style
AmrElsersy Aug 16, 2021
f7f43c6
Using RenderingSensor::Render() instead of Capture for rgb camera
AmrElsersy Aug 17, 2021
e48a9d3
style
AmrElsersy Aug 17, 2021
f022c26
Add Save boxes
AmrElsersy Aug 18, 2021
460391d
style
AmrElsersy Aug 18, 2021
182e755
remove lowercasing from type
AmrElsersy Aug 18, 2021
4b8ec6f
solve the unsaving issue when the sensor has no subscribers
AmrElsersy Aug 19, 2021
cb19034
add debug info for advertised topics
adlarkin Aug 26, 2021
21b5d57
Update BoundingBox tutorial
AmrElsersy Aug 26, 2021
6985194
Add dataset generation tutorial
AmrElsersy Aug 26, 2021
06d18ed
add dataset generation gif
AmrElsersy Aug 26, 2021
2dde81c
DirIter instead of filesystem
AmrElsersy Sep 3, 2021
91a5bab
Merge branch 'main' of https://github.com/ignitionrobotics/ign-sensor…
AmrElsersy Sep 22, 2021
ab95793
merged from ign-sensors6
chapulina Jun 2, 2022
80052d2
Update to new API
chapulina Jun 2, 2022
83e6084
clean up member variables, includes, messages...
chapulina Jun 2, 2022
d638a57
tweaks
chapulina Jun 2, 2022
c951ec7
Depend on rendering 6.5
chapulina Jun 15, 2022
6ce248d
codecheck
chapulina Jun 15, 2022
22d5272
Fix test
chapulina Jun 16, 2022
79dd5b3
Disable test on macOS
chapulina Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions include/ignition/sensors/BoundingBoxCameraSensor.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* 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.
*
*/

#ifndef IGNITION_SENSORS_BOUNDINGBOXCAMERASENSOR2_HH_
#define IGNITION_SENSORS_BOUNDINGBOXCAMERASENSOR2_HH_
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved

#include <string>
#include <memory>
#include <vector>
#include <sdf/sdf.hh>
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved
#include <ignition/common/Event.hh>
#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>
#include <ignition/common/Time.hh>

#include "ignition/msgs.hh"
#include "ignition/transport/Node.hh"
#include "ignition/transport/Publisher.hh"

#include "ignition/rendering/BoundingBoxCamera.hh"
#include "ignition/sensors/CameraSensor.hh"
#include "ignition/sensors/Export.hh"
#include "ignition/sensors/Sensor.hh"
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved

namespace ignition
{
namespace sensors
{
// Inline bracket to help doxygen filtering.
inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
// forward declarations
class BoundingBoxCameraSensorPrivate;

/// \brief BoundingBox camera sensor class.
///
/// This class creates BoundingBox image from an ignition rendering scene.
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved
/// The scene must be created in advance and given to Manager::Init().
/// It offers both an ignition-transport interface and a direct C++ API
/// to access the image data. The API works by setting a callback to be
/// called with image data.
class BoundingBoxCameraSensor : public CameraSensor
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved
{
/// \brief constructor
public: BoundingBoxCameraSensor();

/// \brief destructor
public: virtual ~BoundingBoxCameraSensor();

/// \brief Load the sensor based on data from an sdf::Sensor object.
/// \param[in] _sdf SDF Sensor parameters.
/// \return true if loading was successful
public: virtual bool Load(const sdf::Sensor &_sdf) override;

/// \brief Load the sensor with SDF parameters.
/// \param[in] _sdf SDF Sensor parameters.
/// \return true if loading was successful
public: virtual bool Load(sdf::ElementPtr _sdf) override;

/// \brief Initialize values in the sensor
/// \return True on success
public: virtual bool Init() override;

/// \brief Force the sensor to generate data
/// \param[in] _now The current time
/// \return true if the update was successfull
public: virtual bool Update(
const std::chrono::steady_clock::duration &_now) override;

/// \brief Get the rendering BoundingBox camera
/// \return BoundingBox camera pointer
public: virtual rendering::BoundingBoxCameraPtr BoundingBoxCamera();
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Callback on new bounding boxes from bounding boxes camera
/// \param[in] _boxes Detected bounding boxes from the camera
public: void OnNewBoundingBoxes(
const std::vector<rendering::BoundingBox> &boxes);
AmrElsersy marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Set the rendering scene.
/// \param[in] _scene Pointer to the scene
public: virtual void SetScene(
ignition::rendering::ScenePtr _scene) override;

/// \brief Get image width.
/// \return width of the image
public: virtual unsigned int ImageWidth() const override;

/// \brief Get image height.
/// \return height of the image
public: virtual unsigned int ImageHeight() const override;

/// \brief Create a camera in a scene
/// \return True on success.
private: bool CreateCamera();

IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \brief Data pointer for private data
/// \internal
private: std::unique_ptr<BoundingBoxCameraSensorPrivate> dataPtr;
IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
};
}
}
}

#endif
Loading