Skip to content

Commit

Permalink
merged from adlarkin/view_restructure
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Jul 9, 2021
2 parents 33163bf + 74c5d80 commit ce1b64a
Show file tree
Hide file tree
Showing 54 changed files with 716 additions and 1,941 deletions.
5 changes: 4 additions & 1 deletion Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ release will remove the deprecated code.

## Ignition Gazebo 5.x to 6.x

*
* Some GUI plugins have been moved to Ignition GUI. Gazebo users don't need to
change their configuration files, the plugins will be loaded the same way.
* Grid Config
* Tape Measure

## Ignition Gazebo 4.x to 5.x

Expand Down
9 changes: 0 additions & 9 deletions examples/scripts/distributed/primary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

ign gazebo -v 4 -z 100000000 --network-role primary --network-secondaries 3 $DIR/primary.sdf

# Ignition Gazebo 1.x.x and 2.x.x support using environment variables to
# configure distributed simulation. This capability is deprecated in
# version 2.x.x, and removed in verion 3.x.x of Inition Gazebo. Please use the
# --network-role and --network-secondaries command line options instead.

# export IGN_GAZEBO_NETWORK_ROLE="PRIMARY"
# export IGN_GAZEBO_NETWORK_SECONDARIES=3
# ign-gazebo -v 4 --distributed -f $DIR/primary.sdf

7 changes: 0 additions & 7 deletions examples/scripts/distributed/secondary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

ign gazebo -s -v 4 -z 100000000 --network-role secondary $DIR/secondary.sdf

# Ignition Gazebo 1.x.x and 2.x.x support using environment variables to
# configure distributed simulation. This capability is deprecated in
# version 2.x.x, and removed in verion 3.x.x of Inition Gazebo. Please use the
# --network-role and --network-secondaries command line options instead.

# export IGN_GAZEBO_NETWORK_ROLE="SECONDARY"
# ign-gazebo -v 4 --distributed -f $DIR/secondary.sdf
10 changes: 0 additions & 10 deletions examples/scripts/distributed_levels/primary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# --levels is implied by --network-role
ign gazebo -v 4 -z 100000000 --network-role primary --network-secondaries 2 $DIR/primary.sdf

# Ignition Gazebo 1.x.x and 2.x.x support using environment variables to
# configure distributed simulation. This capability is deprecated in
# version 2.x.x, and removed in verion 3.x.x of Inition Gazebo. Please use the
# --network-role and --network-secondaries command line options instead.

# export IGN_GAZEBO_NETWORK_ROLE="PRIMARY"
# export IGN_GAZEBO_NETWORK_SECONDARIES=3
# ign-gazebo -v 4 --distributed -f $DIR/primary.sdf


7 changes: 0 additions & 7 deletions examples/scripts/distributed_levels/secondary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# --levels is implied by --network-role
ign gazebo -s -v 4 -z 100000000 --network-role secondary $DIR/secondary.sdf

# Ignition Gazebo 1.x.x and 2.x.x support using environment variables to
# configure distributed simulation. This capability is deprecated in
# version 2.x.x, and removed in verion 3.x.x of Inition Gazebo. Please use the
# --network-role and --network-secondaries command line options instead.

# export IGN_GAZEBO_NETWORK_ROLE="SECONDARY"
# ign-gazebo -v 4 --distributed -f $DIR/secondary.sdf
10 changes: 0 additions & 10 deletions include/ignition/gazebo/ServerConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,6 @@ namespace ignition
/// \param[in] _recordPath Path to place recorded states
public: void SetLogRecordPath(const std::string &_recordPath);

/// \brief Get whether to ignore the path specified in SDF.
/// \return Whether to ignore the path specified in SDF
public: bool IGN_DEPRECATED(4) LogIgnoreSdfPath() const;

/// \brief Set whether to ignore the path specified in SDF. Path in SDF
/// should be ignored if a record path is specified on the command line,
/// for example.
/// \param[in] _ignore Whether to ignore the path specified in SDF
public: void IGN_DEPRECATED(4) SetLogIgnoreSdfPath(bool _ignore);

/// \brief Add a topic to record.
/// \param[in] _topic Topic name, which can include wildcards.
public: void AddLogRecordTopic(const std::string &_topic);
Expand Down
20 changes: 13 additions & 7 deletions include/ignition/gazebo/components/Component.hh
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,22 @@ namespace components
public: virtual ComponentTypeId TypeId() const = 0;

