Menu

Only Start Of Frame being sent

Help
Some Dude
2023-08-21
2023-08-23
  • Some Dude

    Some Dude - 2023-08-21

    Hey guys, this is my first time working with CIGI. There is usually another person in my organization responsible for this but now he is working on something else and the problem has come to me. Using the C++ static library, I built a CIGI object that will just send location of a single object (ownship) to my IG. I have built everything but am facing an issue with the Outgoing message. The outgoing message only contains the Start of Frame Packet. I tried building the example miniHost first but it is giving me error after error after error. First it was libcmtd.lib, then another library and so on and so forth. What am I doing wrong that my message is not containing the rest of the packets?

    I am adding some code of what I am doing below.

    //Initialization Function
    printf("init_cigi_if: initializing  ports to CIGI\n");
        bool netstatus = m_Net.openSocket(m_IpAddress, m_IGPort, m_IGPort);
    
        if (!netstatus) {
            printf("could not connect to CIGI host server\n");
            exit(1);
        }
        else {
            printf("successfully connected to CIGI host server\n");
        }
    
    
        IGSn = new CigiIGSession(1, 32768, 3, 32768);
        CigiOutgoingMsg &Omsg = IGSn->GetOutgoingMsgMgr();
        CigiIncomingMsg &Imsg = IGSn->GetIncomingMsgMgr();
        OmsgPtr = &Omsg;
        ImsgPtr = &Imsg;
        IGSn->SetCigiVersion(4, 0);
        IGSn->SetSynchronous(false);
        IGSn->SessionType = IGSn->Host;
        Imsg.SetReaderCigiVersion(4, 0);
        Imsg.UsingIteration(false);
    
    
        // initialize the SOF
        CSOF.SetDatabaseID(0);
        CSOF.SetIGStatus(0);
        CSOF.SetTimeStampValid(false);
        CSOF.SetEarthRefModel(CigiBaseSOF::WGS84);
        CSOF.SetTimeStamp(0);
        CSOF.SetFrameCntr(0);
    
        // initialize the IG Control
        CIGC.SetIGMode(CigiBaseIGCtrl::Operate);
    
    
        // initialize the Ownship
        //  the other parameters are set by CigiEntityCtrlV4
        COwn.SetEntityID(0);
        COwn.SetParentID(0);
        //----------------------------------------End of Initialize Function
    
        //Sender Function
        CigiOutgoingMsg &Omsg = IGSn->GetOutgoingMsgMgr();
    
        //Omsg.CreateBuffer();
    
        void* pointer = &CSOF;
    
        Omsg.BeginMsg();
    
        std::cout << "Frame Count: " << Omsg.GetFrameCnt() << std::endl;
    
    
        Omsg << CSOF;
    
        // load the IG Control
        static unsigned long timestamp = 0;
        timestamp += 8; //dummy timestamp
        CIGC.SetTimeStamp(timestamp);
        CIGC.SetTimeStampValid(true);
    
        Omsg << CIGC;
    
        // Initialize ownship position
        COwn.SetLat(objPosition.latitude);
        COwn.SetLon(objPosition.longitude);
        COwn.SetAlt(objPosition.altitude);
        COwn.SetYaw(objPosition.yaw);
        COwn.SetPitch(objPosition.pitch);
        COwn.SetRoll(objPosition.roll);
    
        Omsg << COwn;
    
        try {
            Omsg.PackageMsg(&pCigiOutBuf, CigiOutSz);
        }
        catch (CigiException &theException){
            std::cout << "getNetMessages - Exception HERE: " << theException.what() << std::endl;
        }
    
        std::cout << "CIGI Out Size" << CigiOutSz << std::endl;
    
    
        int sentBytes;
    
        unsigned char* msg2;
        int length;
        Omsg.GetCurrentlyPackagedMsg(&msg2, length);
        std::cout << "Length from here" << length << std::endl;
    
        if (pCigiOutBuf != NULL)
        {
            Omsg.UpdateIGCtrl(pCigiOutBuf, NULL);
    
            // send CIGI message
            sentBytes = m_Net.send(pCigiOutBuf, CigiOutSz);
        }
    
        Omsg.FreeMsg();   // Frees the buffer containing the message that was just sent
    

    I don't know how active this community is but thanks for your time.

     
  • Some Dude

    Some Dude - 2023-08-21

    The "Length from here" and the "CIGI out size" were just for debugging. The length is always coming out to be 24.

     
  • C. Schroeder

    C. Schroeder - 2023-08-22

    Hi, and welcome to CIGI.

    A little more background information would be helpful. I'm guessing from the m_Net.openSocket() method this is on the Windows platform, correct? Did you build the ccl_lib from source, did your co-worker build it from source, or did you get a pre-built DLL from somewhere? I've not built the ccl 4.0 lib yet, but version 3.3 is only dependent upon the MS CRT lib. If you are seeing a lot of dependent libs, I suspect those would be coming from your network module that you use in conjunction with the ccl.

    Is there a reason you are initializing for asynchronous CIGI messaging? That is rather uncommon.

    I don't believe I've ever tried using three output buffers, so that's uncharted territory for me.

    For host --> IG messaging, the host sends IG Control at the beginning of the message buffer, not SOF.

    Looking at MiniHost.cpp, I think you may have an error in your listing:

       //Sender Function
        CigiOutgoingMsg &Omsg = IGSn->GetOutgoingMsgMgr();
    

    should be

       //Sender Function
       CigiOutgoingMsg &Omsg = *OmsgPtr;
    

    Hopefully you will find these observations helpful.

    Best regards,

    Curt

     

    Last edit: C. Schroeder 2023-08-22
  • Some Dude

    Some Dude - 2023-08-23

    @c_schroeder Thanks for the response.
    This is on the windows platform. I got the library from SourceForge and built it myself as a static library. I used the latest version. I want my IG to be passive only at the moment as we are testing a new software. We will eventually go towards the synchronous mode but now, we just want to see something on the screen.
    I edited the pointer line myself just to test it out.
    I was wrong about the start of frame packet, the host was only sending the packet for IG Control.
    The three output buffers was just a test to check whether it will work, I reverted it back to the 2 that were in the code beforehand.
    I tried adding different packets and got some packets that were being added on but it was having problem with a few more packets other than the ownship as well. A few packets were being added on. I eventually sent "PosResp" packet but cannot see anything on "Vega Prime". I am actually lost on what to do now.

     

    Last edit: Some Dude 2023-08-23

Log in to post a comment.