Gazebo | Ignition | Community
Ask Your Question

Tytteboevsen's profile - activity

2018-06-25 15:47:52 -0600 received badge  Nice Answer (source)
2015-12-16 00:15:26 -0600 received badge  Famous Question (source)
2015-07-02 10:43:29 -0600 received badge  Student (source)
2015-07-02 10:41:12 -0600 received badge  Notable Question (source)
2015-05-23 15:50:54 -0600 received badge  Famous Question (source)
2015-05-23 15:50:50 -0600 received badge  Popular Question (source)
2015-05-21 02:23:25 -0600 received badge  Necromancer (source)
2015-05-20 13:31:49 -0600 answered a question A simple method to tune PID gains

Tuning a PID controller in gazebo is not different from tuning any other PID controller... and that is not easy. there are some rule of thumbs Ziegler Nichols method and look under How do the PID parameters affect system dynamics? but the last time I did it i used trial and error. If you where to go all in you could make a neural network to uptimise the gains... I plan on using this approach on a robot i am building.

Short answer: There is no simple way of tuning a PID controller.

2015-05-20 13:07:59 -0600 commented question Control Gazebo via sockets with Matlab

I see. Best of luck to you on your thesis. I was so happy when i did mine. A topic of you own choosing and getting time to do it. Not everyday you employer lets you do that. I cannot help you with matlab unfortunatly. Let us know if you find a solution. Best regards Tytteboevsen.

2015-05-20 12:21:52 -0600 commented question Control Gazebo via sockets with Matlab

This is not an answer but just wondering why don't you just use python instead of matlab. I changed from matlab to python years ago and its been great and free! If you choose to use python you can use pygazebo to interface with gazebosim.

2015-05-20 11:30:21 -0600 commented question How to get Base pointer from gazebo ?

Check you post again. I answered.

2015-05-20 11:25:52 -0600 answered a question How to Get Velocity of a joint using API ?

Hi Akshay5059

Here is a program i wrote some time ago. As i recall it works. let me know if you have any problems with it. I do not know about base pointers i just remember getting this to work:

#include <boost/bind.hpp>
#include <gazebo.hh>
#include <physics/physics.hh>
//#include <physics/World.hh> //added to use getsimtime
#include <common/common.hh>
#include <stdio.h>
#include <unistd.h> // sleep function you added yourself
#include <gazebo/physics/Joint.hh> //These two lines you added to use the function getforcetorque
#include <gazebo/physics/JointWrench.hh> //These two lines you added to use the function getforcetorque

int a=0;
int b;
double angle;
double currenttime;
double PI = 3.141592654;
namespace gazebo
{  
/*  class HelloWorld : public WorldPlugin
  {
    public: HelloWorld() : WorldPlugin() 
        {
          printf("Hello World!\n");
        }

    public: void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
        {
        }

  };*/
  class SetJoints : public ModelPlugin
  {
    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) 
    {
      // Store the pointer to the model
      this->model = _parent;

      this->j2_controller = new physics::JointController(model);

      //this->last_update_time_ = this->model->GetWorld()->GetSimTime(); //Trying to get simtime. not needed.

      this->joint1_ = this->model->GetJoint("my_joint1");
      this->joint2_ = this->model->GetJoint("my_joint2");

      //physics::JointPtr joint = this->model->GetJoint("my_joint");
      //physics::JointWrench wrench = joint->GetForceTorque(0);

      // Listen to the update event. This event is broadcast every
      // simulation iteration.
      this->updateConnection = event::Events::ConnectWorldUpdateBegin(
      boost::bind(&SetJoints::OnUpdate, this, _1));
    }

    // Called by the world update start event
    public: void OnUpdate(const common::UpdateInfo & /*_info*/)
    {
      common::Time current_time = this->model->GetWorld()->GetSimTime();//getting simtime
      // Apply a small linear velocity to the model.
      //this->model->SetLinearVel(math::Vector3(.03, 0, 0));
      std::string j2name("my_joint");  

      double current_angle = this->joint1_->GetAngle(0).Radian();
      double current_vel = this->joint1_->GetVelocity(0);
      physics::JointWrench wrench1 = this->joint1_->GetForceTorque(0);
      //double forcetorque = this->joint_->GetForceTorque(0);
      //double current_forcetorque = this->joint_->GetForce(0); //doesn't work yet. try using GetForce

      //a=0;
      //b=45;
      //angle=current_time.Double();
      //angle=a/1000.;
      float test = wrench1.body2Force[2];

      angle=current_angle+PI;
      printf("Hello World! %lf\n",test);
//      printf("Hello World!\n");
      //j2_controller->SetJointPosition(this->model->GetJoint("my_joint"), angle);
      //usleep(1);
      a++;


    }