/// \brief A flag used by the EntityComponentManager (ECM) to determine
/// whether a component should be ignored or not. This is useful for
/// whether a component should be considered "removed". This is useful for
/// achieving removal (and re-addition) behavior for a component that
/// already exists without actually removing the component from the ECM
/// (using an internal flag instead of actually removing and re-adding the
/// component yields better runtime performance). This flag is to be used by
/// the ECM only, and should not change how users interact with components.
private: bool ignore{false};
/// already exists without actually removing the component from the ECM.
/// Using an internal flag instead of actually removing and re-adding the
/// component yields faster performance at runtime. Although memory usage is
/// increased since components aren't actually re-added/removed, the memory
/// needed for components is (usually) small, and frequent component
/// addition/removal is a rare use case, so the speedup that this approach
/// brings is worthwhile.
///
/// \note This flag is to be used by the ECM only, and should not change how
/// users interact with components.
private: bool removed{false};

// Make EntityStorage and EntityComponentManager a friend of the
// BaseComponent class so that they have access to a component's ignore
// BaseComponent class so that they have access to a component's "removed"
// flag.
friend class ignition::gazebo::detail::EntityStorage;
friend class ignition::gazebo::EntityComponentManager;
Expand Down
36 changes: 24 additions & 12 deletions include/ignition/gazebo/detail/BaseView.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ struct ComponentTypeHasher
/// ignition::gazebo::detail) directly.
class IGNITION_GAZEBO_VISIBLE BaseView
{
/// \brief Destructor
public: virtual ~BaseView() = default;

/// \brief See if an entity is a part of the view
/// \param[in] _entity The entity
/// \return true if _entity is a part of the view, false otherwise
Expand Down Expand Up @@ -131,8 +134,10 @@ class IGNITION_GAZEBO_VISIBLE BaseView
/// was not associated with the view.
public: bool AddEntityToRemoved(const Entity _entity);

/// \brief Clear the list of new entities
public: void ClearNewEntities();
/// \brief Update the entities in the view to no longer appear as newly
/// created. This method should be called whenever a new simulation step is
/// about to take place.
public: void ResetNewEntityState();

/// \brief Get the set of component types that this view requires.
/// \return The set of component types.
Expand All @@ -146,27 +151,34 @@ class IGNITION_GAZEBO_VISIBLE BaseView
/// \return The entities in the view
public: const std::set<Entity> &Entities() const;

/// \brief Get all of the new entities in the view
/// \return The new entities in the view
/// \brief Get all of the entities in the view that are considered "newly
/// created". While an entity may be new to the view, it may not be a newly
/// created entity (perhaps this entity has existed for some time, and just
/// had a component added to it that now makes this entity a part of the
/// view). An entity's "newness" is determined by the entity component
/// manager.
/// \return The newly created entities that are a part of the view
public: const std::set<Entity> &NewEntities() const;

/// \brief Get all of the entities to be removed from the view
/// \return The entities to be removed from the view
public: const std::set<Entity> &ToRemoveEntities() const;

/// \brief Get all of the entities to be added to the view
/// \return The entities to be added to the view
/// \brief Get all of the entities that should be added to the view. This is
/// useful for adding entities to the view before the view is used to ensure
/// that the view is up-to-date. Once all entities marked "to be added" are
/// added to the view, the ClearToAddEntities method should be called.
/// \return The entities to be added to the view, with the key of the map
/// indicating whether an entity is a newly created entity or not.
/// \sa ClearToAddEntities
public: const std::unordered_map<Entity, bool> &ToAddEntities() const;

/// \brief Clear all of the entities that are marked as to be added to the
/// view
/// view. This should be called after all of the entities marked as to be
/// added to the view are actually added to the view.
/// \sa ToAddEntities
public: void ClearToAddEntities();

/// \brief Destructor
public: virtual ~BaseView()
{
}

// TODO(adlarkin) make this a std::unordered_set for better performance.
// We need to make sure nothing else depends on the ordered preserved by
// std::set first
Expand Down
4 changes: 2 additions & 2 deletions include/ignition/gazebo/detail/EntityComponentManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ComponentTypeT *EntityComponentManager::CreateComponent(const Entity _entity,
return comp;
}
*comp = _data;
comp->ignore = false;
comp->removed = false;
}
return comp;
}
Expand Down Expand Up @@ -185,7 +185,7 @@ bool EntityComponentManager::SetComponentData(const Entity _entity,

auto changed = comp->SetData(_data,
CompareData<typename ComponentTypeT::Type>);
comp->ignore = false;
comp->removed = false;
return changed;
}

Expand Down
13 changes: 9 additions & 4 deletions include/ignition/gazebo/detail/EntityStorage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ enum class ComponentAdditionResult
FAILED_ADDITION = 3
};

