Documentation
¶
Index ¶
- func ReadPCAPFile(ctx context.Context, pcapFile string, udpPort int, parser Parser, ...) error
- func ReadPCAPFileRealtime(ctx context.Context, pcapFile string, udpPort int, parser Parser, ...) error
- type ForegroundForwarder
- type FrameBuilder
- type PacketForwarder
- type PacketStats
- type PacketStatsInterface
- type Parser
- type RealtimeReplayConfig
- type SensorConfig
- type UDPListener
- type UDPListenerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadPCAPFile ¶
func ReadPCAPFile(ctx context.Context, pcapFile string, udpPort int, parser Parser, frameBuilder FrameBuilder, stats PacketStatsInterface, forwarder *PacketForwarder, startSeconds float64, durationSeconds float64) error
ReadPCAPFile is a stub implementation when PCAP support is disabled Build with -tags=pcap to enable PCAP file reading
func ReadPCAPFileRealtime ¶
func ReadPCAPFileRealtime(ctx context.Context, pcapFile string, udpPort int, parser Parser, frameBuilder FrameBuilder, stats PacketStatsInterface, config RealtimeReplayConfig) error
ReadPCAPFileRealtime is a stub that returns an error when pcap support is not compiled in.
Types ¶
type ForegroundForwarder ¶
type ForegroundForwarder struct {
// contains filtered or unexported fields
}
ForegroundForwarder handles forwarding of foreground-only point clouds as UDP packets. Points are encoded as Pandar40P-compatible packets on a separate port (default 2370).
func NewForegroundForwarder ¶
func NewForegroundForwarder(addr string, port int, config *SensorConfig) (*ForegroundForwarder, error)
NewForegroundForwarder creates a new foreground packet forwarder.
func (*ForegroundForwarder) Close ¶
func (f *ForegroundForwarder) Close() error
Close closes the UDP connection and channel.
func (*ForegroundForwarder) ForwardForeground ¶
func (f *ForegroundForwarder) ForwardForeground(points []lidar.PointPolar)
ForwardForeground queues foreground points for forwarding.
func (*ForegroundForwarder) Start ¶
func (f *ForegroundForwarder) Start(ctx context.Context)
Start begins the foreground forwarding goroutine.
type FrameBuilder ¶
type FrameBuilder interface {
AddPointsPolar(points []lidar.PointPolar)
SetMotorSpeed(rpm uint16) // Update expected frame duration based on motor speed
}
FrameBuilder interface for building LiDAR frames
type PacketForwarder ¶
type PacketForwarder struct {
// contains filtered or unexported fields
}
PacketForwarder handles asynchronous forwarding of UDP packets to another address It provides non-blocking packet forwarding with error tracking and logging
func NewPacketForwarder ¶
func NewPacketForwarder(addr string, port int, stats PacketStats, logInterval time.Duration) (*PacketForwarder, error)
NewPacketForwarder creates a new packet forwarder that sends packets to the specified address
func (*PacketForwarder) Close ¶
func (f *PacketForwarder) Close() error
Close closes the UDP connection and channel
func (*PacketForwarder) ForwardAsync ¶
func (f *PacketForwarder) ForwardAsync(packet []byte)
ForwardAsync sends a packet to the forwarding channel in a non-blocking manner If the channel is full, the packet is dropped and the drop counter is incremented
func (*PacketForwarder) Start ¶
func (f *PacketForwarder) Start(ctx context.Context)
Start begins the packet forwarding goroutine that processes packets from the channel It logs dropped packets at the specified interval and handles context cancellation
type PacketStats ¶
type PacketStats interface {
AddDropped()
}
PacketStats interface for packet statistics tracking
type PacketStatsInterface ¶
type PacketStatsInterface interface {
AddPacket(bytes int)
AddDropped()
AddPoints(count int)
LogStats(parsePackets bool)
}
PacketStatsInterface provides packet statistics management
type Parser ¶
type Parser interface {
ParsePacket(packet []byte) ([]lidar.PointPolar, error)
GetLastMotorSpeed() uint16 // Get motor speed from last parsed packet
}
Parser interface for parsing LiDAR packets
type RealtimeReplayConfig ¶
type RealtimeReplayConfig struct {
SpeedMultiplier float64
StartSeconds float64
DurationSeconds float64
SensorID string
PacketForwarder *PacketForwarder
ForegroundForwarder *ForegroundForwarder
BackgroundManager *lidar.BackgroundManager
WarmupPackets int
DebugRingMin int
DebugRingMax int
DebugAzMin float32
DebugAzMax float32
OnFrameCallback func(mgr *lidar.BackgroundManager, points []lidar.PointPolar)
}
RealtimeReplayConfig is a stub when pcap is not available.
type SensorConfig ¶
SensorConfig holds sensor configuration for packet encoding.
func DefaultSensorConfig ¶
func DefaultSensorConfig() *SensorConfig
DefaultSensorConfig returns default configuration for Pandar40P.
type UDPListener ¶
type UDPListener struct {
// contains filtered or unexported fields
}
UDPListener handles receiving and processing LiDAR packets from UDP with configurable components for parsing, statistics, and forwarding
func NewUDPListener ¶
func NewUDPListener(config UDPListenerConfig) *UDPListener
NewUDPListener creates a new UDP listener with the provided configuration
func (*UDPListener) Close ¶
func (l *UDPListener) Close() error
Close closes the UDP listener and releases resources
type UDPListenerConfig ¶
type UDPListenerConfig struct {
Address string
RcvBuf int
LogInterval time.Duration
Stats PacketStatsInterface
Forwarder *PacketForwarder
Parser Parser
FrameBuilder FrameBuilder
DB *db.DB
DisableParsing bool
UDPPort int // UDP port for normal operation (also used for PCAP filtering)
}
UDPListenerConfig contains configuration options for the UDP listener