RflySimSDK
v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
simulink
vrpn
vrpn_Poser_Analog.h
1
#ifndef vrpn_POSER_ANALOG_H
2
#define vrpn_POSER_ANALOG_H
3
#include <stdio.h>
// for NULL
4
5
#include "vrpn_Configure.h"
// for VRPN_API, VRPN_CALLBACK
6
#include "vrpn_Poser.h"
// for vrpn_Poser
7
#include "vrpn_Tracker.h"
// for vrpn_Tracker
8
#include "vrpn_Types.h"
// for vrpn_float64
9
10
class
VRPN_API
vrpn_Analog_Output_Remote
;
11
class
VRPN_API
vrpn_Connection
;
12
struct
vrpn_HANDLERPARAM
;
13
14
// This code is for a Poser server that uses a vrpn_Analog_Output to drive a
15
// device.
16
// It is basically the inverse of a vrpn_Tracker_AnalogFly.
17
// We are assuming that one Analog device will be used to drive all axes. This
18
// could be
19
// Changed by storing an Analog device per axis.
20
//
21
// This class can also act as a vrpn_Tracker so that it can report back the new
22
// positions
23
// and velocities to the client when the requests are within the bounds. This
24
// is not
25
// what you want it to do if you've got an independent tracker watching your
26
// output,
27
// and in any case is open-loop, so use with caution.
28
29
// Class for holding data used in transforming pose data to analog values for
30
// each axis
31
class
VRPN_API
vrpn_PA_axis
{
32
public
:
33
vrpn_PA_axis
(
char
*name = NULL,
int
c = -1,
double
offset = 0.0,
34
double
s = 1.0)
35
: ana_name(name)
36
, channel(c)
37
, offset(offset)
38
, scale(s)
39
{
40
}
41
42
char
*ana_name;
// Name of the Analog Output device to drive with this axis
43
int
channel;
// Which channel to use from the Analog device. Default value
44
// of -1 means
45
// no motion for this axis
46
double
offset;
// Offset to apply to pose values for this channel to reach 0
47
double
48
scale;
// Scale applied to pose values to get the correct analog value
49
};
50
51
// Class for passing in config data. Usually read from the vrpn.cfg file in the
52
// server code.
53
class
VRPN_API
vrpn_Poser_AnalogParam
{
54
public
:
55
vrpn_Poser_AnalogParam
();
56
57
// Translation for the three axes
58
vrpn_PA_axis
x, y, z;
59
60
// Rotation for the three axes
61
vrpn_PA_axis
rx, ry, rz;
62
63
// Workspace max and min info
64
vrpn_float64 pos_min[3], pos_max[3], pos_rot_min[3], pos_rot_max[3],
65
vel_min[3], vel_max[3], vel_rot_min[3], vel_rot_max[3];
66
};
67
68
class
VRPN_API
vrpn_Poser_Analog
;
// Forward reference
69
70
class
VRPN_API
vrpn_PA_fullaxis
{
71
public
:
72
vrpn_PA_fullaxis
(
void
)
73
{
74
ana = NULL;
75
value = 0.0;
76
pa = NULL;
77
};
78
79
vrpn_PA_axis
axis;
80
vrpn_Analog_Output_Remote
*ana;
81
vrpn_Poser_Analog
*pa;
82
double
value;
83
};
84
85
class
VRPN_API
vrpn_Poser_Analog
:
public
vrpn_Poser
,
public
vrpn_Tracker
{
86
public
:
87
vrpn_Poser_Analog
(
const
char
*name,
vrpn_Connection
*c,
88
vrpn_Poser_AnalogParam
*p,
bool
act_as_tracker =
false
);
89
90
virtual
~vrpn_Poser_Analog
();
91
92
virtual
void
mainloop
();
93
94
protected
:
95
// Axes for translation and rotation
96
vrpn_PA_fullaxis
x, y, z, rx, ry, rz;
97
98
// Should we act like a tracker, and report back values?
99
bool
d_act_as_tracker;
100
101
static
int
VRPN_CALLBACK
102
handle_change_message(
void
*userdata,
vrpn_HANDLERPARAM
p);
103
static
int
VRPN_CALLBACK
104
handle_vel_change_message(
void
*userdata,
vrpn_HANDLERPARAM
p);
105
106
// Routine to update the analog values from the current pose
107
bool
update_Analog_values();
108
bool
setup_channel(
vrpn_PA_fullaxis
*full);
109
};
110
111
#endif
vrpn_Analog_Output_Remote
定义
vrpn_Analog_Output.h:154
vrpn_Connection
Generic connection class not specific to the transport mechanism.
定义
vrpn_Connection.h:562
vrpn_PA_axis
定义
vrpn_Poser_Analog.h:31
vrpn_PA_fullaxis
定义
vrpn_Poser_Analog.h:70
vrpn_Poser_AnalogParam
定义
vrpn_Poser_Analog.h:53
vrpn_Poser_Analog
定义
vrpn_Poser_Analog.h:85
vrpn_Poser_Analog::mainloop
virtual void mainloop()
vrpn_Poser
定义
vrpn_Poser.h:18
vrpn_Tracker
定义
vrpn_Tracker.h:49
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
定义
vrpn_Connection.h:41
制作者
1.11.0