Interaction and VRPN

48 views
Skip to first unread message

Henan Zhao

unread,
Sep 6, 2016, 1:51:36 PM9/6/16
to omegalib
Hi,

Can I ask multiple questions in the thread please?

1. Is VRPN working for OmegaLib on linux?

I checked the wiki and did find a webpage on vrpn. However, (maybe I am wrong) it seems that vrpn only works for windows because only when WIN32 is defined OMICRON_USE_VRPN is set as true. Is it possible that I can connect VRPN with OmegaLib in linux?

It says that
       " !!! Service not found: MouseService
        !!! Service not found: KeyboardService
        !!! Service not found: ViewRayService
        !!! Service not found: VRPNService"
when I run ".orun". Can you help me the problem please? The rendering is working.

2. How can I use the tracker to simple rotate one object?

I'd like to use VRPN to connect to our A.R.T. DTracker and interact with the object (the program is implemented by OpengGL). Is there any existing solution I can do the rotation? We don't need complicate interaction approaches so far, just hoping to rotate the objects around their local centers. It is also better that I can detect the "button down/up". I think there is an example (https://github.com/uic-evl/omicron/tree/583372dbdb967bfd2a5ec43fda2db44af428f721/examples/localService) in the omicron part, but I even cannot detect any events so far and the reason may be that "Services not found: MouseService".


Thanks a lot!
Henan

Henan Zhao

unread,
Sep 7, 2016, 10:28:00 AM9/7/16
to omegalib
Also, if I'd like to use VRPN as the input on one cluster, is there any extra thing I should do, or OmegaLib can handle the connection between nodes?

Thanks,
Henan

Alessandro Febretti

unread,
Sep 7, 2016, 10:55:18 AM9/7/16
to omegalib
Hi Henan,

VRPN client support does only work on windows, but what you can do is launch an input server on a windows machine, (ideally, the same machine that is running the VRPN tracker) and have your omegalib applications connect to this input server using NetService (https://github.com/uic-evl/omicron/wiki/NetService)

I have forwarded this conversation to another person that should have a little more information on how to set this up

Alessandro Febretti

unread,
Sep 7, 2016, 11:10:03 AM9/7/16
to omegalib
For basic interaction, you can use some predefined interactors offered by omegalib:

from omegaToolkit import *
interactor
= ToolkitUtils.setupInteractor('config/interactor')
interactor
.setSceneNode(currentObject)



where currentObject is the sceneNode you want to manipulate.

you also need to add an interactor section to your application config file, info on it here: https://github.com/uic-evl/omegalib/wiki/ConfigReference#interactor-section

if you want to implement more complex interaction / manipulation schemes you can do that directly from python. Here is a more complex example that rotates / moves the camera around an arbitrary center point, using the mouse: https://github.com/febret/firefly/blob/master/flyControl.py (only look at the onUpdate and onEvent functions)

you can also implement something simpler just by grabbing the mouse position in an onevent function and using the x, y coordinates to yaw and pitch the scene node of the object you want to manipulate (https://github.com/uic-evl/omegalib/wiki/SceneNode look for yaw,pitch,roll or setOrientation)





Henan Zhao

unread,
Sep 7, 2016, 11:39:58 AM9/7/16
to omegalib
Hi Alessandro,

Thanks a lot!

Can I ask if there are any examples or instructions on basic interactions for C++ and OpengGL please? I think in the current stage, what I'd like to do is rotation by the tracker and starting/stopping the rotation by pressing a button or clicking the mouse. 
I am not sure if we will use python because our previous projects are in C++ and OpenGL. 

Also, for the VRPN, if I set it up successfully on Windows, can I ask if there are any examples or suggestion you can provide about how I can connect the position/rotation values from VRPN to the applications please? Examples on python are also fine because I may also try to implement the programs on python.

Thanks a lot!

Alessandro Febretti

unread,
Sep 7, 2016, 11:46:12 AM9/7/16
to omegalib
If you just want to apply the rotation of a tracked object to a scene node, that's much easier, you can just use the trackable API of SceneNode: https://github.com/uic-evl/omegalib/wiki/SceneNode (look in the Motion Capture section)

In C++ you can use TrackedObject for more flexibility: http://uic-evl.github.io/omegalib/reference/html/classomega_1_1_tracked_object.html


this is another example of using tracker data to manipulate a 3D object: https://github.com/omega-hub/wandaid


by the way I found this additional example for simple mouse manipulation: https://gist.github.com/febret/9ca350a86657cfa97d48

Henan Zhao

unread,
Sep 7, 2016, 12:29:29 PM9/7/16
to omegalib
Hi Alessandro,

Thanks a lot!

Just to make sure, VRPN is not needed if I use the trackable API, right?

Is there anything I should add to the config files?

Thanks,
Henan

Arthur Nishimoto

unread,
Sep 7, 2016, 1:38:00 PM9/7/16
to omegalib
Omegalib will still use VRPN to get data to the trackable object. I'm double checking over the dependencies to see if VRPNService can run in Linux - there is a Windows module used, but for what you're doing, you shouldn't need it.

In your oinputserver config for omicron you'll need to add the following:

VRPNService:
{
updateInterval = 0.01;
serverIP = "localhost"; // This is the IP of all trackable objects below, unless marked otherwise
trackedObjects:
{
trackedObject:
{
name = "trackerName"; // this would be the name of the object in the VRPN server alternatively
trackableID = 1; // this becomes the sourceId used by the trackable API
};
}
}

Henan Zhao

unread,
Sep 7, 2016, 2:04:46 PM9/7/16
to omegalib
Hi Arthur,

Thanks for your reply.

Sorry that I am sort of confused now.

Based on my understanding, I still need the VRPN for the trackable objects (I mean that is the connection how I can get the positions/rotations of trackable objects). When you said that "for what you're doing, you shouldn't need it", could you please explain that to me? I think what you said might mean that I can rotate my scenenode by mouse. Or you might mean that I could simply grab the tracked data by VRPN and pass them to my application by files or other input approaches. Please correct me if I am wrong.

Thanks,
Henan

Arthur Nishimoto

unread,
Sep 7, 2016, 2:33:41 PM9/7/16
to omegalib
Sorry for the confusion. The part of the service which is Win32 dependent is not needed to receive the VRPN data, so it may be possible to run VRPN in Linux for what you want to do.

Otherwise the quick solution would be to run the omicron oinputserver on windows, use the config as stated above, and receive the VRPN data into omegalib as you would expect.

Henan Zhao

unread,
Sep 7, 2016, 2:57:49 PM9/7/16
to omegalib
Thanks!

Just one quick question, does interaction controls the scenenode? If so, how about the interactions on programs using OpengGL? It seems like applications of OpenGL uses RenderPass instead of SceneNode. Sorry I didn't find direct relationship between the two types so far.

Also could you please tell me how I can get the Event in c++ program? It seems not difficult to do that in python program, but I didn't find related information for c++ programs. It says that the entry for applications is omain (the function in osystem.cpp), but I have no clue how I can get the current event from that or other functions. I tried the example (https://github.com/uic-evl/omicron/tree/583372dbdb967bfd2a5ec43fda2db44af428f721/examples/localService) in "omicron", but there is no event I could get and I guess the reason may be that I received "Mouse Service not found".

Thank you again. 

Henan Zhao

unread,
Sep 7, 2016, 3:57:41 PM9/7/16
to omegalib
Oh sorry, I searched for the group and found the answer to solve my second question: how to get Event in c++ program.
Then I think I may use basic OpenGL transformation functions.


Henan Zhao

unread,
Sep 25, 2016, 10:48:49 PM9/25/16
to omegalib
Hi Alessandro and Arthur,

Thanks for your help again.

Here is what I am doing and will do, and could you please take a look at that to see if I am correct about that?

1. Install OmegaLib on a linux server named A.
2. Install VRPN server on server A because the trackers are physically attached on that.
3. Install Omicron on a windows computer named B.
4. Start the app "oinputserver" on B. Is that (https://github.com/uic-evl/omicron/tree/master/src/apps/oinputserver) the correct one I should run? Here I am modifying the oinputserver.cfg (https://github.com/uic-evl/omicron/blob/master/data/oinputserver.cfg) to connect to the VRPN server on server A. 
5. Add "netservice" as one part of the config file of omegalib on server A. 
6. Write my application on server A, like the program (https://github.com/uic-evl/omicron/wiki/Adding). 
    Here I have one question. Do I need to write some sockets by myself, such as writing programs to receive and analyze messages from the input server? Or I can get the "Event" directly? In other words, can I write the code as follows in my applications without additional work? I think I can do that when the input server is running locally, but not sure if the situation is the same when the input server and my applications are in two separable computers and connected by network.
"           Event evts[OMICRON_MAX_EVENTS];
            int av;
            if(0 != (av = sm->getEvents(evts, ServiceManager::MaxEvents)))
            {
                for( int evtNum = 0; evtNum< av; evtNum++)
                {
                    onEvent(evts[evtNum]);
                }
            }

"

Another quick question is that if I'd like to use OpenGL, instead of Scenenode, can I still use the trackable object please? Could you please explain more about how to interact with the objects implemented by opengl if I can already get the events from the input server? 

Sorry for so many questions again.

Henan Zhao

unread,
Sep 27, 2016, 8:25:20 PM9/27/16
to omegalib
Hi,

I took a look at the "VRPNService.cpp" in omicron folder, and it seems like there are two parts which don't match the config file.

For example, here is the config file I use:

VRPNService:
{
updateInterval = 0.01;
serverIP = "192.168.5.160"; // This is the IP of all trackable objects below, unless marked otherwise
trackedObjects:
{
trackedObject:
{
name = "DTrack"; // this would be the name of the object in the VRPN server alternatively
trackableID = 1; // this becomes the sourceId used by the trackable API
};
}
}

However, in the VRPNService:setup function, what is required is "objects" instead of "trackedObjects".
Here is the code:
    if(settings.exists("serverIP"))
    {
        server_ip =  (const char*)settings["serverIP"];
    }
 
    if(settings.exists("objects"))
    {
              ...
    }
Also I noticed that there is a parameter required called "objectID" but based on my understanding it is called "trackableID" in the config file.

After modifying the two parts, now I can make the oinputserver and vrpn server talk; otherwise, they cannot communicate with each other.


However, I am just worried if what I modified is correct and whether I might break the OmegaLib. Could you please help me about that and tell me if I can do that modification?

Thanks,
Henan


Alessandro Febretti

unread,
Sep 30, 2016, 12:27:37 PM9/30/16
to omegalib
Thanks for investigating this Henan!

Arthur, can you confirm this is what is going on? We might need to update documentation?
Reply all
Reply to author
Forward
0 new messages