Hello,
I am planning to develop a Ogre3D manager to handle VRPN devices.
The main motivation for that is to allow easy interaction with OpenVibe.
But I don't know if there is already something doing that task.
Is there ?
The structure will be as follow :
*Class VRPNManager
*Class VRPNDevice
VRPNManager will have a list of VRPNDevice. As a singleton it will act like an InputManager (you can ask
for device's state).
VRPNDevice will have a list of typical VRPN object (Tracker, Button, Analog...) representing a complete device.
Adding, removing or modify a device at running time will be possible through VRPNManager or VRPNDevice instance.
It will be possible to add device at starting with a config file (each device configurable) or at running time.
What do you think about it ?
ps : I know this is not directly concerning OpenVibe but I do it for OpenVibe.
Interacting with Ogre3D
Interacting with Ogre3D
Naëm Baron
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
Re: Interacting with Ogre3D
Dear nbaron,
I don't know any such framework publicly available yet. Go for it, and keep us posted, it will probably be valuable to the community !
Yann
I don't know any such framework publicly available yet. Go for it, and keep us posted, it will probably be valuable to the community !
Yann
Re: Interacting with Ogre3D
Ola,
I begun to code the lib and I got some results
The main advantage is the occlusion of internal VRPN work for beginner and
possibility to use advanced VRPN functionnality for pro.
The first version provide a manager to manage "input only devices" (so no forcefeedback for the moment).
E.g. : A manager with 2 devices. Each device has multiple sensor.
Dev1 has 2 analog input and 10 buttons. Dev2 has 1 text input, 1 tracker, 1 dial.
This is a WIP, I need to clean and to optimize the code.
Feel free to comment about the "usage strategy" as you can have a preview here :
There is not Ogre3D integration yet because the lib can be used like the previous example in the frameStarted method.
In the final version I will try to implement an Ogre3D "singletoned" manager to fit the Ogre3D philosophy.
ps : I am not very proud of the GetState mechanism... What do you think ?
ps' : I am thinking to rename the method CVRPNManager::Connect to CVRPNManager::BindConnection or CVRPNManager::UseConnection.
ps'' : I will provide the files once I will finish "clean & optimize" step.
I begun to code the lib and I got some results
The main advantage is the occlusion of internal VRPN work for beginner and
possibility to use advanced VRPN functionnality for pro.
The first version provide a manager to manage "input only devices" (so no forcefeedback for the moment).
E.g. : A manager with 2 devices. Each device has multiple sensor.
Dev1 has 2 analog input and 10 buttons. Dev2 has 1 text input, 1 tracker, 1 dial.
This is a WIP, I need to clean and to optimize the code.
Feel free to comment about the "usage strategy" as you can have a preview here :
Code: Select all
#include <stdio.h>
#include <conio.h>
#include "VRPNManager.h"
void printAnaState(vrpn_ANALOGCB* a)
{
printf("Received %d analog channels at %d,%d s\n", a->num_channel, a->msg_time.tv_sec, a->msg_time.tv_usec);
for(int i=0; i<1/*a->num_channel*/; i++)
printf("(%d) %f; ", i, a->channel[i]);
printf("\n");
}
int main()
{
printf("Hello world !\n\n");
CVRPNManager manager;
printf("Dev1 device\n");
manager.CreateDevice("Dev1");
manager.Connect("openvibe-vrpn@localhost");
manager.AddSensor2Device("Dev1", "ana1", SensorType::Analog); // uses default manager connection
manager.Connect("openvibe-vrpn2@localhost");
manager.AddSensor2Device("Dev1", "ana2", SensorType::Analog);
//manager.AddSensor2Device("Dev1", "ana2", SensorType::Analog, other); // uses specific connection
manager.AddSensor2Device("Dev1", "ana3", SensorType::Analog, "ov3@localhost"); // create a connection on the fly
CVRPNDevice *dev2 = new CVRPNDevice();
dev2->AddSensor("ana1", dev2->Analog, NULL, "ov4@localhost");
manager.AddDevice("Dev2", dev2);
vrpn_ANALOGCB* state = NULL;
bool updated = false;
while(1)
{
manager.Update();
state = NULL;
updated = false;
state = (vrpn_ANALOGCB*)(manager.GetState("Dev1", "ana1", &updated));
if(updated)
{
printf("Dev1>ana1 ::");
printAnaState(state);
}
// Or
state = (vrpn_ANALOGCB*)(manager.GetDevice("Dev2")->GetState("ana1", &updated));
if(updated)
{
printf("Dev2>ana1 ::");
printAnaState(state);
}
Sleep(1);
}
}
In the final version I will try to implement an Ogre3D "singletoned" manager to fit the Ogre3D philosophy.
ps : I am not very proud of the GetState mechanism... What do you think ?
ps' : I am thinking to rename the method CVRPNManager::Connect to CVRPNManager::BindConnection or CVRPNManager::UseConnection.
ps'' : I will provide the files once I will finish "clean & optimize" step.
Naëm Baron
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
Re: Interacting with Ogre3D
Hello,
can someone give me a feedback ?
Should I change something in the mechanism ?
can someone give me a feedback ?
Should I change something in the mechanism ?
Naëm Baron
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
CV : http://bee-oh.esiea-ouest.fr/baron/index.xml
Re: Interacting with Ogre3D
Hello Naëm,
I am currently working on the Tie-Fighter demonstrator (working with motor imagery of the feet).
The previous version of the demonstrator was based on OpenMASK, which integrate VRPN.
We decided to remove OpenMASK from OpenViBE so I developed a new version of the demonstrator.
You can find under openvibe-application/vr-demo/branches/wip-lbonnet :
- CAbstractVrpnPeripheric : this class is somehow similar to your vrpn device. It handles one vrpn device (in which you can have at most 1 analog server and 1 button server). The button states and the analog values are stored automatically in lists for further access (we dont want to miss anything).
- COgreVRApplication : The tie-fighter and the handball applications inherit from this basic Ogre Application. The COgreVRApplication has only one CAbstractVrpnPeripheric.
The CTieFighterBCI class implements the 3 main function of a basic Ogre application:
- virtual void initialiseResourcePath(void) -- to set the path to the ogre resource.cfg file.
- virtual bool initialise(void) -- initialize the 3D scene
- virtual bool process(void) -- real time processing (tie-fighter going up and down with respect to the analog values of the vrpn peripheric)
I think that your solution, with a vrpn peripheric manager, will give more flexibility if you need more than 1 vrpn device. So keep going, I will be very interested in your work !
When you have something ready, send it to me and I will try asap !
Best Regards,
Laurent
I am currently working on the Tie-Fighter demonstrator (working with motor imagery of the feet).
The previous version of the demonstrator was based on OpenMASK, which integrate VRPN.
We decided to remove OpenMASK from OpenViBE so I developed a new version of the demonstrator.
You can find under openvibe-application/vr-demo/branches/wip-lbonnet :
- CAbstractVrpnPeripheric : this class is somehow similar to your vrpn device. It handles one vrpn device (in which you can have at most 1 analog server and 1 button server). The button states and the analog values are stored automatically in lists for further access (we dont want to miss anything).
- COgreVRApplication : The tie-fighter and the handball applications inherit from this basic Ogre Application. The COgreVRApplication has only one CAbstractVrpnPeripheric.
The CTieFighterBCI class implements the 3 main function of a basic Ogre application:
- virtual void initialiseResourcePath(void) -- to set the path to the ogre resource.cfg file.
- virtual bool initialise(void) -- initialize the 3D scene
- virtual bool process(void) -- real time processing (tie-fighter going up and down with respect to the analog values of the vrpn peripheric)
I think that your solution, with a vrpn peripheric manager, will give more flexibility if you need more than 1 vrpn device. So keep going, I will be very interested in your work !
When you have something ready, send it to me and I will try asap !
Best Regards,
Laurent