|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
|
|
#47
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
Quote:
Quote:
|
|
#48
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
![]() I find it interesting how dropping an adjective from a sentence can really change the meaning. FWIW I am not good at writing papers, but I can submit some code example when I get to that point. |
|
#49
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
If so, how do you sense when the rotation has reached its angle? potentiometer? IIRC Bomb Squad uses windows motors on each wheel to control the swerve. From what I have heard, other teams use a rod to swerve both front wheels the same amount, and can then have a manual control setup doing it this way. |
|
#50
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
|
|
#51
|
||||
|
||||
|
Re: WCD vs. Swerve
"Originally Posted by JamesTerm
The other half will be the reverse of that where given the wheel angles and speeds, what is the current x, y and rotational (i.e. angular) velocities. " For 2 reasons... one is to render the images position on our simulation. I use text graphics on OSG (open scene graph). The other reason is for autonomous where if I can interpolate the position on a 2D field I can calculate the desired velocity and orientation to hit a target. I have achieved these tasks with WCD, but I have not yet confirmed angular motion (logomotion did not require that). I am still researching this, but I believe I can have accurate angular turns if I have reliable encoder readings of distance. Anyhow... none of this matters if we switch to swerve. |
|
#52
|
||||
|
||||
|
Re: WCD vs. Swerve
Under what circumstances would you ever be commanding wheel speeds and steering angles that are not the result of an inverse kinematic calculation? If you are using kinematically correct speeds and steering angles for all four wheels, you should be getting the vehicle translational and rotational velocities which were used to compute those speeds and steering angles1. Use those vehicle translational and rotational velocities to render the image's position in your simulation. If your concern is about rapidly changing operator commands and the dynamic response of your steering and/or drive motors, and you are envisioning measuring actual wheel speeds and steering angles and using them to figure out where the vehicle is over time, then yes, you would need a way to compute what the vehicle is doing at each moment in time based on the measured wheel speeds and angles. How do you propose to do this computation? 1 unless your wheels are slipping/sliding (due to an obstruction perhaps). In that case predicting vehicle motion accurately without additional sensors seems problematic. Quote:
|
|
#53
|
||||
|
||||
|
Re: WCD vs. Swerve
If the wheel speeds and steering angles are not too far from an inverse kinematic solution, the following computation may be adequate to estimate vehicle behavior:
Code:
FWD = (sFR*cos(aFR)+sFL*cos(aFL)+sRL*cos(aRL)+sRR*cos(aRR))/4; STR = (sFR*sin(aFR)+sFL*sin(aFL)+sRL*sin(aRL)+sRR*sin(aRR))/4; omega = ((sFR*cos(atan2(W,L)+pi/2-aFR)+sFL*cos(atan2(-W,L)+pi/2-aFL) +sRL*cos(atan2(-W,-L)+pi/2-aRL)+sRR*cos(atan2(W,-L)+pi/2-aRR))/4)/ (sqrt(L^2+W^2)/2); L and W are wheelbase and trackwidth in inches |
|
#54
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
![]() Now that you have submitted these... I gotta try them out and let you know how they behave... I hope to have something written in the next few days. Thanks again! P.S. I do as you say take actual measurments and work with these over a slice of time... the slice of time is measured in the main loop and submitted as a delta double seconds parameter through the entire cycle. (I do not use any other threads... i.e. my own PID). |
|
#55
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
|
|
#56
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
dimensions.length is sqrt(l*l + w*w) |
|
#57
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
![]() |
|
#58
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
This is what I have confirmed the omega equation to be: Code:
const double omega = (((_.sFR*cos(atan2(W,L)+(HP-_.aFR))/4)+ (_.sFL*cos(atan2(-W,L)+(HP-_.aFL))/4)+ (_.sRL*cos(atan2(-W,-L)+(HP-_.aRL))/4)+ (_.sRR*cos(atan2(W,-L)+(HP-_.aRR))/4))); Code:
void PhysicsEntity_2D::ApplyFractionalForce( const osg::Vec2d &force, const osg::Vec2d &point,double FrameDuration )
{
//Use this as a "get by" if the code doesn't work properly
#if 0
ApplyFractionalForce(force,FrameDuration);
return;
#endif
//Here is a rough draft to solve in 2 dimensions
//A=atan2(py,px) point
//M=pi/2 - A
//L=atan2(fy,fx) force
//N=L+M
//Y=sin(N)*f.length = contribution for force
//X=cos(N)*f.length = contribution for torque
double TorqueToApply;
osg::Vec2d ForceToApply;
double RadialArmDistance;
{
double A=atan2(point[1],point[0]);
double M=(M_PI/2) - A;
double L=atan2(-force[1],-force[0]);
double N=L+M;
double ForceLength= sqrt((force[1]*force[1])+(force[0]*force[0]));
RadialArmDistance= sqrt((point[1]*point[1])+(point[0]*point[0]));
//I've reserved a special case for ships which haven't specified their radius size, in which case we simply factor out the radial arm too
if ((m_RadiusOfConcentratedMass==1.0)&&(RadialArmDistance>1.0)) RadialArmDistance=1.0;
//Fr = t ... We should multiply force by the radial arm distance to get the torque
//but instead, we pass it off to physics where the multiply gets applied directly against the Radius of Concentrated Mass
//We could multiply here but doing it the other way keeps the torque value low, which also makes it easier to debug
TorqueToApply=(cos(N)*ForceLength);
}
osg::Vec2d vecToCenter = -point;
//Note we should be able to support a point set at 0,0,0 in which case we use the force itself as the direction... otherwise a zero'd point
//results in a zero'd vector which would omit applying the force
if (vecToCenter.length2()==0.0)
vecToCenter=-force;
vecToCenter.normalize();
ForceToApply = vecToCenter * (force * vecToCenter);
ApplyFractionalForce(ForceToApply,FrameDuration);
ApplyFractionalTorque(TorqueToApply,FrameDuration,RadialArmDistance);
}
|
|
#59
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
Quote:
There was a typo in my original post. The notes at the bottom said "L and W are wheelbase and trackwidth in inches". That should have said feet. Last edited by Ether : 24-12-2011 at 15:36. Reason: added note about units for L & W |
|
#60
|
||||
|
||||
|
Re: WCD vs. Swerve
Quote:
http://www.termstech.com/files/SwerveDriveDemo.wmv The demo adds a layer of swivel management where it is paced to 18 radians per second on angular acceleration and only 270 degrees of freedom. Thanks again for these equations... now I just need a swerve drive robot to put this software on. ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|