![]() |
|
|||||||
| Addon Development Developers post news, updates, & discussions here about your projects in development. |
![]() |
|
|
Thread Tools |
|
by gattispilot 04-10-2012, 01:12 PM
I have been asked about making a swiveling attachment. The attachment vessel has a child that attaches to a parent vessel and then a parent that then would attach to a child on the second vessel. In this case it is a rover that Donamy is working on.
![]() little thrust and wheels turned ( I think the cart/rear part should be at an angle also) ![]() no thrust ![]() More Forward Thrust applied and wheels turned What I have is the X vector is measured and then based on that the angle of the direction part of the attachment is set. Code:
VECTOR3 speedvec; // first we define our vector which will recieve the data oapiGetFocusShipAirspeedVector(&speedvec);//then we retrieve its x,y,z //CART[ROT] =_V(0, cos((speedvec.x)*PI), -sin((speedvec.x)*PI)); //ANGLE=speedvec.x/10;//CHANGES HOW MUCH OF AN ANGLE CHANGE ANGLE=speedvec.x*10; if ((ANGLE)>.2) ANGLE=.2;//SETS LIMIT OF ANGLE CHANGE if ((ANGLE)<-.2) ANGLE=-.2;// SETS LIMIT OF ANGLE CHANGE CART[DIR] =_V( -sin((ANGLE)*PI),0, -cos((ANGLE)*PI)); //if ((ANGLE)>.2) ANGLE=.2;//SETS LIMIT OF ANGLE CHANGE //if ((ANGLE)<-.2) ANGLE=-.2;// SETS LIMIT OF ANGLE CHANGE SetAttachmentParams(FG2,_V(0,0,0),CART[DIR],_V(0,1,0));//SETS NEW ATTACHMENT double sin1=sin((ANGLE)*PI); double cos1=cos((ANGLE)*PI); //if ((speedvec.z>0)&&(speedvec.x==0))SetAttachmentParams(FG2,_V(0,0,1),_V(0,0,1),_V(0,1,0)); sprintf(oapiDebugString(),"ANGLE %2.2f speedvec.x %2.2f sin1 %2.2f cos %2.2f,", ANGLE,speedvec.x,sin1,cos1 ); |
|
Views 689
Comments 10
|
| Thanked by: |
|
|
#3 |
|
Addon Developer
![]() |
Thanks I messaged him.
|
|
|
|
|
|
#4 |
|
Addon Developer
![]() |
I have moved this a vessel. I can get the attachment to move by looking at the rudder and adjusting that value. But I need to have it move later than the vessel turns. Any ideas? So when the vessel turn the trailer continues along and then turns accordingly.
|
|
|
|
|
|
#5 |
|
Orbinaut
|
Setting the attachment based on rudder position won't work. As you noted, the timing doesn't match. Also, this won't work if the vehicle is backing up.
There seem to be two main options. One is to create the IK algorithms (with appropriate constraints) yourself and incorporate them into vessel code. The second is to use a separate physics engine that can perform the IK solutions for you. The only real return data you would need is the angle between the parent and child. I forget which engine I was looking at for this, but any engine that could support a truck-trailer combination would work. The engine could use a "flat" world (rather than Orbiter's round world) unless you were trying to support terrain meshes (such as the outdated Meshland project). Either way, it's not easy. Hopefully someone will come up with a brilliant shortcut that works! |
|
|
|
| Thanked by: |
|
|
#6 |
|
Addon Developer
![]() |
Thanks. I started to look for some IK algorithms. I think it is beyond me.
Looking at the Inverse Kinetics IK it appears to be like the robotic arm? I found this:http://www.darwin3d.com/gamedev/articles/col0998.pdf I guess the two lengths would be the distance from the front wheels and the connection. The 2nd distance would be the distance from connector to rear wheels. But then using his formula. That would set the angle, right? Last edited by gattispilot; 04-19-2012 at 02:25 PM. |
|
|
|
|
|
#7 |
|
Beta Tester
![]() ![]() ![]() |
Something that seems so simple, has stumped all the rocket scientist here. How does Rigs and Rods do it ?
|
|
|
|
|
|
#8 |
|
Addon Developer
![]() |
Is there a way to find out the angle a vessel is turning? I tried the oapiGetFocusBank(&bank)
|
|
|
|
|
|
#9 |
|
Moderator
![]() ![]() ![]() |
Quote:
The problem here is that while we have the information, actually designing and programming such a system requires a sub physics engine. ---------- Post added at 10:07 AM ---------- Previous post was at 10:04 AM ---------- It is not unlike the SpaceX factory: They have the tools and materials to make a car, but the design and production of the car from those tools and materials is quite hard. |
|
|
|
|
|
#10 |
|
Addon Developer
![]() |
Looking to find the yaw rate. I saw this post:
http://orbiter-forum.com/showthread.php?t=10845 Code:
GetAngularVel (avel); double wrate=(avel.y); sprintf(oapiDebugString(),"i3 %2.2f ANGLE1 %2.2f YAW2 %2.2f YAW3 %5.20f,", i3,ANGLE1,YAW2,wrate ); Last edited by gattispilot; 04-24-2012 at 09:50 PM. |
|
|
|
| Thanked by: |
|
|
#11 |
|
Addon Developer
![]() |
Here is a video of what we have. The turn angle is based off of the rudder/wheels.
http://s373.photobucket.com/albums/o...OVER13TEST.mp4 One thing that is odd is the dll version runs slower than the sc3. The values appear to be the same though. Code:
SetSize (6); SetEmptyMass (610.0); // SetCW (0.3, 0.3, 0.6, 0.9); SetCW(0.09,0.09,2,1.4); //SetWingAspect (0.1); //..SetWingEffectiveness (0.1); SetCrossSections (_V(10.69,10.71,6.81)); //SetRotDrag (_V(0.1,0.1,0.1)); SetPitchMomentScale (0.00005); SetBankMomentScale (0.00005); SetPMI (_V(0.50,0.50,0.50)); SetTrimScale (0.05); SetCameraOffset (_V(0,1.176,1.352)); SetTouchdownPoints (_V(0,-1,1.502), _V(-1.09,-1,0), _V(1.09,-1,0));; th_main = CreateThruster (_V(0,0,0), _V(0,0,1), MAXMAINTH, TANK, ISP); CreateThrusterGroup (&th_main, 1, THGROUP_MAIN); th_retro = CreateThruster (_V(0,0,0), _V(0,0,-1), MAXRETROTH, TANK, ISP); CreateThrusterGroup (&th_retro, 1, THGROUP_RETRO); Code:
const double FUELMASS = 9709; const double ISP = 2983; const double MAXMAINTH = 15000; const double MAXRETROTH = 15000; const double MAXRCSTH = 15000; the sc3 version: EMPTY_MASS=610 FUEL_MASS=9709 MAIN_THRUST=15000 RETRO_THRUST=15000 HOVER_THRUST=0 ATTITUDE_THRUST=15000 ISP=2983 ;2913.76 ;PMI=(1.09,1.10,0.82) PMI=(0.50,0.50,0.50) CROSS_SECTION=(10.69,10.71,6.81) PITCH_MOMENT_SCALE=0.00005 BANK_MOMENT_SCALE=0.00005 LAND_PT1=(0,-0.802,1.502) LAND_PT2=(-1.09,-0.802,0) LAND_PT3=(1.09,-0.802,0) VISIBLE=1 CAMERA=(0,1.176,1.352) |
|
|
|
![]() |
|
| Thread Tools | |
|
|
|||||
| Quick Links | Need Help? |