-
Notifications
You must be signed in to change notification settings - Fork 50
Enable/disable: gravity and static #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gz-physics7
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,52 @@ FreeGroupFeatures::FreeGroupInfo FreeGroupFeatures::GetCanonicalInfo( | |
return FreeGroupInfo{this->links.at(_groupID)->link, nullptr}; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void FreeGroupFeatures::SetFreeGroupStaticState( | ||
const Identity &_groupID, | ||
bool _state) | ||
{ | ||
const auto modelInfo = this->models.at(_groupID); | ||
// Verify that the model qualifies as a FreeGroup | ||
dart::dynamics::SkeletonPtr &skeleton = modelInfo->model; | ||
|
||
std::cout << "SetFreeGroupStaticState " << std::endl; | ||
|
||
if (skeleton) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Move the |
||
skeleton->setMobile(!_state); | ||
} else { | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void FreeGroupFeatures::SetFreeGroupGravityEnabled( | ||
const Identity &_groupID, | ||
bool _enabled) | ||
{ | ||
const FreeGroupInfo &info = GetCanonicalInfo(_groupID); | ||
if (!info.model) | ||
{ | ||
info.link->setGravityMode(_enabled); | ||
return; | ||
} | ||
|
||
for (std::size_t i = 0; i < info.model->getNumTrees(); ++i) | ||
{ | ||
auto *bn = info.model->getRootBodyNode(i); | ||
bn->setGravityMode(_enabled); | ||
} | ||
// const auto modelInfo = this->models.at(_groupID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this block? |
||
// // Verify that the model qualifies as a FreeGroup | ||
// dart::dynamics::SkeletonPtr &skeleton = modelInfo->model; | ||
|
||
// std::cout << "SetFreeGroupStaticState " << std::endl; | ||
|
||
// if (skeleton) { | ||
// skeleton->setGravity(_gravity); | ||
// } else { | ||
// } | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void FreeGroupFeatures::SetFreeGroupWorldPose( | ||
const Identity &_groupID, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,58 @@ namespace gz | |
}; | ||
}; | ||
|
||
///////////////////////////////////////////////// | ||
/// \brief This features sets the FreeGroup static state. | ||
class GZ_PHYSICS_VISIBLE SetFreeGroupStaticState | ||
: public virtual FeatureWithRequirements<FindFreeGroupFeature> | ||
{ | ||
/// \brief This class defines the FreeGroup concept, which represents a | ||
/// group of links that are not connected to the world with any kinematic | ||
/// constraints. This class also provides a rough definition of this | ||
/// FreeGroup pose in world frame. See FindFreeGroupFeature class | ||
/// documentation for more detail. | ||
public: template <typename PolicyT, typename FeaturesT> | ||
class FreeGroup : public virtual Entity<PolicyT, FeaturesT> | ||
{ | ||
/// \brief Set this FreeGroup pose in world frame. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update comment? |
||
public: void SetStaticState(bool _state); | ||
}; | ||
|
||
public: template <typename PolicyT> | ||
class Implementation : public virtual Feature::Implementation<PolicyT> | ||
{ | ||
public: virtual void SetFreeGroupStaticState( | ||
const Identity &_groupID, | ||
bool _state) = 0; | ||
}; | ||
}; | ||
|
||
///////////////////////////////////////////////// | ||
/// \brief This features sets the FreeGroup gravity. | ||
class GZ_PHYSICS_VISIBLE SetFreeGroupGravityEnabled | ||
: public virtual FeatureWithRequirements<FindFreeGroupFeature> | ||
{ | ||
/// \brief This class defines the FreeGroup concept, which represents a | ||
/// group of links that are not connected to the world with any kinematic | ||
/// constraints. This class also provides a rough definition of this | ||
/// FreeGroup pose in world frame. See FindFreeGroupFeature class | ||
/// documentation for more detail. | ||
public: template <typename PolicyT, typename FeaturesT> | ||
class FreeGroup : public virtual Entity<PolicyT, FeaturesT> | ||
{ | ||
/// \brief Set this FreeGroup pose in world frame. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update comment? |
||
public: void SetGravityEnabled(bool _enabled); | ||
}; | ||
|
||
public: template <typename PolicyT> | ||
class Implementation : public virtual Feature::Implementation<PolicyT> | ||
{ | ||
public: virtual void SetFreeGroupGravityEnabled( | ||
const Identity &_groupID, | ||
bool _enabled) = 0; | ||
}; | ||
}; | ||
|
||
///////////////////////////////////////////////// | ||
/// \brief This features sets the FreeGroup linear and angular velocity in | ||
/// world frame. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<sdf version="1.6"> | ||
<world name="empty"> | ||
<gravity>0 0 -10</gravity> | ||
<model name="sphere"> | ||
<pose>0 0 2 0 0 3.1416</pose> | ||
<link name="sphere_link"> | ||
<inertial> | ||
<inertia> | ||
<ixx>0.4</ixx> | ||
<ixy>0</ixy> | ||
<ixz>0</ixz> | ||
<iyy>0.4</iyy> | ||
<iyz>0</iyz> | ||
<izz>0.4</izz> | ||
</inertia> | ||
<mass>1.0</mass> | ||
</inertial> | ||
<collision name="sphere_collision"> | ||
<geometry> | ||
<sphere> | ||
<radius>1</radius> | ||
</sphere> | ||
</geometry> | ||
</collision> | ||
<visual name="sphere_visual"> | ||
<geometry> | ||
<sphere> | ||
<radius>1</radius> | ||
</sphere> | ||
</geometry> | ||
</visual> | ||
</link> | ||
</model> | ||
</world> | ||
</sdf> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?