Writing BB for USB 5DT glove

(9 posts) (3 voices)

Tags:

No tags yet.

  1. rcag

    member
    Joined: Nov '06
    Posts: 30

    Hi,

    I'm a newbie in the Virtools SDK so i would like an opinion for the following problem.

    I'm creating a BB in order to use a USB 5DT glove with Virtools.

    I have already created a BB with the .NET wizard and wrote a procedure that initializes the glove, obtain the data and closes the glove connection, all in the execution function...but when i use my custom bb on a external loop the framerate goes to 3-4 fps...

    The process to initialize/close the glove is very slow and i'm using the bb on an external loop so i know why the framerate is low ...and now comes my question

    What is the best way to deal with this?

    1) open the connection to the glove and create a thread with an internal loop that is continuously updating the pOut's? i have already tryied a loop without a thread and all of the program remains stuck until the loop finishes...and my pOut is only updated in the end...

    2) create diferent bb, one for opening a connection, one for retrieving data and one for closing? But in this case how can i pass data structures(that are specific of the glove's sdk) between BB ?

    Posted 6 years ago #
  2. Dom3D

    power user
    Joined: Feb '01
    Posts: 4,525

    use the "manager" structure to offer all the services you need. it also could use threads if needed. then use BBs or VSL to query the state from the manager.

    let the manager qeuery the device once in a frame via the preProcessing callback

    Posted 6 years ago #
  3. rcag

    member
    Joined: Nov '06
    Posts: 30

    Sorry to bother again,

    Dom i followed your advice and created a manager with the app wizard in the .NET. I placed my initializations on its constructor and on the preProcessing i query the glove for data...

    My question now is, how do i use it :oops:

    i searched on the sdk but i could not find any reference how to use it.

    Posted 6 years ago #
  4. Dom3D

    power user
    Joined: Feb '01
    Posts: 4,525

    you retrieve a pointer to the manager via CKContext::GetManagerByGUID. So basically you include your manager header in your BB cpp and then you have that GUID and interface available in your BB function.

    Posted 6 years ago #
  5. rcag

    member
    Joined: Nov '06
    Posts: 30

    sorry to bother again :(

    again, i've done what you(Dom) said, i've created the manager...then i created the BB including the manager's header and got the manager using GetManagerByGUID...with this the vs.net project builds ok

    but when i try to access the managers functions it stops compiling and gives the error [b:3grg2er2]Glove error LNK2019: unresolved external symbol "public: int __thiscall MyManager::OpenConnection(void)" (?OpenConnection@MyManager@@QAEHXZ) referenced in function "int __cdecl InitInstance(class CKContext *)" (?InitInstance@@YAHPAVCKContext@@@Z)[/b:3grg2er2]

    i have already included the lib directory into Additional Library Directories field, placed the lib name into additional dependencies field and placed the DLL into the project's directory but the same error keeps showing...

    is there some "special way" to make the BB use the manager's DLL?

    Posted 6 years ago #
  6. Dom3D

    power user
    Joined: Feb '01
    Posts: 4,525

    sorry, i guess i wasn't clear. You can have more than one plugin in one DLL. You will see that with many of the Virtools plugins. First you provide how many plugins are in the DLL and then you give per index different plugin descriptions. This way you can have a manager and lots of BBs plugin in the same DLL. Thats what I do.

    Posted 6 years ago #
  7. rcag

    member
    Joined: Nov '06
    Posts: 30

    First of all, Dom thank you very much for your help... if it wasn´t for you i would still be on the starting point.

    Following your last post, i've created the BB and Manager on the same DLL...

    The virtools loads the manager and the bb but when i execute the bb (on virtools) it gives me the following error

    [b:1al3hbq1]MyBuildingBlock=>Error(Execution)

    Script:Level Script

    Owner:Level[/b:1al3hbq1]

    My guess is the execution function of the bb is wrong

    [code:1al3hbq1]int MyBuildingBlock(const CKBehaviorContext& BehContext)

    {

    CKContext * teste= new CKContext();

    MyManager * _manager=(MyManager *)teste->GetManagerByGuid(MyManagerGUID);

    CKBehavior* beh = BehContext.Behavior;

    float treta=_manager->GetFrameCount();

    CKParameterOut *pout;

    pout=beh->GetOutputParameter(0);

    pout->SetValue(&treta,0);

    beh->ActivateInput(0,FALSE);

    beh->ActivateOutput(0);

    return CKBR_OK;

    }[/code:1al3hbq1]

    can you see what i'm doing wrong?

    Posted 6 years ago #
  8. rcag

    member
    Joined: Nov '06
    Posts: 30

    i think i have solved the problem

    i used the CKContext given by the initInstance and i think it's working...

    now that i have the basics in how to do/use a manager so i will try to apply the concept to the glove's sdk to see if it makes a difference on the fps

    thanks once again

    Posted 6 years ago #
  9. Falls

    new member
    Joined: May '13
    Posts: 6

    Hi, I will try to dig up this post

    Do you reach to make the gloves working with Virtools ?

    I'm facing difficulties with the "fdopen" 5DT SDK function, I believe the matter is I don't have a correct "CKParameterTypeDesc" to handle this external function but I can't make it works.

    I'll be glad if you have any vague memory about that

    Posted 1 year ago #

Reply

You must log in to post.