Пример #1
0
void PhysXConnection::sendDataToPhysX()
{
    //send data
    char *toSend;
    toSend = (char*)&send2physX; 
    HostMsg *motionMsg;
    motionMsg = new HostMsg(*receiverHostAddress, toSend, PACKAGE_SIZE_COSIM_OUT);
    motionMsg->setHostAddress(*receiverHostAddress);
    this->outHostMsgQueue.push(motionMsg);
    return;
}
Пример #2
0
void PhysXConnection::executeInputLoop()
{
    this->udpdSPACESenderSocket.create();
    this->initPhysXSocket();

    int receivedByteCount = 0;
    this->inputLoopRunning = true;

    while(this->inputLoopRunning)
    {
        //receive data from nvidia
        struct sockaddr_in other_sin;
        int other_sin_size = (int)sizeof(other_sin);
        receivedByteCount = recvfrom(this->dataFromPhysX, (char *)send2dSPACE, PACKAGE_SIZE_COSIM, 0, (struct sockaddr *)&other_sin, &other_sin_size);
        //std::cout << "received Data for dspace dx: " << send2dSPACE->collisionFlag << std::endl;
        //send message to dSPACE
        HostMsg *coSimMsg;
        coSimMsg = new HostMsg(*DSPACEHostAddress, (char *)send2dSPACE ,PACKAGE_SIZE_COSIM);
        coSimMsg->setHostAddress(*DSPACEHostAddress);
        this->outDSPACEMsgQueue.push(coSimMsg);
    }
}
Пример #3
0
void PhysXConnection::executeOutputLoop() 
{
    this->udpPhysXSenderSocket.create();
    this->initDSPACEsocket();

    int receivedByteCount = 0;

    this->outputLoopRunning = true;
    while(outputLoopRunning)
    {
        //receive co-simulation data from dSPACE
        struct sockaddr_in other_sin;
        int other_sin_size = (int)sizeof(other_sin);

        receivedByteCount = recvfrom(this->dataFromdSPACESocket, (char *)send2physX, PACKAGE_SIZE_COSIM_OUT, 0, (struct sockaddr *)&other_sin, &other_sin_size);
       // cout << "Received package with size: " << receivedByteCount << " Data:" << send2physX->steerAngle[0] << endl;

        //send message to physX
        HostMsg *motionMsg;
        motionMsg = new HostMsg(*receiverHostAddress, (char *) send2physX, PACKAGE_SIZE_COSIM_OUT);
        motionMsg->setHostAddress(*receiverHostAddress);
        this->outHostMsgQueue.push(motionMsg);
    }
}
Пример #4
0
HostMsg * HostMsg::clone() const {
    HostMsg * hostMsg = new HostMsg();
    hostMsg->setHostAddress(this->hostAddress);
    hostMsg->setData(this->data.first, this->data.second);
    return hostMsg;
}