Skip to content

Commit

Permalink
Merge pull request #2504 from gazebosim/merge_7_8_20240731
Browse files Browse the repository at this point in the history
Merge 7 -> 8
  • Loading branch information
iche033 authored Aug 21, 2024
2 parents 24a37be + f26b9ed commit d662000
Show file tree
Hide file tree
Showing 35 changed files with 1,452 additions and 411 deletions.
9 changes: 0 additions & 9 deletions .github/ci/after_make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,3 @@ set -e
# Install (needed for some tests)
make install
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

# For gz-tools
export GZ_CONFIG_PATH=/usr/local/share/gz

# For rendering / window tests
Xvfb :1 -screen 0 1280x1024x24 &
export DISPLAY=:1.0
export RENDER_ENGINE_VALUES=ogre2
export MESA_GL_VERSION_OVERRIDE=3.3
9 changes: 9 additions & 0 deletions .github/ci/before_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh -l

set -x

# For rendering / window tests
Xvfb :1 -screen 0 1280x1024x24 &
export DISPLAY=:1.0
export RENDER_ENGINE_VALUES=ogre2
export MESA_GL_VERSION_OVERRIDE=3.3
2 changes: 2 additions & 0 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ qtdeclarative5-dev
qtquickcontrols2-5-dev
uuid-dev
xvfb
x11-utils
mesa-utils
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: gazebo-tooling/action-gz-ci@jammy
with:
# per bug https://github.com/gazebosim/gz-sim/issues/1409
cmake-args: '-DBUILD_DOCS=OFF'
cmake-args: '-DCMAKE_INSTALL_PREFIX=/usr -DBUILD_DOCS=OFF'
codecov-enabled: true
cppcheck-enabled: true
cpplint-enabled: true
89 changes: 89 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,65 @@

## Gazebo Sim 7.x

### Gazebo Sim 7.8.0 (2024-07-22)

