Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions habitat_sim/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ArticulatedObjectManager,
CollisionGroupHelper,
CollisionGroups,
ContactPointData,
JointMotorSettings,
JointMotorType,
JointType,
Expand Down Expand Up @@ -42,4 +43,5 @@
"JointMotorType",
"RigidConstraintType",
"RigidConstraintSettings",
"ContactPointData",
]
66 changes: 47 additions & 19 deletions src/esp/bindings/PhysicsBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@ void initPhysicsBindings(py::module& m) {
// ==== struct object VelocityControl ====
py::class_<VelocityControl, VelocityControl::ptr>(m, "VelocityControl")
.def(py::init(&VelocityControl::create<>))
.def_readwrite("linear_velocity", &VelocityControl::linVel)
.def_readwrite("angular_velocity", &VelocityControl::angVel)
.def_readwrite("controlling_lin_vel", &VelocityControl::controllingLinVel)
.def_readwrite("lin_vel_is_local", &VelocityControl::linVelIsLocal)
.def_readwrite("controlling_ang_vel", &VelocityControl::controllingAngVel)
.def_readwrite("ang_vel_is_local", &VelocityControl::angVelIsLocal)
.def("integrate_transform", &VelocityControl::integrateTransform, "dt"_a,
"rigid_state"_a);
.def_readwrite("linear_velocity", &VelocityControl::linVel,
R"(The linear velocity in meters/second.)")
.def_readwrite(
"angular_velocity", &VelocityControl::angVel,
R"(The angular velocity (Omega) in units of radians per second.)")
.def_readwrite("controlling_lin_vel", &VelocityControl::controllingLinVel,
R"(Whether or not linear velocity is integrated.)")
.def_readwrite(
"lin_vel_is_local", &VelocityControl::linVelIsLocal,
R"(Whether the linear velocity is considered to be in object local space or global space.)")
.def_readwrite("controlling_ang_vel", &VelocityControl::controllingAngVel,
R"(Whether or not angular velocity is integrated.)")
.def_readwrite(
"ang_vel_is_local", &VelocityControl::angVelIsLocal,
R"(Whether the angular velocity is considered to be in object local space or global space.)")
.def(
"integrate_transform", &VelocityControl::integrateTransform, "dt"_a,
"rigid_state"_a,
R"(Integrate the velocity (with explicit Euler) over a discrete timestep (dt) starting at a given state and using configured parameters. Returns the new state after integration.)");

// ==== enum articulated JointType ====
py::enum_<JointType>(m, "JointType")
Expand Down Expand Up @@ -139,16 +150,31 @@ void initPhysicsBindings(py::module& m) {
// ==== struct object ContactPointData ====
py::class_<ContactPointData, ContactPointData::ptr>(m, "ContactPointData")
.def(py::init(&ContactPointData::create<>))
.def_readwrite("object_id_a", &ContactPointData::objectIdA)
.def_readwrite("object_id_b", &ContactPointData::objectIdB)
.def_readwrite("link_id_a", &ContactPointData::linkIndexA)
.def_readwrite("link_id_b", &ContactPointData::linkIndexB)
.def_readwrite("position_on_a_in_ws", &ContactPointData::positionOnAInWS)
.def_readwrite("position_on_b_in_ws", &ContactPointData::positionOnBInWS)
.def_readwrite("contact_normal_on_b_in_ws",
&ContactPointData::contactNormalOnBInWS)
.def_readwrite("contact_distance", &ContactPointData::contactDistance)
.def_readwrite("normal_force", &ContactPointData::normalForce)
.def_readwrite(
"object_id_a", &ContactPointData::objectIdA,
R"(The Habitat object id of the first object in this collision pair.)")
.def_readwrite(
"object_id_b", &ContactPointData::objectIdB,
R"(The Habitat object id of the second object in this collision pair.)")
.def_readwrite(
"link_id_a", &ContactPointData::linkIndexA,
R"(The Habitat link id of the first object in this collision pair if an articulated link. -1 can indicate base link.)")
.def_readwrite(
"link_id_b", &ContactPointData::linkIndexB,
R"(The Habitat link id of the second object in this collision pair if an articulated link. -1 can indicate base link.)")
.def_readwrite(
"position_on_a_in_ws", &ContactPointData::positionOnAInWS,
R"(The global position of the contact point on the first object.)")
.def_readwrite(
"position_on_b_in_ws", &ContactPointData::positionOnBInWS,
R"(The global position of the contact point on the second object.)")
.def_readwrite(
"contact_normal_on_b_in_ws", &ContactPointData::contactNormalOnBInWS,
R"(The contact normal relative to the second object in world space.)")
.def_readwrite("contact_distance", &ContactPointData::contactDistance,
R"(The penetration depth of the contact point.)")
.def_readwrite("normal_force", &ContactPointData::normalForce,
R"(The normal force produced by the contact point.)")
.def_readwrite("linear_friction_force1",
&ContactPointData::linearFrictionForce1)
.def_readwrite("linear_friction_force2",
Expand All @@ -157,7 +183,9 @@ void initPhysicsBindings(py::module& m) {
&ContactPointData::linearFrictionDirection1)
.def_readwrite("linear_friction_direction2",
&ContactPointData::linearFrictionDirection2)
.def_readwrite("is_active", &ContactPointData::isActive);
.def_readwrite(
"is_active", &ContactPointData::isActive,
R"(Whether or not the contact is between active objects. Deactivated objects may produce contact points but no reaction.)");

// ==== enum object CollisionGroup ====
py::enum_<CollisionGroup> collisionGroups{m, "CollisionGroups",
Expand Down