Automating boats - BoatScript

VRTool software support forum

Re: Automating boats - BoatScript

Postby omar » Mon Apr 25, 2011 3:39 pm

About BoatScript, it can only control vrtool boats
either:
- local database boats
- vrtool remote boats [running on localhost or another machine]

Note: It does not control MP boats :o

Still, one can use MP boat data to control vrtool boats
( see the follow boat script)
User avatar
omar
Site Admin
 
Posts: 498
Joined: Thu Apr 30, 2009 11:00 am

Tacking upwind BoatScript

Postby omar » Tue Apr 26, 2011 12:40 am

Code: Select all
//---------------------------------------------
// "tack upwind" - boat script
// - boat will alternate tacks upwind at TWA=42
// - use best sail
//---------------------------------------------

function OnNewPosition() {
   var courseLeftTack = Boat.TWD -42;
   if (courseLeftTack<0) courseLeftTack +=360; 
   var courseRightTack = Boat.TWD +42;
   if (courseRightTack >=360) courseRightTack -=360;

   //alternate tacks upwind
   if (Boat.Course==courseLeftTack)
     Boat.Course=courseRightTack;
     else Boat.Course=courseLeftTack; 

   Boat.Sail   = Boat.BestSail;
   Boat.Commit();
}


what if the wind changes some 120 degrees ? :mrgreen:
Image
User avatar
omar
Site Admin
 
Posts: 498
Joined: Thu Apr 30, 2009 11:00 am

Previous

Return to VRTool Forum