1. Added support for spacecraft thrusters
* [Pull request #2431](https://github.com/gazebosim/gz-sim/pull/2431)

1. Disable rendering tests that are failing on github actions
* [Pull request #2480](https://github.com/gazebosim/gz-sim/pull/2480)

1. Consolidate entity creation.
* [Pull request #2452](https://github.com/gazebosim/gz-sim/pull/2452)

1. Set max contacts for collision pairs
* [Pull request #2270](https://github.com/gazebosim/gz-sim/pull/2270)

1. Add GravityEnabled boolean component
* [Pull request #2451](https://github.com/gazebosim/gz-sim/pull/2451)

1. Add support for no gravity link
* [Pull request #2398](https://github.com/gazebosim/gz-sim/pull/2398)

1. Handle sdf::Geometry::EMPTY in conversions
* [Pull request #2430](https://github.com/gazebosim/gz-sim/pull/2430)

1. Use topicFromScopedName in a few systems
* [Pull request #2427](https://github.com/gazebosim/gz-sim/pull/2427)

1. Fix typo in a comment
* [Pull request #2429](https://github.com/gazebosim/gz-sim/pull/2429)

1. Remove a few extra zeros from some sdf files
* [Pull request #2426](https://github.com/gazebosim/gz-sim/pull/2426)

1. Use VERSION_GREATER_EQUAL in cmake logic
* [Pull request #2418](https://github.com/gazebosim/gz-sim/pull/2418)

1. Rephrase cmake comment about CMP0077
* [Pull request #2419](https://github.com/gazebosim/gz-sim/pull/2419)

1. ForceTorque system: improve readability
* [Pull request #2403](https://github.com/gazebosim/gz-sim/pull/2403)

1. LTA Dynamics System
* [Pull request #2241](https://github.com/gazebosim/gz-sim/pull/2241)

1. Fix namespace and class links in documentation references that use namespace `gz`
* [Pull request #2385](https://github.com/gazebosim/gz-sim/pull/2385)

1. Fix ModelPhotoShootTest test failures
* [Pull request #2294](https://github.com/gazebosim/gz-sim/pull/2294)

1. update sdf version
* [Pull request #2313](https://github.com/gazebosim/gz-sim/pull/2313)

1. Fix Gazebo/White and refactored MaterialParser
* [Pull request #2302](https://github.com/gazebosim/gz-sim/pull/2302)

1. Support for Gazebo materials
* [Pull request #2269](https://github.com/gazebosim/gz-sim/pull/2269)

### Gazebo Sim 7.7.0 (2024-01-17)

1. Allow using plugin file names and environment variables compatible with Garden and later
Expand Down Expand Up @@ -3866,6 +3925,36 @@

## Gazebo Sim 3.x

### Gazebo Sim 3.15.1 (2024-01-05)

1. Update github action workflows
* [Pull request #2237](https://github.com/gazebosim/gz-sim/pull/2237)
* [Pull request #1988](https://github.com/gazebosim/gz-sim/pull/1988)

1. Fix macOS test failures by registering components in the core library
* [Pull request #2220](https://github.com/gazebosim/gz-sim/pull/2220)

1. Bump Fuel model version in test
* [Pull request #2190](https://github.com/gazebosim/gz-sim/pull/2190)

1. Fix a minor issue in the documentation of the server API
* [Pull request #2067](https://github.com/gazebosim/gz-sim/pull/2067)

1. Use sdf::Element::FindElement instead of GetElement in ApplyLinkWrench
* [Pull request #2052](https://github.com/gazebosim/gz-sim/pull/2052)

1. Adds a warning if the `Server` method of a `TestFixture` is called before `Finalize`
* [Pull request #2047](https://github.com/gazebosim/gz-sim/pull/2047)

1. Protobuf: Do not require version 3 do support Protobuf 4.23.2 (23.2)
* [Pull request #2006](https://github.com/gazebosim/gz-sim/pull/2006)

1. Print an error message when trying to load SDF files that don't contain a `<world>`
* [Pull request #1998](https://github.com/gazebosim/gz-sim/pull/1998)

1. Enable GzWeb visualization of markers by republishing service requests on a topic
* [Pull request #1994](https://github.com/gazebosim/gz-sim/pull/1994)

### Gazebo Sim 3.15.0 (2023-05-08)

1. Speed up Resource Spawner load time by fetching model list asynchronously
Expand Down
77 changes: 77 additions & 0 deletions examples/worlds/ground_spacecraft_testbed.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" ?>
<!--
Spacecraft thruster plugin demo
Send commands to a single thruster:
gz topic -p 'normalized:[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]' -t /dart/command/duty_cycle --msgtype gz.msgs.Actuators
-->
<sdf version="1.6">
<world name="ground_testbed">
<gravity>0 0 -9.8066</gravity>
<physics name="1ms" type="ignored">
<max_step_size>0.001</max_step_size>
<real_time_factor>1.0</real_time_factor>
</physics>
<plugin
filename="gz-sim-physics-system"
name="gz::sim::systems::Physics">
</plugin>
<plugin
filename="gz-sim-scene-broadcaster-system"
name="gz::sim::systems::SceneBroadcaster">
</plugin>
<plugin
filename="gz-sim-user-commands-system"
name="gz::sim::systems::UserCommands">
</plugin>
<plugin
filename="gz-sim-sensors-system"
name="gz::sim::systems::Sensors">
<render_engine>ogre2</render_engine>
</plugin>
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
<model name="ground_plane">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
</collision>
<visual name="visual">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<ambient>0.8 0.8 0.8 1</ambient>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.8 0.8 0.8 1</specular>
</material>
</visual>
</link>
</model>
<include>
<pose>0 0 0 0 0 0</pose>
<uri>https://fuel.gazebosim.org/1.0/proque/models/kth_freeflyer</uri>
</include>
</world>
</sdf>
51 changes: 51 additions & 0 deletions examples/worlds/spacecraft.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" ?>
<!--
Spacecraft thruster plugin demo
Send commands to a single thruster:
gz topic -p 'normalized:[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]' -t /dart/command/duty_cycle --msgtype gz.msgs.Actuators
-->
<sdf version="1.6">
<world name="zero_g">
<gravity>0 0 0</gravity>
<physics name="1ms" type="ignored">
<max_step_size>0.001</max_step_size>
<real_time_factor>1.0</real_time_factor>
</physics>
<plugin
filename="gz-sim-physics-system"
name="gz::sim::systems::Physics">
</plugin>
<plugin
filename="gz-sim-scene-broadcaster-system"
name="gz::sim::systems::SceneBroadcaster">
</plugin>
<plugin
filename="gz-sim-user-commands-system"
name="gz::sim::systems::UserCommands">
</plugin>
<plugin
filename="gz-sim-sensors-system"
name="gz::sim::systems::Sensors">
<render_engine>ogre2</render_engine>
</plugin>
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
<include>
<pose>0 0 0 0 0 0</pose>
<uri>https://fuel.gazebosim.org/1.0/proque/models/dart/7</uri>
</include>
</world>
</sdf>
8 changes: 8 additions & 0 deletions include/gz/sim/EntityComponentManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,14 @@ namespace gz
/// \return True if there are components marked for removal.
public: bool HasRemovedComponents() const;

/// \brief Get an Entity based on a name component that is associated
/// with the entity.
/// \param[in] _name Name associated with the Entity
/// \return The Entity, if an Entity with the given name exists,
/// otherwise return std::nullopt.
public: std::optional<Entity> EntityByName(
const std::string &_name) const;

/// \brief Clear the list of newly added entities so that a call to
/// EachAdded after this will have no entities to iterate. This function
/// is protected to facilitate testing.
Expand Down
10 changes: 10 additions & 0 deletions include/gz/sim/SdfEntityCreator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ namespace gz
/// \return World entity.
public: Entity CreateEntities(const sdf::World *_world);

/// \brief Create all entities that exist in the sdf::World object and
/// load their plugins.
/// \param[in] _world SDF world object.
/// \param[in] _worldEntity The world entity object.
public: void CreateEntities(const sdf::World *_world,
Entity _worldEntity);

/// \brief Create all entities that exist in the sdf::Model object and
/// load their plugins. Also loads plugins of child sensors.
/// \param[in] _model SDF model object.
Expand Down Expand Up @@ -186,6 +193,9 @@ namespace gz
private: Entity CreateEntities(const sdf::Model *_model,
bool _staticParent);

/// \brief Load plugins for all models
private: void LoadModelPlugins();

/// \brief Pointer to private data.
private: std::unique_ptr<SdfEntityCreatorPrivate> dataPtr;
};
Expand Down
6 changes: 6 additions & 0 deletions include/gz/sim/components/Performer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef GZ_SIM_COMPONENTS_PERFORMER_HH_
#define GZ_SIM_COMPONENTS_PERFORMER_HH_

#include <string>
#include <gz/sim/config.hh>
#include <gz/sim/Export.hh>

Expand All @@ -34,6 +35,11 @@ namespace components
/// \brief This component identifies an entity as being a performer.
using Performer = Component<NoData, class PerformerTag>;
GZ_SIM_REGISTER_COMPONENT("gz_sim_components.Performer", Performer)

/// \brief This component contains the performer reference name.
using PerformerRef = Component<std::string, class PerformerRefTag,
serializers::StringSerializer>;
GZ_SIM_REGISTER_COMPONENT("gz_sim_components.PerformerRef", PerformerRef)
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/EntityComponentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2314,3 +2314,15 @@ void EntityComponentManager::ResetTo(const EntityComponentManager &_other)
tmpCopy.ApplyEntityDiff(*this, ecmDiff);
this->CopyFrom(tmpCopy);
}

/////////////////////////////////////////////////
std::optional<Entity> EntityComponentManager::EntityByName(
const std::string &_name) const
{
std::optional<Entity> entity;
Entity entByName = EntityByComponents(components::Name(_name));
if (entByName != kNullEntity)
entity = entByName;

return entity;
}
17 changes: 17 additions & 0 deletions src/EntityComponentManager_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3421,6 +3421,23 @@ TEST_P(EntityComponentManagerFixture,
EXPECT_EQ(321, comp->Data());
}

//////////////////////////////////////////////////
TEST_P(EntityComponentManagerFixture, EntityByName)
{
// Create an entity, and give it a name
Entity entity = manager.CreateEntity();
manager.CreateComponent(entity, components::Name("entity_name_a"));

// Try to get an entity that doesn't exist
std::optional<Entity> entityByName = manager.EntityByName("a_bad_name");
EXPECT_FALSE(entityByName);

entityByName = manager.EntityByName("entity_name_a");
EXPECT_TRUE(entityByName);
CompareEntityComponents<components::Name>(manager, entity,
*entityByName, true);
}

// Run multiple times. We want to make sure that static globals don't cause
// problems.
INSTANTIATE_TEST_SUITE_P(EntityComponentManagerRepeat,
Expand Down
Loading

0 comments on commit d662000

Please sign in to comment.