Re: [ros-users] Flexible & remote transmission

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ flexible_transmission.cpp (text/x-c++src)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] Flexible & remote transmission
Okay I'm looking into the flexibility between the actuator and the joint by
adding a custom transmission but I'm having some difficulties.

I've looked into the existing transmissions and those are pretty
straightforward (except for the pr2_gripper).
I want to add the (linear, rotational) flexibility, I will neglect the
damping for simplicity.
I'm used to use the equations of motion:
Load: Jl theta_L_ddot + k ( theta_L - theta_M ) = 0
Motor: Jm theta_M_ddot - k ( theta_L - theta_M ) = u

I don't get it how to implement this in the transmission. I was thinking of
a little bit of rewriting as in the attachment but it did not influence
anything at all.
Would be great if someone has an idea, solution or suggestion on how
implementing this flexibility.

Thanks in advance

Jeroen

On Sat, Nov 20, 2010 at 21:07, Stuart Glaser <>wrote:

> Hi Joeren,
>
> For both of these, the solution is to write a transmission. Both
> issues require a specific translation between actuators and joints,
> and the best way to encode that translation is in a transmission.
>
> -Stu
>
> On Fri, Nov 19, 2010 at 1:36 AM, Jeroen Willems <>
> wrote:
> > Hi All,
> >
> > I'm currently modeling a hexapod in Gazebo but I'm currently having some
> > difficulties.
> >
> > I have basically 2 questions, I hope that this is not a problem for one
> post
> > but both have to do with the transmission:
> >
> > 1) Between the actuators and the joints are torsion springs. I haven't
> found
> > something that incorporates flexibility between actuators and joints.
> > Is there some solution or workaround to obtain this or should I try an
> > alternative solution like writing a custom transmission?
> >
> > 2) As you can imagine I have 6 legs consisting of three links, basically
> an
> > elbow manipulator.
> > The last two links can be regarded as in a 2D-plane. The third link is
> > remotely driven.
> > This means that when rotating the second link the third link does not
> change
> > the rotation with respect to the body.
> > So in a 'standard' situation the third link rotates with the second link
> so
> > the angle between those two does not change.
> > I hope this is a bit clear.
> > So again is there some solution or workaround?
> >
> > Thanks!
> >
> > Jeroen
> >
> > _______________________________________________
> > ros-users mailing list
> >
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> >
>
>
>
> --
> Stuart Glaser
> sglaser -at- willowgarage -dot- com
> www.willowgarage.com
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>

#include <math.h>
#include <pluginlib/class_list_macros.h>
#include <pr2_mechanism_model/robot.h>
#include "hexapod_mechanism/flexible_transmission.h"

using namespace pr2_mechanism_model;
using namespace pr2_hardware_interface;
using namespace hexapod_transmission;

PLUGINLIB_DECLARE_CLASS(hexapod_mechanism, FlexibleTransmission, 
                         hexapod_transmission::FlexibleTransmission, 
                         pr2_mechanism_model::Transmission)



bool FlexibleTransmission::initXml(TiXmlElement *elt, Robot *robot)
{
const char *name = elt->Attribute("name");
name_ = name ? name : "";

  TiXmlElement *jel = elt->FirstChildElement("joint");
  const char *joint_name = jel ? jel->Attribute("name") : NULL;
  if (!joint_name)
  {
    ROS_ERROR("FlexibleTransmission did not specify joint name");
    return false;
  }


  const boost::shared_ptr<const urdf::Joint> joint = robot->robot_model_.getJoint(joint_name);
  if (!joint)
  {
    ROS_ERROR("FlexibleTransmission could not find joint named \"%s\"", joint_name);
    return false;
  }
  joint_names_.push_back(joint_name);


  TiXmlElement *ael = elt->FirstChildElement("actuator");
  const char *actuator_name = ael ? ael->Attribute("name") : NULL;
  Actuator *a;
  if (!actuator_name || (a = robot->getActuator(actuator_name)) == NULL )
  {
    ROS_ERROR("FlexibleTransmission could not find actuator named \"%s\"", actuator_name);
    return false;
  }
  a->command_.enable_ = true;
  actuator_names_.push_back(actuator_name);


mechanical_reduction_ = atof(elt->FirstChildElement("mechanicalReduction")->GetText());
transmission_stiffness_ = atof(elt->FirstChildElement("transmissionStiffness")->GetText());

return true;
}

void FlexibleTransmission::propagatePosition(std::vector<Actuator*>& as, std::vector<JointState*>& js)
{
assert(as.size() == 1);
assert(js.size() == 1);
js[0]->position_ = as[0]->state_.position_ + js[0]->reference_position_ - as[0]->command_.effort_/transmission_stiffness_;
js[0]->velocity_ = as[0]->state_.velocity_ ;
js[0]->measured_effort_ = as[0]->state_.last_measured_effort_;
}

void FlexibleTransmission::propagatePositionBackwards(std::vector<JointState*>& js, std::vector<Actuator*>& as)
{
assert(as.size() == 1);
assert(js.size() == 1);
as[0]->state_.position_ = js[0]->position_ - js[0]->reference_position_ + as[0]->command_.effort_/transmission_stiffness_;
as[0]->state_.velocity_ = js[0]->velocity_;
as[0]->state_.last_measured_effort_ = js[0]->measured_effort_;
}

void FlexibleTransmission::propagateEffort(std::vector<JointState*>& js, std::vector<Actuator*>& as)
{
assert(as.size() == 1);
assert(js.size() == 1);
as[0]->command_.effort_ = js[0]->commanded_effort_ + transmission_stiffness_*( js[0]->position_ - as[0]->state_.position_);
// ROS_INFO("Flex: Command effort %f %f", js[0]->commanded_effort_, transmission_stiffness_*( js[0]->position_ - as[0]->state_.position_));
}

void FlexibleTransmission::propagateEffortBackwards(std::vector<Actuator*>& as, std::vector<JointState*>& js)
{
assert(as.size() == 1);
assert(js.size() == 1);
js[0]->commanded_effort_ = as[0]->command_.effort_ - transmission_stiffness_*( js[0]->position_ - as[0]->state_.position_);
}