    // Pointer to the model
    private: physics::ModelPtr model;

    // Pointer to the update event connection
    private: event::ConnectionPtr updateConnection;

    private: physics::JointController * j2_controller;

    //common::Time last_update_time_; Not needed

    //Things for saving joint_ in.
    physics::JointPtr joint1_;
    physics::JointPtr joint2_;
    //physics::JointPtr joint;

  };

  // Register this plugin with the simulator
  GZ_REGISTER_MODEL_PLUGIN(SetJoints)
}
2015-05-20 09:14:16 -0600 answered a question Pygazebo python gazebo interface

I got it to work using this code:

# -*- coding: utf-8 -*-
"""
Created on Mon Nov 24 19:23:30 2014

@author: morten
"""

import pygazebo
import pygazebo.msg.joint_cmd_pb2

import trollius
from trollius import From

#import pygazebo
#import pygazebo.msg.joint_cmd_pb2

@trollius.coroutine
def publish_loop():
    manager = yield From(pygazebo.connect())

    publisher = yield From(
    manager.advertise('/gazebo/default/my_robot/joint_cmd',
                      'gazebo.msgs.JointCmd'))

    message = pygazebo.msg.joint_cmd_pb2.JointCmd()
    message.name = 'my_robot::left_wheel_hinge'
    message.axis = 0
    message.force = 1.0

    while True:
    yield From(publisher.publish(message))
    yield From(trollius.sleep(1.0))

loop = trollius.get_event_loop()
loop.run_until_complete(publish_loop())
2015-05-19 11:49:43 -0600 received badge  Self-Learner (source)
2015-05-19 11:49:43 -0600 received badge  Teacher (source)
2015-05-19 11:20:11 -0600 commented question How to Get Velocity of a joint using API ?

Are you using c++? I know you write you dont want to use a plugin but i just need to be certain.

2015-05-19 07:01:26 -0600 answered a question Orientation of mass moment of inertia

I think i get it now. To do what i want to I guess you have to:

First make sure where you initial reference frame is of the link. If you imported an stl or dae file this is the origo of you drawing.

Next find out where the COM is located acoording to this initial reference frame and use this in the link sdf under pose under xyz.

Then align the inertia axis as you wish and rotate them using the rpy of the same pose parameter.

You now have placed the COM according relative to the link reference frame and aligned the axis of the inertia matrix.

Now enter the inertia matrix according to the axis and through the COM. Link to example

Please note that the pose parameter is under the inertial parameter and this denotes the position of the COM relative to the link reference frame and that the rpy denotes the orientation of the inertia matrix.

Hope this helps someone else.

2015-05-19 05:52:41 -0600 asked a question Pygazebo python gazebo interface

I am trying to get python and gazebo working together using pygazebo but i cannot get it to work. I know there is an old threat about it but i decided to start a new one. Old threat on python and gazebo

I am trying to make it as simple as possible and therefore only making one joint move through python. I tried to start gazebo and then insert a robot and then control one of the wheels.

Here is the model.config file:

<?xml version="1.0"?>
<model>
  <name>my_robot1</name>
  <version>1.0</version>
  <sdf version='1.4'>model.sdf</sdf>

  <author>
   <name>My Name</name>
   <email>me@my.email</email>
  </author>

  <description>
    My awesome robot.
  </description>
</model>

And the model.sdf file:

