1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

DLL File for RNR used with Terminal Realitys Fly Program

Discussion in 'Rock n Ride simulators - Outdated' started by Rookie_Pilot, Jul 30, 2007.

  1. Rookie_Pilot

    Rookie_Pilot New Member

    Joined:
    Jul 27, 2007
    Messages:
    2
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Fantastic - Rock & Ride rolls again. Is anyone interested in the code for using the old RNR simulator chair with Terminal Realitys superb Fly Program. The program I wrote was fairly basic using C++ but it seemed to work okay. I look forward to the stepper motor piston versions being released. If anyone is interested in an RNR old serial board with schorouski.de force feedback chip, valve manifold and power supply, I would be happy to swop for a Velleman USB Module K8055D as I would like to have a tinker with this kit. Cheers, Steve.
  2. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +10 / 1 / -0
    Hi Steve

    Wellcome to our forum!

    To be honest. I dont think that anyone could be interested either in the original RnR board nor the Schurowski board. They are both crap.

    But i think there could be someone interested in the valve manifold. But I wouldnt sell it, if I was you.

    BTW, you could get a K08055 for 40 Euros. That should be no problem.

    This dll file, you offered. Whats its purpose? Does it capture some telemetric data out of Fly?
    Or does it just enable the RnR joystick-mode with this game?

    regards
    ego
  3. Rookie_Pilot

    Rookie_Pilot New Member

    Joined:
    Jul 27, 2007
    Messages:
    2
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi, I have two manifolds and one Festo 300mm stroke cylinder (without end bearings). These were all used for development purposes and are now surplus to requirements. I am mainly interested in servo and stepper motor solutions. The DLL file extracted the pitch and bank as telemetric data out of fly and exported it to the RNR board using the SDK kit provided by (motionsystems.de). I didn't like the joystick mode of control because it didn't reflect exactly what the simulator was doing. The RNR chair moved relative to what the aircraft was doing not the position of the yoke using this simple DLL.

    This is what the basic code looked like:
    /////////////////////////////////////////////////////////////////////
    //
    // Turbo.CPP for dll interface between FLY and Rock'N'Ride
    // motion simulator.
    //
    // This program extracts the Pitch and Bank data from an active
    // aircraft in FLY. This data is then manipulated and then passed
    // to the Rock'N'Ride simulator.
    //
    // The Pitch and Bank data along with the converted values for the
    // Rock'N'Ride can be displayed in the cockpit panel window for
    // information when the APIDrawNoticeToUser code line is enabled.
    //
    /////////////////////////////////////////////////////////////////////
    // Pistons Up
    // 128-255
    //
    // Left Piston Centre = 127 Right Piston
    //
    // Pistons Down
    // 0-126
    /////////////////////////////////////////////////////////////////////

    #include <stdio>
    #include <string>

    #define FOR_EXPORT
    #include PitchBank.h
    #include msim.h

    ///// SimPitchMoveValue = unsigned char (PitchMoveValue);

    int RNRInitialised = 0;

    double PistonMoveRatio = 3.15; //= 255/40 deg total movement: Ratio of FLY pitch/bank movement to simulator movements

    unsigned short int RPistonPositionBank; // Value 127 (Centralise pistons / simulator)
    unsigned short int LPistonPositionBank; // Value 0-126 (Pitch simulator Down Retract piston)
    // Value 128-255 (Pitch simulator Up Extend piston)
    unsigned char FinalRPistonPosition;
    unsigned char FinalLPistonPosition;

    double AircraftBank; //Bank values in FLY can be both negative and positive values
    double AircraftPitch; //Pitch values in FLY can be both negative and positive values

    double RemAircraftBank;
    double RemAircraftPitch;

    /////////////////////////////////////////////////////////////
    //
    // DLL Function Implementations
    //
    /////////////////////////////////////////////////////////////

    void DLLIdle(float deltatime)
    {
    if (APIIsSimulationRunning())
    {
    SFlyObjectRef acft; // Define SFlyObjectRef as acft
    SVector orientation; // Define SVector as orientation

    APIGetUserObject(&acft); //Get the current object (the Fly aircraft)
    APIGetObjectOrientation(&acft, &orientation); //Get the current orientation of the Fly aircraft

    AircraftPitch = ((orientation.x * 180) / 3.1415927); // Assign Pitch to value orientation.x in degrees
    AircraftBank = ((orientation.z * 180) / 3.1415927); // Assign Bank to value orientation.z in degrees

    // Calculate simulator bank position to move to X Axis

    // Value 0-126 (Bank simulator Left) X Axis RnR : + FLY
    if (AircraftBank > 0 && AircraftBank < 21) //AircraftBank is positive from FLY
    {
    RemAircraftBank = AircraftBank;
    RPistonPositionBank = unsigned short int (127 + (AircraftBank * PistonMoveRatio));
    LPistonPositionBank = unsigned short int (127 - (AircraftBank * PistonMoveRatio));
    }
    // Value 128-255 (Bank simulator Right) X Axis RnR : - FLY
    if (AircraftBank <0> -21) //AircraftBank is negative from FLY
    {
    RemAircraftBank = AircraftBank;
    AircraftBank = AircraftBank * -1; //Change FLY negative right bank value to a positive value
    RPistonPositionBank = unsigned short int (127 - (AircraftBank * PistonMoveRatio));
    LPistonPositionBank = unsigned short int (127 + (AircraftBank * PistonMoveRatio));
    }

    if (AircraftBank > 20)
    {
    RemAircraftBank = AircraftBank;
    RPistonPositionBank = 127 + 63;
    LPistonPositionBank = 127 - 63;
    }

    if (AircraftBank <21> 0 && AircraftPitch < 21) //AircraftPitch is positive from FLY
    {
    RemAircraftPitch = AircraftPitch;
    FinalRPistonPosition = unsigned char (RPistonPositionBank + (AircraftPitch * PistonMoveRatio));
    FinalLPistonPosition = unsigned char (LPistonPositionBank + (AircraftPitch * PistonMoveRatio));
    }

    // Value 0-127 (Pitch simulator Up) Y Axis RnR : - FLY norm -
    if (AircraftPitch <0> -21) //AircraftPitch is negative from FLY
    {
    RemAircraftPitch = AircraftPitch;
    AircraftPitch = AircraftPitch * -1; //Change FLY negative pitch value to a positive value
    FinalRPistonPosition = unsigned char (RPistonPositionBank - (AircraftPitch * PistonMoveRatio));
    FinalLPistonPosition = unsigned char (LPistonPositionBank - (AircraftPitch * PistonMoveRatio));
    }

    if (AircraftPitch > 20)
    {
    RemAircraftPitch = AircraftPitch;
    FinalRPistonPosition = RPistonPositionBank + 63;
    FinalLPistonPosition = LPistonPositionBank + 63;
    }

    if (AircraftPitch < -20)
    {
    RemAircraftPitch = AircraftPitch;
    FinalRPistonPosition = RPistonPositionBank - 63;
    FinalLPistonPosition = LPistonPositionBank - 63;
    }

    if (AircraftPitch = 0)
    {
    FinalRPistonPosition = unsigned char (RPistonPositionBank);
    FinalLPistonPosition = unsigned char (LPistonPositionBank);
    }

    MSimMove(FinalLPistonPosition, FinalRPistonPosition, 0); //Move chair function

    //MSimMove(SimBankMoveValue, SimPitchMoveValue, 0); //Move chair function
    //DllExport void MSimMove(UCHAR chX, UCHAR chY, UCHAR chZ);
    // X,Y,Z := 0 - 255 (X=Twist, Y=Elevation, Z=future use)
    // MSimMove moves the simulator/chair to the desired position

    char Buffer[128]; //Assign Pitch & Bank values to the string named Buffer

    //sprintf(Buffer, AircraftPitch: %d AircraftBank: %d RNRInitialised: %d, (int)AircraftPitch, (int)AircraftBank, (int)RNRInitialised);

    sprintf(Buffer, Pitch> %d Bank> %d Left piston pos> %d Right piston pos> %d, (int)RemAircraftPitch, (int)RemAircraftBank, (int)FinalLPistonPosition, (int)FinalRPistonPosition);
    //sprintf(Buffer, Pitch> %d Bank> %d RnR Pitch pos> %d RnR Bank pos> %d RNRInitialised> %d, (int)AircraftPitch, (int)AircraftBank, (int)SimPitchMoveValue, (int)SimBankMoveValue, (int)RNRInitialised);
    //sprintf(Buffer, AircraftPitch: %d AircraftBank: %d PitchMoveValue: %d BankMoveValue: %d RNRInitialised: %d, (int)AircraftPitch, (int)AircraftBank, (int)PitchMoveValue, (int)BankMoveValue, (int)RNRInitialised);
    // Send the contents of the string Buffer to Fly's screen for 2 seconds
    // in reality the pitch and bank data should display constantly on screen
    APIDrawNoticeToUser(Buffer, 2);
    }

    }

    /////////////////////////////////////////////////////////////
    //
    // DLL Setup (Init & Kill)
    //
    // These functions MUST be implemented, or the DLL
    // will totally fail!!!!
    //
    /////////////////////////////////////////////////////////////

    int DLLInit(DLLFunctionRegistry *dll, SDLLCopyright *copyright, SDLLRegisterTypeList **types)
    {
    //
    // populate copyright info
    //

    strcpy(copyright->product, RnRMotionSim DLL);
    strcpy(copyright->company, );
    strcpy(copyright->programmer, Steve Galione);
    strcpy(copyright->dateTimeVersion, 1.00, 29/04/02 1200Z);
    strcpy(copyright->email, steven_galione&hotmail.com);
    copyright->internalVersion = 100;

    //
    // return function pointers of available DLL functions
    //

    dll->DLLIdle = DLLIdle;

    RNRInit(1);
    RNRInitialised = 1;
    //
    // result code
    //
    return(1);
    }

    void DLLKill(void)
    {
    FinalRPistonPosition = 127;
    FinalLPistonPosition = 127;
    MSimMove(FinalLPistonPosition, FinalRPistonPosition, 0); //Return RnR chair to central position
    MSimExit(); // MSimExit function - call on exit to free RNR resources
    //
    // nothing mandatory to do here
    // except internal cleanup
    //
    }
  4. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +10 / 1 / -0
    Hi, great to have someone, besides Sirnoname, with programming skills in our forum. I dont think that we are interested to use your code together with the original or the Schurokowski interface.
    But perhaps it could be implemented as a plugin in the X-Sim Software.

    We are working on the electric actuator solutions currently.

    I think there might be someone interested in your pneumatic hardware.
    btw, if you want to sell stuff, then post it in our market place