-
Notifications
You must be signed in to change notification settings - Fork 0
/
AxsCmdGearInData.go
198 lines (173 loc) · 6.03 KB
/
AxsCmdGearInData.go
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package fbtypes
import (
flatbuffers "github.com/google/flatbuffers/go"
)
/// parameters of the axis GearIn commands
type AxsCmdGearInDataT struct {
MasterName string
RatioMaster int32
RatioSlave int32
Offset float64
OffsetDLIdx int32
CmdMode SyncCmdMode
Buffered bool
}
func (t *AxsCmdGearInDataT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
masterNameOffset := builder.CreateString(t.MasterName)
AxsCmdGearInDataStart(builder)
AxsCmdGearInDataAddMasterName(builder, masterNameOffset)
AxsCmdGearInDataAddRatioMaster(builder, t.RatioMaster)
AxsCmdGearInDataAddRatioSlave(builder, t.RatioSlave)
AxsCmdGearInDataAddOffset(builder, t.Offset)
AxsCmdGearInDataAddOffsetDLIdx(builder, t.OffsetDLIdx)
AxsCmdGearInDataAddCmdMode(builder, t.CmdMode)
AxsCmdGearInDataAddBuffered(builder, t.Buffered)
return AxsCmdGearInDataEnd(builder)
}
func (rcv *AxsCmdGearInData) UnPackTo(t *AxsCmdGearInDataT) {
t.MasterName = string(rcv.MasterName())
t.RatioMaster = rcv.RatioMaster()
t.RatioSlave = rcv.RatioSlave()
t.Offset = rcv.Offset()
t.OffsetDLIdx = rcv.OffsetDLIdx()
t.CmdMode = rcv.CmdMode()
t.Buffered = rcv.Buffered()
}
func (rcv *AxsCmdGearInData) UnPack() *AxsCmdGearInDataT {
if rcv == nil { return nil }
t := &AxsCmdGearInDataT{}
rcv.UnPackTo(t)
return t
}
type AxsCmdGearInData struct {
_tab flatbuffers.Table
}
func GetRootAsAxsCmdGearInData(buf []byte, offset flatbuffers.UOffsetT) *AxsCmdGearInData {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &AxsCmdGearInData{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsAxsCmdGearInData(buf []byte, offset flatbuffers.UOffsetT) *AxsCmdGearInData {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &AxsCmdGearInData{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *AxsCmdGearInData) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *AxsCmdGearInData) Table() flatbuffers.Table {
return rcv._tab
}
/// name of the master axis
func (rcv *AxsCmdGearInData) MasterName() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
/// name of the master axis
/// gear ratio, master side (can be negative)
func (rcv *AxsCmdGearInData) RatioMaster() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 1
}
/// gear ratio, master side (can be negative)
func (rcv *AxsCmdGearInData) MutateRatioMaster(n int32) bool {
return rcv._tab.MutateInt32Slot(6, n)
}
/// gear ratio, slave side (can be negative)
func (rcv *AxsCmdGearInData) RatioSlave() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 1
}
/// gear ratio, slave side (can be negative)
func (rcv *AxsCmdGearInData) MutateRatioSlave(n int32) bool {
return rcv._tab.MutateInt32Slot(8, n)
}
/// post gear offset (position or velocity) as a constant value (set to 0.0, to have no offset); only used, when offsetDLIdx < 0
func (rcv *AxsCmdGearInData) Offset() float64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.GetFloat64(o + rcv._tab.Pos)
}
return 0.0
}
/// post gear offset (position or velocity) as a constant value (set to 0.0, to have no offset); only used, when offsetDLIdx < 0
func (rcv *AxsCmdGearInData) MutateOffset(n float64) bool {
return rcv._tab.MutateFloat64Slot(10, n)
}
/// index of the DataLayerRT motion input for the post gear offset (position or velocity) (set to -1, to use the constant offset)
func (rcv *AxsCmdGearInData) OffsetDLIdx() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return -1
}
/// index of the DataLayerRT motion input for the post gear offset (position or velocity) (set to -1, to use the constant offset)
func (rcv *AxsCmdGearInData) MutateOffsetDLIdx(n int32) bool {
return rcv._tab.MutateInt32Slot(12, n)
}
/// Sync command mode
func (rcv *AxsCmdGearInData) CmdMode() SyncCmdMode {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return SyncCmdMode(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 2
}
/// Sync command mode
func (rcv *AxsCmdGearInData) MutateCmdMode(n SyncCmdMode) bool {
return rcv._tab.MutateInt8Slot(14, int8(n))
}
/// should this be a buffered command?
func (rcv *AxsCmdGearInData) Buffered() bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return rcv._tab.GetBool(o + rcv._tab.Pos)
}
return false
}
/// should this be a buffered command?
func (rcv *AxsCmdGearInData) MutateBuffered(n bool) bool {
return rcv._tab.MutateBoolSlot(16, n)
}
func AxsCmdGearInDataStart(builder *flatbuffers.Builder) {
builder.StartObject(7)
}
func AxsCmdGearInDataAddMasterName(builder *flatbuffers.Builder, masterName flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(masterName), 0)
}
func AxsCmdGearInDataAddRatioMaster(builder *flatbuffers.Builder, ratioMaster int32) {
builder.PrependInt32Slot(1, ratioMaster, 1)
}
func AxsCmdGearInDataAddRatioSlave(builder *flatbuffers.Builder, ratioSlave int32) {
builder.PrependInt32Slot(2, ratioSlave, 1)
}
func AxsCmdGearInDataAddOffset(builder *flatbuffers.Builder, offset float64) {
builder.PrependFloat64Slot(3, offset, 0.0)
}
func AxsCmdGearInDataAddOffsetDLIdx(builder *flatbuffers.Builder, offsetDLIdx int32) {
builder.PrependInt32Slot(4, offsetDLIdx, -1)
}
func AxsCmdGearInDataAddCmdMode(builder *flatbuffers.Builder, cmdMode SyncCmdMode) {
builder.PrependInt8Slot(5, int8(cmdMode), 2)
}
func AxsCmdGearInDataAddBuffered(builder *flatbuffers.Builder, buffered bool) {
builder.PrependBoolSlot(6, buffered, false)
}
func AxsCmdGearInDataEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}