Skip to content

Commit

Permalink
Can set id and name of lidar visual
Browse files Browse the repository at this point in the history
Signed-off-by: Mihir Kulkarni <mihirk284@gmail.com>
  • Loading branch information
mihirk284 committed Jul 20, 2020
1 parent fc48246 commit 3296d4c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
28 changes: 26 additions & 2 deletions include/ignition/rendering/Scene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,34 @@ namespace ignition
/// \return The created marker
public: virtual MarkerPtr CreateMarker() = 0;

// /// \brief Create new lidar visual.
// /// \return The created lidar visual
/// \brief Create new lidar visual. A unique ID and name will
/// automatically be assigned to the lidar visual.
/// \return The created lidar visual
public: virtual LidarVisualPtr CreateLidarVisual() = 0;

/// \brief Create new lidar visual with the given ID. A unique name
/// will automatically be assigned to the lidar visual. If the given
/// ID is already in use, NULL will be returned.
/// \param[in] _id ID of the new lidar visual
/// \return The created lidar visual
public: virtual LidarVisualPtr CreateLidarVisual(unsigned int _id) = 0;

/// \brief Create new lidar visual with the given name. A unique ID
/// will automatically be assigned to the lidar visual. If the given
/// name is already in use, NULL will be returned.
/// \param[in] _name Name of the new lidar visual
/// \return The created lidar visual
public: virtual LidarVisualPtr CreateLidarVisual(
const std::string &_name) = 0;

/// \brief Create new lidar visual with the given name. If either
/// the given ID or name is already in use, NULL will be returned.
/// \param[in] _id ID of the lidar visual.
/// \param[in] _name Name of the new lidar visual.
/// \return The created lidar visual
public: virtual LidarVisualPtr CreateLidarVisual(
unsigned int _id, const std::string &_name) = 0;

/// \brief Create new text geometry.
/// \return The created text
public: virtual TextPtr CreateText() = 0;
Expand Down
12 changes: 12 additions & 0 deletions include/ignition/rendering/base/BaseScene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,18 @@ namespace ignition
// Documentation inherited.
public: virtual LidarVisualPtr CreateLidarVisual() override;

// Documentation inherited.
public: virtual LidarVisualPtr CreateLidarVisual(
unsigned int _id) override;

// Documentation inherited.
public: virtual LidarVisualPtr CreateLidarVisual(
const std::string &_name) override;

// Documentation inherited.
public: virtual LidarVisualPtr CreateLidarVisual(unsigned int _id,
const std::string &_name) override;

// Documentation inherited.
public: virtual WireBoxPtr CreateWireBox() override;

Expand Down
24 changes: 22 additions & 2 deletions src/base/BaseScene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,28 @@ MarkerPtr BaseScene::CreateMarker()
LidarVisualPtr BaseScene::CreateLidarVisual()
{
unsigned int objId = this->CreateObjectId();
const std::string objName = this->CreateObjectName(objId, "LidarVisual");
LidarVisualPtr lidar = this->CreateLidarVisualImpl(objId, objName);
return this->CreateLidarVisual(objId);
}

//////////////////////////////////////////////////
LidarVisualPtr BaseScene::CreateLidarVisual(unsigned int _id)
{
const std::string objName = this->CreateObjectName(_id, "LidarVisual");
return this->CreateLidarVisual(_id, objName);
}

//////////////////////////////////////////////////
LidarVisualPtr BaseScene::CreateLidarVisual(const std::string &_name)
{
unsigned int objId = this->CreateObjectId();
return this->CreateLidarVisual(objId, _name);
}

//////////////////////////////////////////////////
LidarVisualPtr BaseScene::CreateLidarVisual(unsigned int _id,
const std::string &_name)
{
LidarVisualPtr lidar = this->CreateLidarVisualImpl(_id, _name);
bool result = this->RegisterVisual(lidar);
return (result) ? lidar : nullptr;
}
Expand Down

0 comments on commit 3296d4c

Please sign in to comment.