27 return (
double)(msg_time.tv_sec) + (
double)msg_time.tv_usec * 0.000001;
39 VrpnClient(
const std::string &server) :
42 _connection = vrpn_get_connection_by_name(server.c_str());
49 INLINE
void VrpnClient::
50 tracker_position(
const std::string &tracker,
const vrpn_TRACKERCB info) {
52 LPoint3 pos(info.pos[0], info.pos[1], info.pos[2]);
53 LVector4 pquat(info.quat[0], info.quat[1], info.quat[2], info.quat[3]);
55 push_tracker_position(tracker, info.sensor, ptime, pos, pquat);
62 INLINE
void VrpnClient::
63 tracker_velocity(
const std::string &tracker,
const vrpn_TRACKERVELCB info) {
65 LPoint3 vel(info.vel[0], info.vel[1], info.vel[2]);
66 LVector4 vquat(info.vel_quat[0], info.vel_quat[1],
67 info.vel_quat[2], info.vel_quat[3]);
68 PN_stdfloat dt = info.vel_quat_dt;
70 push_tracker_velocity(tracker, info.sensor, vtime, vel, vquat, dt);
76 INLINE
void VrpnClient::
77 tracker_acceleration(
const std::string &tracker,
const vrpn_TRACKERACCCB info) {
79 LPoint3 acc(info.acc[0], info.acc[1], info.acc[2]);
80 LVector4 aquat(info.acc_quat[0], info.acc_quat[1],
81 info.acc_quat[2], info.acc_quat[3]);
82 PN_stdfloat dt = info.acc_quat_dt;
84 push_tracker_acceleration(tracker, info.sensor, atime, acc, aquat, dt);
90 INLINE
void VrpnClient::
91 analog(
const std::string &analog,
const vrpn_ANALOGCB info) {
94 push_analog(analog, atime, info.channel, info.num_channel);
100 INLINE
void VrpnClient::
101 button(
const std::string &button,
const vrpn_BUTTONCB info) {
104 push_button(button, btime, info.button, info.state);
110 INLINE
void VrpnClient::
111 dial(
const std::string &dial,
const vrpn_DIALCB info) {
114 push_dial(dial, dtime, info.dial, info.change);
An abstract base class for a family of client device interfaces–including trackers,...
static double convert_to_secs(struct timeval msg_time)
Little inline function to convert a struct timeval to only seconds.
const std::string & get_server_name() const
Returns the name of the server as passed to the VrpnClient constructor.