Speed for Segway

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Speed for Segway

Jay Gowdy
I noticed that the SegwayRMP model in Gazebo 0.52 was not producing speed.  A
little code spelunking found me a "TODO: velocities" in the SegwayRMP.cc file.
A little more monkey-see-monkey-do code cutting and pasting of the following at
line 597 of SegwayRMP.cc (based on code from the UpdateOdometry method):

   // [hidden email]: my guess at how to do velocities
   double wd, ws;
   double s1, s2;
   double sr, sa;

   wd = this->wheelDiam;
   ws = this->wheelSep;

   // Average speed for left and right wheels
   s1 = wd / 2 * (this->tireJoints[0]->GetAngleRate());
   s2 = wd / 2 * (this->tireJoints[1]->GetAngleRate());

   sr = (s1 + s2) / 2;
   sa = (s1 - s2) / ws;

   this->iface->data->vel_pos[0] = sr;
   this->iface->data->vel_pos[1] = this->iface->data->vel_pos[2] = 0;

   this->iface->data->vel_rot[0] = this->iface->data->vel_rot[1] = 0;
   this->iface->data->vel_rot[2] = sa;

and it automagically worked as well as I needed.  In the spirit of code first,
ask questions later:  was this a reasonable thing to do?  Is there anything else
missing besides the "stall" detection code?

   Thanks,

     Jay Gowdy


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: Speed for Segway

Nate Koenig
Hello,

Thanks for the code, it looks good to me.

-nate

On 11/17/05, Jay Gowdy <[hidden email]> wrote:

> I noticed that the SegwayRMP model in Gazebo 0.52 was not producing speed.  A
> little code spelunking found me a "TODO: velocities" in the SegwayRMP.cc file.
> A little more monkey-see-monkey-do code cutting and pasting of the following at
> line 597 of SegwayRMP.cc (based on code from the UpdateOdometry method):
>
>    // [hidden email]: my guess at how to do velocities
>    double wd, ws;
>    double s1, s2;
>    double sr, sa;
>
>    wd = this->wheelDiam;
>    ws = this->wheelSep;
>
>    // Average speed for left and right wheels
>    s1 = wd / 2 * (this->tireJoints[0]->GetAngleRate());
>    s2 = wd / 2 * (this->tireJoints[1]->GetAngleRate());
>
>    sr = (s1 + s2) / 2;
>    sa = (s1 - s2) / ws;
>
>    this->iface->data->vel_pos[0] = sr;
>    this->iface->data->vel_pos[1] = this->iface->data->vel_pos[2] = 0;
>
>    this->iface->data->vel_rot[0] = this->iface->data->vel_rot[1] = 0;
>    this->iface->data->vel_rot[2] = sa;
>
> and it automagically worked as well as I needed.  In the spirit of code first,
> ask questions later:  was this a reasonable thing to do?  Is there anything else
> missing besides the "stall" detection code?
>
>    Thanks,
>
>      Jay Gowdy
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> Playerstage-gazebo mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
<a href="http://ads.osdn.com/?ad_idv28&alloc_id845&op=click">http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo