2
// This file provides an interface to a Novint Falcon.
3
// http://home.novint.com/products/novint_falcon.php
4
// It uses libnifalcon to communicate with the device.
5
// http://libnifalcon.nonpolynomial.org/
7
// file: vrpn_Tracker_NovintFalcon.h
8
// author: Axel Kohlmeyer akohlmey@gmail.com 2010-04-14
9
// copyright: (C) 2010 Axel Kohlmeyer
10
// license: Released to the Public Domain.
11
// depends: libnifalcon-1.0.1, libusb-1.0, VRPN 07_26
12
// tested on: Linux x86_64 w/ gcc 4.4.1
14
#ifndef __TRACKER_NOVINTFALCON_H
15
#define __TRACKER_NOVINTFALCON_H
17
#include "vrpn_Configure.h"
19
#if defined(VRPN_USE_LIBNIFALCON)
21
#include "vrpn_Tracker.h"
22
#include "vrpn_Button.h"
23
#include "vrpn_ForceDevice.h"
25
// Forward declaration for proxy class that wraps
26
// the device management of the falcon.
27
class vrpn_NovintFalcon_Device;
29
// Forward declaration for proxy class that maintains
30
// the list of objects that contribute to the force.
31
class vrpn_NovintFalcon_ForceObjects;
33
class VRPN_API vrpn_Tracker_NovintFalcon
34
: public vrpn_Tracker, public vrpn_Button, public vrpn_ForceDevice {
37
/// custom constructor
38
vrpn_Tracker_NovintFalcon(const char *name,
39
vrpn_Connection *c = NULL,
41
const char *grip = NULL,
42
const char *kine = NULL,
43
const char *damp = NULL);
46
~vrpn_Tracker_NovintFalcon();
48
/// Called once through each main loop iteration to handle updates.
49
virtual void mainloop();
51
protected: // methods for tracker and button functionality
53
virtual int get_report(void);
54
virtual void send_report(void);
55
virtual void clear_values(void);
57
protected: // methods for force feedback functionality
58
/// apply forces from known objects
59
virtual void handle_forces(void);
61
/// apply received information about force field effects.
62
virtual int update_forcefield_effect(vrpn_HANDLERPARAM p);
64
int m_devflags; //< device configuration flags
65
vrpn_float64 m_update_rate; //< update rate of device
66
vrpn_float64 m_damp; //< damping factor for force updates
67
struct timeval m_timestamp; //< last update of device status
68
vrpn_NovintFalcon_Device *m_dev; //< device handle
69
vrpn_NovintFalcon_ForceObjects *m_obj; //< handle to force generating objects
72
#endif /* defined(VRPN_USE_LIBNIFALCON) */