Vicon communication

Simple class abstracting communication with Vicon tracker.

Downloading

Source is available from GIT repository:

git clone anon@git.iim.cz:vicon

Compiling

In the source directory:

mkdir build
cd build
cmake ..
make

This will create directory build, configure the project and build it. The test application will be placed in build/bin directory.

Usage

The use of the provided library is very straightforward. The class' constructor Should be invoked with IP address of tarsus server and optionally port where it runs (otherwise it defaults to 800). Like:

vicon::Vicon tarsus("192.168.23.15", 800);

The construction will try to connect to tarsus ans fetch info about variables it provides. If it fails, it will throw std::runtime_error.

When is the object constructed and connected to tarsus, all you need to do is to call Vicon::refresh_data() everytime you want new data from vicon.

tarsus.refresh_data();

And lastly, to get to the data, there are getter Vicon::names() and Vicon::values() returning const ref to vectors of values and it's names.

Example

Simple example on how to use the class is included in src/vicon_test.cpp

vicon_test.cpp
#include "Vicon.h"
#include <iostream>
#include <unistd.h>
 
int main(int argc, char** argv)
{
	if (argc < 2) {
		std::cerr << "Not enough parameters. Use as:\n" << argv[0] << " <IP> [<port>]\n";
		return 1;
	}
	uint16_t port = 800;
	if (argc > 2) port = std::stoul(argv[2]);
 
	vicon::Vicon tarsus(argv[1], port);
 
	for (int i=0;i<10;++i) {
		tarsus.refresh_data();
		std::cout << tarsus.names()[0] << ": " << tarsus.values()[0]<<"\n";
		::usleep(5000);
	}
 
}
 
vicon.txt · Last modified: 2013/11/14 18:13 by neneko
 
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki