Skip to content

Commit 8de4edd

Browse files
anuragroy2001arjo129iche033
committed
Add class-level docstrings to Python bindings (#3164)
* Add class-level docstrings to Python bindings This commit adds docstrings to all Python binding classes in gz-sim. Classes updated: - Server, ServerConfig, TestFixture, UpdateInfo - EntityComponentManager - World, Model, Link, Joint - Actor, Light, Sensor Resolves #2968 Signed-off-by: anuragroy2001 <[email protected]> * Update python/src/gz/sim/ServerConfig.cc Co-authored-by: Ian Chen <[email protected]> Signed-off-by: Arjo Chakravarty <[email protected]> --------- Signed-off-by: anuragroy2001 <[email protected]> Signed-off-by: Arjo Chakravarty <[email protected]> Co-authored-by: Arjo Chakravarty <[email protected]> Co-authored-by: Ian Chen <[email protected]>
1 parent 1db56b6 commit 8de4edd

File tree

12 files changed

+45
-12
lines changed

12 files changed

+45
-12
lines changed

python/src/gz/sim/Actor.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ namespace python
3232
{
3333
void defineSimActor(py::object module)
3434
{
35-
py::class_<gz::sim::Actor>(module, "Actor")
35+
py::class_<gz::sim::Actor>(module, "Actor",
36+
"A convenience wrapper around an actor entity. Actors are animated models "
37+
"that can follow trajectories and play animations. This class provides easy "
38+
"access to actor properties such as pose, trajectory, and animation state.")
3639
.def(py::init<gz::sim::Entity>())
3740
.def(py::init<gz::sim::Actor>())
3841
.def("entity", &gz::sim::Actor::Entity,

python/src/gz/sim/EntityComponentManager.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ namespace python
2727
void defineSimEntityComponentManager(pybind11::object module)
2828
{
2929
pybind11::class_<gz::sim::EntityComponentManager>(
30-
module, "EntityComponentManager")
30+
module, "EntityComponentManager",
31+
"The Entity Component Manager (ECM) manages entities and their components "
32+
"in the simulation.")
3133
.def(pybind11::init<>());
3234
}
3335
} // namespace python

python/src/gz/sim/Joint.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ namespace python
3232
{
3333
void defineSimJoint(py::object module)
3434
{
35-
py::class_<gz::sim::Joint>(module, "Joint")
35+
py::class_<gz::sim::Joint>(module, "Joint",
36+
"A convenience wrapper around a joint entity. This class provides easy "
37+
"access to joint properties such as pose, axis, type, position, velocity, "
38+
"and forces.")
3639
.def(py::init<gz::sim::Entity>())
3740
.def(py::init<gz::sim::Joint>())
3841
.def("entity", &gz::sim::Joint::Entity,

python/src/gz/sim/Light.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ namespace python
3030
{
3131
void defineSimLight(py::object module)
3232
{
33-
py::class_<gz::sim::Light>(module, "Light")
33+
py::class_<gz::sim::Light>(module, "Light",
34+
"A convenience wrapper around a light entity. This class provides easy "
35+
"access to light properties such as type, color, intensity, direction, "
36+
"and attenuation.")
3437
.def(py::init<gz::sim::Entity>())
3538
.def(py::init<gz::sim::Light>())
3639
.def("entity", &gz::sim::Light::Entity,

python/src/gz/sim/Link.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ namespace python
2929
{
3030
void defineSimLink(py::object module)
3131
{
32-
py::class_<gz::sim::Link>(module, "Link")
32+
py::class_<gz::sim::Link>(module, "Link",
33+
"A convenience wrapper around a link entity. This class provides easy "
34+
"access to link properties such as pose, velocity, acceleration, forces, "
35+
"and child entities (collisions, sensors, visuals).")
3336
.def(py::init<gz::sim::Entity>())
3437
.def(py::init<gz::sim::Link>())
3538
.def("entity", &gz::sim::Link::Entity,

python/src/gz/sim/Model.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ namespace python
3030
{
3131
void defineSimModel(py::object module)
3232
{
33-
py::class_<gz::sim::Model>(module, "Model")
33+
py::class_<gz::sim::Model>(module, "Model",
34+
"A convenience wrapper around a model entity. This class provides easy "
35+
"access to model properties (static, self-collide, wind mode) and child "
36+
"entities (joints, links).")
3437
.def(py::init<gz::sim::Entity>())
3538
.def(py::init<gz::sim::Model>())
3639
.def("entity", &gz::sim::Model::Entity,

python/src/gz/sim/Sensor.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ namespace python
3030
{
3131
void defineSimSensor(py::object module)
3232
{
33-
py::class_<gz::sim::Sensor>(module, "Sensor")
33+
py::class_<gz::sim::Sensor>(module, "Sensor",
34+
"A convenience wrapper around a sensor entity. This class provides easy "
35+
"access to sensor properties such as pose, topic, and parent entity.")
3436
.def(py::init<gz::sim::Entity>())
3537
.def(py::init<gz::sim::Sensor>())
3638
.def("entity", &gz::sim::Sensor::Entity,

python/src/gz/sim/Server.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ namespace python
3131
void defineSimServer(pybind11::object module)
3232
{
3333
pybind11::class_<gz::sim::Server,
34-
std::shared_ptr<gz::sim::Server>>(module, "Server")
34+
std::shared_ptr<gz::sim::Server>>(module, "Server",
35+
"The main simuulation server class. This class manages the simulation "
36+
"execution and provides control over running, pausing, and stepping "
37+
"through simulations.")
3538
.def(pybind11::init<gz::sim::ServerConfig &>())
3639
.def(
3740
"run", &gz::sim::Server::Run,

python/src/gz/sim/ServerConfig.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ namespace python
2929
{
3030
void defineSimServerConfig(pybind11::object module)
3131
{
32-
pybind11::class_<gz::sim::ServerConfig>(module, "ServerConfig")
32+
pybind11::class_<gz::sim::ServerConfig>(module, "ServerConfig",
33+
"Configuration for a simulation server. This class provides options "
34+
"for setting up and initializing a server, such as specifying the SDF file to use. ")
3335
.def(pybind11::init<>())
3436
.def(
3537
"set_sdf_file", &gz::sim::ServerConfig::SetSdfFile,

python/src/gz/sim/TestFixture.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ namespace python
3232
void
3333
defineSimTestFixture(pybind11::object module)
3434
{
35-
pybind11::class_<TestFixture, std::shared_ptr<TestFixture>> testFixture(module, "TestFixture");
35+
pybind11::class_<TestFixture, std::shared_ptr<TestFixture>> testFixture(module, "TestFixture",
36+
"A test fixture for setting up simulation tests. This class allows you to "
37+
"configure callbacks (pre-update, update, post-update, reset) and interact "
38+
"with a simulation server for testing purposes. ");
3639

3740
// Since this class starts with "Test", pytest thinks it's a test and emits a
3841
// warning when it can't "collect" it.

0 commit comments

Comments
 (0)