<?xml version='1.0'?>
<sdf version='1.4'>
  <model name="my_robot">
    <static>false</static>

      <link name='chassis'>
        <pose>0 0 .1 0 0 0</pose>

        <collision name='collision'>
          <geometry>
            <box>
              <size>.4 .2 .1</size>
            </box>
          </geometry>
        </collision>

        <visual name='visual'>
          <geometry>
            <box>
              <size>.4 .2 .1</size>
            </box>
          </geometry>
        </visual>

      <collision name='caster_collision'>
        <pose>-0.15 0 -0.05 0 0 0</pose>
        <geometry>
            <sphere>
            <radius>.05</radius>
          </sphere>
        </geometry>

        <surface>
          <friction>
            <ode>
              <mu>0</mu>
              <mu2>0</mu2>
              <slip1>1.0</slip1>
              <slip2>1.0</slip2>
            </ode>
          </friction>
        </surface>
      </collision>

      <visual name='caster_visual'>
        <pose>-0.15 0 -0.05 0 0 0</pose>
        <geometry>
          <sphere>
            <radius>.05</radius>
          </sphere>
        </geometry>
      </visual>

      </link>

      <link name="left_wheel">
    <pose>0.1 0.13 0.1 0 1.5707 1.5707</pose>
    <collision name="collision">
      <geometry>
        <cylinder>
          <radius>.1</radius>
          <length>.05</length>
        </cylinder>
      </geometry>
    </collision>
    <visual name="visual">
      <geometry>
        <cylinder>
          <radius>.1</radius>
          <length>.05</length>
        </cylinder>
      </geometry>
    </visual>
      </link>

      <link name="right_wheel">
    <pose>0.1 -0.13 0.1 0 1.5707 1.5707</pose>
    <collision name="collision">
      <geometry>
        <cylinder>
          <radius>.1</radius>
          <length>.05</length>
        </cylinder>
      </geometry>
    </collision>
    <visual name="visual">
      <geometry>
        <cylinder>
          <radius>.1</radius>
          <length>.05</length>
        </cylinder>
      </geometry>
    </visual>
      </link>

      <joint type="revolute" name="left_wheel_hinge">
    <pose>0 0 -0.03 0 0 0</pose>
    <child>left_wheel</child>
    <parent>chassis</parent>
    <axis>
      <xyz>0 1 0</xyz>
    </axis>
      </joint>

      <joint type="revolute" name="right_wheel_hinge">
    <pose>0 0 0.03 0 0 0</pose>
    <child>right_wheel</child>
    <parent>chassis</parent>
    <axis>
      <xyz>0 1 0</xyz>
    </axis>
      </joint>

  </model>
</sdf>

And finally my pygazebo.py script:

# -*- coding: utf-8 -*-
"""
Created on Mon Nov 24 19:23:30 2014

@author: morten
"""

import trollius
from trollius import From

import pygazebo
import pygazebo.msg.joint_cmd_pb2

@trollius.coroutine
def publish_loop():
    manager = yield From(pygazebo.connect())

    publisher = yield From(
    manager.advertise('/gazebo/default/model/joint_cmd',
                      'gazebo.msgs.JointCmd'))

    message = pygazebo.msg.joint_cmd_pb2.JointCmd()
    message.name = 'my_robot1::left_wheel_hinge'
    message.axis = 0
    message.force = 1.0

    #while True:
    yield From(publisher.publish(message))
    yield From(trollius.sleep(10.0))

loop = trollius.get_event_loop()
loop.run_until_complete(publish_loop())

Any help would be appreciated.

2015-05-18 18:24:40 -0600 received badge  Notable Question (source)
2015-05-18 17:50:41 -0600 commented answer How to use Python with Gazebo

Anybody got pygazebo working. Can't get it to work.

2015-05-17 18:32:16 -0600 received badge  Popular Question (source)
2015-05-17 14:59:57 -0600 commented answer Orientation of mass moment of inertia

Please see my website here http://mortenmichaellindahl.com/Robotics.html for more info about my robot. Scroll down for images. The thing is my ankle is tilted 15 degrees and when i do the control of the robot i need the inertia calculated along this tilted axel. My hope was that i could use the same in gazebosim. Hope this clarifies it.

2015-05-16 04:02:41 -0600 asked a question Orientation of mass moment of inertia

How should the orientation of the mass moment of inertia matrix be?

An example: Lets assume we have a cube and we are gonna make a joint angled 45 degrees on one of the sides. should i then calculate and orient the mass moment of inertia matrix according to this joint - angled 45 degrees. Or should i just calculate the Mass moment of inertia acoording to the initial reference frame?

Hope my question is clear.