robotology / gym-ignition

Framework for developing OpenAI Gym robotics environments simulated with Ignition Gazebo

Home Page:https://robotology.github.io/gym-ignition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apply external link forces

diegoferigo opened this issue · comments

The Physics system already requires the physics engine to support ignition::physics::AddLinkExternalForceTorque:

ignition::physics::AddLinkExternalForceTorque,

and used here below:

// Link wrenches
_ecm.Each<components::ExternalWorldWrenchCmd>(
[&](const Entity& _entity, const components::ExternalWorldWrenchCmd* _wrenchComp) {
auto linkIt = this->entityLinkMap.find(_entity);
if (linkIt == this->entityLinkMap.end())
return true;
math::Vector3 force = msgs::Convert(_wrenchComp->Data().force());
math::Vector3 torque = msgs::Convert(_wrenchComp->Data().torque());
linkIt->second->AddExternalForce(math::eigen3::convert(force));
linkIt->second->AddExternalTorque(math::eigen3::convert(torque));
return true;
});

We should add a new ExternalForceTorque component and extend the robot_links interface.