Gazebo | Ignition | Community
Ask Your Question

hal9000's profile - activity

2020-07-23 10:13:36 -0500 received badge  Famous Question (source)
2020-02-09 18:22:54 -0500 received badge  Taxonomist
2015-09-07 19:14:24 -0500 received badge  Notable Question (source)
2015-09-07 14:53:29 -0500 received badge  Famous Question (source)
2015-09-07 14:53:29 -0500 received badge  Notable Question (source)
2015-05-21 20:30:16 -0500 received badge  Popular Question (source)
2015-04-19 04:05:34 -0500 received badge  Editor (source)
2015-04-19 04:03:28 -0500 asked a question Problem implementing mimic joints

Hi,

A while back I noticed this post from the MoveIt! group regarding mimic joints in Gazebo (I'm using gazebo 2.x with ROS Indigo in Ubuntu 14.04): MooveIt! Users

Gonçalo Cabrita posted gazebo plugin code that seemed to make sense. Just set the mimic joint angle based on the reference joint. This is (essentially) his code:

#include "gazebo_plugins/mimic_plugin.h"
#include <gazebo/common/Plugin.hh>
#include <ros/ros.h>

using namespace gazebo;

  MimicPlugin::MimicPlugin()
  {
    kill_sim = false;

    joint_.reset();
    mimic_joint_.reset();
  }

  MimicPlugin:: ~MimicPlugin()
  {
    event::Events::DisconnectWorldUpdateBegin(this->updateConnection);

    kill_sim = true;
  }

  void  MimicPlugin::Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf )
  {
    this->model_ = _parent;
    this->world_ = this->model_->GetWorld();


    joint_name_ = "joint";
    if (_sdf->HasElement("joint"))
      joint_name_ = _sdf->GetElement("joint")->Get<std::string>();

    mimic_joint_name_ = "mimicJoint";
    if (_sdf->HasElement("mimicJoint"))
      mimic_joint_name_ = _sdf->GetElement("mimicJoint")->Get<std::string>();

    multiplier_ = 1.0;
    if (_sdf->HasElement("multiplier"))
      multiplier_ = _sdf->GetElement("multiplier")->Get<double>();


    // Get the name of the parent model
    std::string modelName = _sdf->GetParent()->Get<std::string>("name");

    // Listen to the update event. This event is broadcast every
    // simulation iteration.
    this->updateConnection = event::Events::ConnectWorldUpdateBegin(boost::bind(&MimicPlugin::UpdateChild, this));
    gzdbg << "Plugin model name: " << modelName << "\n";

    joint_ = model_->GetJoint(joint_name_);
    mimic_joint_ = model_->GetJoint(mimic_joint_name_);
  }

  void  MimicPlugin::UpdateChild()
  {
    mimic_joint_->SetAngle(0, math::Angle(joint_->GetAngle(0).Radian()*multiplier_));
  }

  GZ_REGISTER_MODEL_PLUGIN(MimicPlugin);

My problem is that, after I load/use this plugin, I get really strange physics behavior any time I try to move an object with the link connected to the mimic joint. With the slightest contact, the object seems to bounce in random directions. It seems pretty straight forward, but I can't seem to figure out what I'm doing wrong.

John Hsu discussed this a while back in an answer to the question back in 2011 ROS Answers, Gazebo mimic joints , and made some mention of needing to implement a mimic constraint in the physics engine.

Is there any way in Gazebo 2.x to get mimic tags to work?

Thanks!

2015-04-09 14:03:32 -0500 received badge  Student (source)
2015-03-30 18:48:36 -0500 received badge  Popular Question (source)
2015-03-30 13:06:11 -0500 commented answer SkyX integration and advanced features?

I see the code now, and I finally realized that the sun is always "on" while it's daytime. I never noticed it because it was always so high in the sky! I'd like to connect the skyX sun location to a light source (a modified sun model?) that tracks the sun direction (via getSunDirection()). Perhaps that could be done with a plugin?

2015-03-30 13:02:14 -0500 commented answer SkyX integration and advanced features?

Ok, Thanks!

2015-03-19 14:58:48 -0500 asked a question SkyX integration and advanced features?

Hi, I'm looking to get a more realistic sky in my simulation, including a sun or moon. It seems that the sdf <sky> </sky> tags trigger use of SkyX in Gazebo. If I wanted to use more of SkyX than what's in the sdf spec, would I need to write a Gazebo plugin, and where do I look for the hooks into the sky rendering within Gazebo?

Thanks!

2015-03-19 14:37:14 -0500 commented answer Blue Skies in Gazebo 1.9

I'm having trouble with the sdf1.4 sky link in your answer above. Has this URL moved? Also, If I wanted to paint a real sun in the sky, where in the code should I start? Thanks!