class IGNITION_GAZEBO_HIDDEN EntityStorage
/// \brief A class that stores all components that have been created. This class
/// also keeps track of the entity a component belongs to.
///
/// \note The symbols are visible so that unit tests can be written for this
/// class.
class IGNITION_GAZEBO_VISIBLE EntityStorage
{
/// \brief Clear all of the entity and component data that has been tracked.
/// This "resets" the storage to its initial, empty state.
Expand Down Expand Up @@ -92,7 +97,7 @@ class IGNITION_GAZEBO_HIDDEN EntityStorage
/// \brief Get a pointer to a component of a particular type that belongs to
/// an entity. This is useful for determining whether an entity has a
/// reference to a particular component type or not, but says nothing about
/// the state/validity of the component. The component's ignore flag
/// the state/validity of the component. The component's removed flag
/// should be checked to learn more about the state/validity of the component.
/// \param[in] _entity The entity
/// \param[in] _typeId The type of component to be retrieved
Expand All @@ -110,12 +115,12 @@ class IGNITION_GAZEBO_HIDDEN EntityStorage

/// \brief Get a pointer to a component of a particular type that belongs to
/// an entity, if the component pointer is valid. A valid component pointer
/// is one that is not nullptr and is also one that does not have the ignore
/// is one that is not nullptr and is also one that does not have the removed
/// flag set to true.
/// \param[in] _entity The entity
/// \param[in] _typeId The type of the component to retrieve
/// \return The pointer to a component, if 1) the pointer isn't nullptr, and
/// 2) the ignore flag of the component pointer is false. Otherwise, nullptr
/// 2) the removed flag of the component pointer is false. Otherwise, nullptr
/// is returned
public: const components::BaseComponent *ValidComponent(const Entity _entity,
const ComponentTypeId _typeId) const;
Expand Down
112 changes: 0 additions & 112 deletions include/ignition/gazebo/gui/GuiEvents.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,56 +36,6 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
/// more information about events.
namespace events
{
/// \brief The class for sending and receiving custom snap value events.
class IGN_DEPRECATED(5) SnapIntervals : public QEvent
{
/// \brief Constructor
/// \param[in] _xyz XYZ snapping values.
/// \param[in] _rpy RPY snapping values.
/// \param[in] _scale Scale snapping values.
public: SnapIntervals(
const math::Vector3d &_xyz,
const math::Vector3d &_rpy,
const math::Vector3d &_scale)
: QEvent(kType), xyz(_xyz), rpy(_rpy), scale(_scale)
{
}

/// \brief Get the XYZ snapping values.
/// \return The XYZ snapping values.
public: math::Vector3d XYZ() const
{
return this->xyz;
}

/// \brief Get the RPY snapping values.
/// \return The RPY snapping values.
public: math::Vector3d RPY() const
{
return this->rpy;
}

/// \brief Get the scale snapping values.
/// \return The scale snapping values.
public: math::Vector3d Scale() const
{
return this->scale;
}

/// \brief The QEvent representing a snap event occurrence.
static const QEvent::Type kType = QEvent::Type(QEvent::User);

/// \brief XYZ snapping values in meters, these values must be positive.
private: math::Vector3d xyz;

/// \brief RPY snapping values in degrees, these values must be positive.
private: math::Vector3d rpy;

/// \brief Scale snapping values - a multiplier of the current size,
/// these values must be positive.
private: math::Vector3d scale;
};

/// \brief Event that notifies when new entities have been selected.
class EntitiesSelected : public QEvent
{
Expand Down Expand Up @@ -148,68 +98,6 @@ namespace events
/// \brief Whether the event was generated by the user,
private: bool fromUser{false};
};

/// \brief Event called in the render thread of a 3D scene.
/// It's safe to make rendering calls in this event's callback.
class IGN_DEPRECATED(5) Render : public QEvent
{
public: Render()
: QEvent(kType)
{
}
/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
};

/// \brief Event called to spawn a preview model.
/// Used by plugins that spawn models.
class IGN_DEPRECATED(5) SpawnPreviewModel : public QEvent
{
/// \brief Constructor
/// \param[in] _modelSdfString The model's SDF file as a string.
public: explicit SpawnPreviewModel(const std::string &_modelSdfString)
: QEvent(kType), modelSdfString(_modelSdfString)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);

/// \brief Get the sdf string of the model.
/// \return The model sdf string
public: std::string ModelSdfString() const
{
return this->modelSdfString;
}

/// \brief The sdf string of the model to be previewed.
std::string modelSdfString;
};

/// \brief Event called to spawn a preview resource, which takes the path
/// to the SDF file. Used by plugins that spawn resources.
class IGN_DEPRECATED(5) SpawnPreviewPath : public QEvent
{
/// \brief Constructor
/// \param[in] _filePath The path to an SDF file.
public: explicit SpawnPreviewPath(const std::string &_filePath)
: QEvent(kType), filePath(_filePath)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 5);

/// \brief Get the path of the SDF file.
/// \return The file path.
public: std::string FilePath() const
{
return this->filePath;
}

/// \brief The path of SDF file to be previewed.
std::string filePath;
};
} // namespace events
}
} // namespace gui
Expand Down
Loading

0 comments on commit ce1b64a

Please sign in to comment.