Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 73 lines (60 sloc) 2.6 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
// -*- c++ -*-
// This file provides an interface to a Novint Falcon.
// http://home.novint.com/products/novint_falcon.php
// It uses libnifalcon to communicate with the device.
// http://libnifalcon.nonpolynomial.org/
//
// file: vrpn_Tracker_NovintFalcon.h
// author: Axel Kohlmeyer akohlmey@gmail.com 2010-04-14
// copyright: (C) 2010 Axel Kohlmeyer
// license: Released to the Public Domain.
// depends: libnifalcon-1.0.1, libusb-1.0, VRPN 07_26
// tested on: Linux x86_64 w/ gcc 4.4.1

#ifndef __TRACKER_NOVINTFALCON_H
#define __TRACKER_NOVINTFALCON_H

#include "vrpn_Configure.h"

#if defined(VRPN_USE_LIBNIFALCON)

#include "vrpn_Tracker.h"
#include "vrpn_Button.h"
#include "vrpn_ForceDevice.h"

// Forward declaration for proxy class that wraps
// the device management of the falcon.
class vrpn_NovintFalcon_Device;

// Forward declaration for proxy class that maintains
// the list of objects that contribute to the force.
class vrpn_NovintFalcon_ForceObjects;

class VRPN_API vrpn_Tracker_NovintFalcon
    : public vrpn_Tracker, public vrpn_Button, public vrpn_ForceDevice {

public:
    /// custom constructor
    vrpn_Tracker_NovintFalcon(const char *name,
                              vrpn_Connection *c = NULL,
                              const int devidx = 0,
                              const char *grip = NULL,
                              const char *kine = NULL,
                              const char *damp = NULL);

    /// destructor
    ~vrpn_Tracker_NovintFalcon();

    /// Called once through each main loop iteration to handle updates.
    virtual void mainloop();

protected: // methods for tracker and button functionality
    virtual void reset();
    virtual int get_report(void);
    virtual void send_report(void);
    virtual void clear_values(void);

protected: // methods for force feedback functionality
    /// apply forces from known objects
    virtual void handle_forces(void);
public:
    /// apply received information about force field effects.
    virtual int update_forcefield_effect(vrpn_HANDLERPARAM p);
protected:
    int m_devflags; //< device configuration flags
    vrpn_float64 m_update_rate; //< update rate of device
    vrpn_float64 m_damp; //< damping factor for force updates
    struct timeval m_timestamp; //< last update of device status
    vrpn_NovintFalcon_Device *m_dev; //< device handle
    vrpn_NovintFalcon_ForceObjects *m_obj; //< handle to force generating objects
};

#endif /* defined(VRPN_USE_LIBNIFALCON) */
#endif
Something went wrong with that request. Please try again.