37 return (_connection->doing_okay() != 0);
48 return (_connection->connected() != 0);
60 return (
double)(msg_time.tv_sec) + (
double)msg_time.tv_usec * 0.000001;
74 VrpnClient(
const string &server) :
77 _connection = vrpn_get_connection_by_name(server.c_str());
87 INLINE
void VrpnClient::
88 tracker_position(
const string &tracker,
const vrpn_TRACKERCB info) {
90 LPoint3 pos(info.pos[0], info.pos[1], info.pos[2]);
91 LVector4 pquat(info.quat[0], info.quat[1], info.quat[2], info.quat[3]);
93 push_tracker_position(tracker, info.sensor, ptime, pos, pquat);
103 INLINE
void VrpnClient::
104 tracker_velocity(
const string &tracker,
const vrpn_TRACKERVELCB info) {
106 LPoint3 vel(info.vel[0], info.vel[1], info.vel[2]);
107 LVector4 vquat(info.vel_quat[0], info.vel_quat[1],
108 info.vel_quat[2], info.vel_quat[3]);
109 PN_stdfloat dt = info.vel_quat_dt;
111 push_tracker_velocity(tracker, info.sensor, vtime, vel, vquat, dt);
120 INLINE
void VrpnClient::
121 tracker_acceleration(
const string &tracker,
const vrpn_TRACKERACCCB info) {
123 LPoint3 acc(info.acc[0], info.acc[1], info.acc[2]);
124 LVector4 aquat(info.acc_quat[0], info.acc_quat[1],
125 info.acc_quat[2], info.acc_quat[3]);
126 PN_stdfloat dt = info.acc_quat_dt;
128 push_tracker_acceleration(tracker, info.sensor, atime, acc, aquat, dt);
137 INLINE
void VrpnClient::
138 analog(
const string &analog,
const vrpn_ANALOGCB info) {
141 push_analog(analog, atime, info.channel, info.num_channel);
150 INLINE
void VrpnClient::
151 button(
const string &button,
const vrpn_BUTTONCB info) {
154 push_button(button, btime, info.button, info.state);
163 INLINE
void VrpnClient::
164 dial(
const string &dial,
const vrpn_DIALCB info) {
167 push_dial(dial, dtime, info.dial, info.change);
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
const string & get_server_name() const
Returns the name of the server as passed to the VrpnClient constructor.
bool is_connected() const
Returns true if the connection is established successfully, false otherwise.
This is a four-component vector distance.
An abstract base class for a family of client device interfaces–including trackers, buttons, dials, and other analog inputs.
bool is_valid() const
Returns true if everything seems to be kosher with the server (even if there is no connection)...
static double convert_to_secs(struct timeval msg_time)
Little inline function to convert a struct timeval to only seconds.