/
TecsStatus.gen.go
280 lines (252 loc) · 10.3 KB
/
TecsStatus.gen.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
This file is part of rclgo
Copyright © 2021 Technology Innovation Institute, United Arab Emirates
Licensed under the Apache License, Version 2.0 (the "License");
http://www.apache.org/licenses/LICENSE-2.0
*/
/*
THIS FILE IS AUTOGENERATED BY 'rclgo-gen generate'
*/
package px4_msgs_msg
import (
"unsafe"
"github.com/TIERS/rclgo/pkg/rclgo/types"
"github.com/TIERS/rclgo/pkg/rclgo/typemap"
)
/*
#cgo LDFLAGS: -L/opt/ros/foxy/lib -Wl,-rpath=/opt/ros/foxy/lib -lrcl -lrosidl_runtime_c -lrosidl_typesupport_c -lrcutils -lrmw_implementation
#cgo LDFLAGS: -lpx4_msgs__rosidl_typesupport_c -lpx4_msgs__rosidl_generator_c
#cgo CFLAGS: -I/opt/ros/foxy/include
#include <rosidl_runtime_c/message_type_support_struct.h>
#include <px4_msgs/msg/tecs_status.h>
*/
import "C"
func init() {
typemap.RegisterMessage("px4_msgs/TecsStatus", TecsStatusTypeSupport)
}
const (
TecsStatus_TECS_MODE_NORMAL uint8 = 0
TecsStatus_TECS_MODE_UNDERSPEED uint8 = 1
TecsStatus_TECS_MODE_TAKEOFF uint8 = 2
TecsStatus_TECS_MODE_LAND uint8 = 3
TecsStatus_TECS_MODE_LAND_THROTTLELIM uint8 = 4
TecsStatus_TECS_MODE_BAD_DESCENT uint8 = 5
TecsStatus_TECS_MODE_CLIMBOUT uint8 = 6
)
// Do not create instances of this type directly. Always use NewTecsStatus
// function instead.
type TecsStatus struct {
Timestamp uint64 `yaml:"timestamp"`// time since system start (microseconds)
AltitudeSp float32 `yaml:"altitude_sp"`
AltitudeFiltered float32 `yaml:"altitude_filtered"`
HeightRateSetpoint float32 `yaml:"height_rate_setpoint"`
HeightRate float32 `yaml:"height_rate"`
EquivalentAirspeedSp float32 `yaml:"equivalent_airspeed_sp"`
TrueAirspeedSp float32 `yaml:"true_airspeed_sp"`
TrueAirspeedFiltered float32 `yaml:"true_airspeed_filtered"`
TrueAirspeedDerivativeSp float32 `yaml:"true_airspeed_derivative_sp"`
TrueAirspeedDerivative float32 `yaml:"true_airspeed_derivative"`
TotalEnergyError float32 `yaml:"total_energy_error"`
EnergyDistributionError float32 `yaml:"energy_distribution_error"`
TotalEnergyRateError float32 `yaml:"total_energy_rate_error"`
EnergyDistributionRateError float32 `yaml:"energy_distribution_rate_error"`
TotalEnergy float32 `yaml:"total_energy"`
TotalEnergyRate float32 `yaml:"total_energy_rate"`
TotalEnergyBalance float32 `yaml:"total_energy_balance"`
TotalEnergyBalanceRate float32 `yaml:"total_energy_balance_rate"`
TotalEnergySp float32 `yaml:"total_energy_sp"`
TotalEnergyRateSp float32 `yaml:"total_energy_rate_sp"`
TotalEnergyBalanceSp float32 `yaml:"total_energy_balance_sp"`
TotalEnergyBalanceRateSp float32 `yaml:"total_energy_balance_rate_sp"`
ThrottleInteg float32 `yaml:"throttle_integ"`
PitchInteg float32 `yaml:"pitch_integ"`
ThrottleSp float32 `yaml:"throttle_sp"`
Mode uint8 `yaml:"mode"`
}
// NewTecsStatus creates a new TecsStatus with default values.
func NewTecsStatus() *TecsStatus {
self := TecsStatus{}
self.SetDefaults()
return &self
}
func (t *TecsStatus) Clone() *TecsStatus {
c := &TecsStatus{}
c.Timestamp = t.Timestamp
c.AltitudeSp = t.AltitudeSp
c.AltitudeFiltered = t.AltitudeFiltered
c.HeightRateSetpoint = t.HeightRateSetpoint
c.HeightRate = t.HeightRate
c.EquivalentAirspeedSp = t.EquivalentAirspeedSp
c.TrueAirspeedSp = t.TrueAirspeedSp
c.TrueAirspeedFiltered = t.TrueAirspeedFiltered
c.TrueAirspeedDerivativeSp = t.TrueAirspeedDerivativeSp
c.TrueAirspeedDerivative = t.TrueAirspeedDerivative
c.TotalEnergyError = t.TotalEnergyError
c.EnergyDistributionError = t.EnergyDistributionError
c.TotalEnergyRateError = t.TotalEnergyRateError
c.EnergyDistributionRateError = t.EnergyDistributionRateError
c.TotalEnergy = t.TotalEnergy
c.TotalEnergyRate = t.TotalEnergyRate
c.TotalEnergyBalance = t.TotalEnergyBalance
c.TotalEnergyBalanceRate = t.TotalEnergyBalanceRate
c.TotalEnergySp = t.TotalEnergySp
c.TotalEnergyRateSp = t.TotalEnergyRateSp
c.TotalEnergyBalanceSp = t.TotalEnergyBalanceSp
c.TotalEnergyBalanceRateSp = t.TotalEnergyBalanceRateSp
c.ThrottleInteg = t.ThrottleInteg
c.PitchInteg = t.PitchInteg
c.ThrottleSp = t.ThrottleSp
c.Mode = t.Mode
return c
}
func (t *TecsStatus) CloneMsg() types.Message {
return t.Clone()
}
func (t *TecsStatus) SetDefaults() {
t.Timestamp = 0
t.AltitudeSp = 0
t.AltitudeFiltered = 0
t.HeightRateSetpoint = 0
t.HeightRate = 0
t.EquivalentAirspeedSp = 0
t.TrueAirspeedSp = 0
t.TrueAirspeedFiltered = 0
t.TrueAirspeedDerivativeSp = 0
t.TrueAirspeedDerivative = 0
t.TotalEnergyError = 0
t.EnergyDistributionError = 0
t.TotalEnergyRateError = 0
t.EnergyDistributionRateError = 0
t.TotalEnergy = 0
t.TotalEnergyRate = 0
t.TotalEnergyBalance = 0
t.TotalEnergyBalanceRate = 0
t.TotalEnergySp = 0
t.TotalEnergyRateSp = 0
t.TotalEnergyBalanceSp = 0
t.TotalEnergyBalanceRateSp = 0
t.ThrottleInteg = 0
t.PitchInteg = 0
t.ThrottleSp = 0
t.Mode = 0
}
// CloneTecsStatusSlice clones src to dst by calling Clone for each element in
// src. Panics if len(dst) < len(src).
func CloneTecsStatusSlice(dst, src []TecsStatus) {
for i := range src {
dst[i] = *src[i].Clone()
}
}
// Modifying this variable is undefined behavior.
var TecsStatusTypeSupport types.MessageTypeSupport = _TecsStatusTypeSupport{}
type _TecsStatusTypeSupport struct{}
func (t _TecsStatusTypeSupport) New() types.Message {
return NewTecsStatus()
}
func (t _TecsStatusTypeSupport) PrepareMemory() unsafe.Pointer { //returns *C.px4_msgs__msg__TecsStatus
return (unsafe.Pointer)(C.px4_msgs__msg__TecsStatus__create())
}
func (t _TecsStatusTypeSupport) ReleaseMemory(pointer_to_free unsafe.Pointer) {
C.px4_msgs__msg__TecsStatus__destroy((*C.px4_msgs__msg__TecsStatus)(pointer_to_free))
}
func (t _TecsStatusTypeSupport) AsCStruct(dst unsafe.Pointer, msg types.Message) {
m := msg.(*TecsStatus)
mem := (*C.px4_msgs__msg__TecsStatus)(dst)
mem.timestamp = C.uint64_t(m.Timestamp)
mem.altitude_sp = C.float(m.AltitudeSp)
mem.altitude_filtered = C.float(m.AltitudeFiltered)
mem.height_rate_setpoint = C.float(m.HeightRateSetpoint)
mem.height_rate = C.float(m.HeightRate)
mem.equivalent_airspeed_sp = C.float(m.EquivalentAirspeedSp)
mem.true_airspeed_sp = C.float(m.TrueAirspeedSp)
mem.true_airspeed_filtered = C.float(m.TrueAirspeedFiltered)
mem.true_airspeed_derivative_sp = C.float(m.TrueAirspeedDerivativeSp)
mem.true_airspeed_derivative = C.float(m.TrueAirspeedDerivative)
mem.total_energy_error = C.float(m.TotalEnergyError)
mem.energy_distribution_error = C.float(m.EnergyDistributionError)
mem.total_energy_rate_error = C.float(m.TotalEnergyRateError)
mem.energy_distribution_rate_error = C.float(m.EnergyDistributionRateError)
mem.total_energy = C.float(m.TotalEnergy)
mem.total_energy_rate = C.float(m.TotalEnergyRate)
mem.total_energy_balance = C.float(m.TotalEnergyBalance)
mem.total_energy_balance_rate = C.float(m.TotalEnergyBalanceRate)
mem.total_energy_sp = C.float(m.TotalEnergySp)
mem.total_energy_rate_sp = C.float(m.TotalEnergyRateSp)
mem.total_energy_balance_sp = C.float(m.TotalEnergyBalanceSp)
mem.total_energy_balance_rate_sp = C.float(m.TotalEnergyBalanceRateSp)
mem.throttle_integ = C.float(m.ThrottleInteg)
mem.pitch_integ = C.float(m.PitchInteg)
mem.throttle_sp = C.float(m.ThrottleSp)
mem.mode = C.uint8_t(m.Mode)
}
func (t _TecsStatusTypeSupport) AsGoStruct(msg types.Message, ros2_message_buffer unsafe.Pointer) {
m := msg.(*TecsStatus)
mem := (*C.px4_msgs__msg__TecsStatus)(ros2_message_buffer)
m.Timestamp = uint64(mem.timestamp)
m.AltitudeSp = float32(mem.altitude_sp)
m.AltitudeFiltered = float32(mem.altitude_filtered)
m.HeightRateSetpoint = float32(mem.height_rate_setpoint)
m.HeightRate = float32(mem.height_rate)
m.EquivalentAirspeedSp = float32(mem.equivalent_airspeed_sp)
m.TrueAirspeedSp = float32(mem.true_airspeed_sp)
m.TrueAirspeedFiltered = float32(mem.true_airspeed_filtered)
m.TrueAirspeedDerivativeSp = float32(mem.true_airspeed_derivative_sp)
m.TrueAirspeedDerivative = float32(mem.true_airspeed_derivative)
m.TotalEnergyError = float32(mem.total_energy_error)
m.EnergyDistributionError = float32(mem.energy_distribution_error)
m.TotalEnergyRateError = float32(mem.total_energy_rate_error)
m.EnergyDistributionRateError = float32(mem.energy_distribution_rate_error)
m.TotalEnergy = float32(mem.total_energy)
m.TotalEnergyRate = float32(mem.total_energy_rate)
m.TotalEnergyBalance = float32(mem.total_energy_balance)
m.TotalEnergyBalanceRate = float32(mem.total_energy_balance_rate)
m.TotalEnergySp = float32(mem.total_energy_sp)
m.TotalEnergyRateSp = float32(mem.total_energy_rate_sp)
m.TotalEnergyBalanceSp = float32(mem.total_energy_balance_sp)
m.TotalEnergyBalanceRateSp = float32(mem.total_energy_balance_rate_sp)
m.ThrottleInteg = float32(mem.throttle_integ)
m.PitchInteg = float32(mem.pitch_integ)
m.ThrottleSp = float32(mem.throttle_sp)
m.Mode = uint8(mem.mode)
}
func (t _TecsStatusTypeSupport) TypeSupport() unsafe.Pointer {
return unsafe.Pointer(C.rosidl_typesupport_c__get_message_type_support_handle__px4_msgs__msg__TecsStatus())
}
type CTecsStatus = C.px4_msgs__msg__TecsStatus
type CTecsStatus__Sequence = C.px4_msgs__msg__TecsStatus__Sequence
func TecsStatus__Sequence_to_Go(goSlice *[]TecsStatus, cSlice CTecsStatus__Sequence) {
if cSlice.size == 0 {
return
}
*goSlice = make([]TecsStatus, int64(cSlice.size))
for i := 0; i < int(cSlice.size); i++ {
cIdx := (*C.px4_msgs__msg__TecsStatus__Sequence)(unsafe.Pointer(
uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_px4_msgs__msg__TecsStatus * uintptr(i)),
))
TecsStatusTypeSupport.AsGoStruct(&(*goSlice)[i], unsafe.Pointer(cIdx))
}
}
func TecsStatus__Sequence_to_C(cSlice *CTecsStatus__Sequence, goSlice []TecsStatus) {
if len(goSlice) == 0 {
return
}
cSlice.data = (*C.px4_msgs__msg__TecsStatus)(C.malloc((C.size_t)(C.sizeof_struct_px4_msgs__msg__TecsStatus * uintptr(len(goSlice)))))
cSlice.capacity = C.size_t(len(goSlice))
cSlice.size = cSlice.capacity
for i, v := range goSlice {
cIdx := (*C.px4_msgs__msg__TecsStatus)(unsafe.Pointer(
uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_px4_msgs__msg__TecsStatus * uintptr(i)),
))
TecsStatusTypeSupport.AsCStruct(unsafe.Pointer(cIdx), &v)
}
}
func TecsStatus__Array_to_Go(goSlice []TecsStatus, cSlice []CTecsStatus) {
for i := 0; i < len(cSlice); i++ {
TecsStatusTypeSupport.AsGoStruct(&goSlice[i], unsafe.Pointer(&cSlice[i]))
}
}
func TecsStatus__Array_to_C(cSlice []CTecsStatus, goSlice []TecsStatus) {
for i := 0; i < len(goSlice); i++ {
TecsStatusTypeSupport.AsCStruct(unsafe.Pointer(&cSlice[i]), &goSlice[i])
}
}