Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default component ID to 191; add --hb-componentid (#46) #47

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 35 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Features:
* [Usage](#usage)
* [Comparison with similar software](#comparison-with-similar-software)
* [Full command-line usage](#full-command-line-usage)
* [Standards](#standards)
* [Specifications](#specifications)
* [Links](#links)

## Installation
Expand Down Expand Up @@ -128,55 +128,48 @@ _mavp2p_ vs _mavlink-router_
## Full command-line usage

```
usage: mavp2p [<flags>] [<endpoints>...]
Usage: mavp2p [<endpoints> ...]

mavp2p v0.0.0

Link together Mavlink endpoints.
Arguments:
[<endpoints> ...] Space-separated list of endpoints. At least one endpoint is required. Possible endpoints types are:

Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
--version print version
-q, --quiet suppress info messages
--print print routed frames
--print-errors print parse errors singularly, instead of
printing only their quantity every 5 seconds
--hb-disable disable heartbeats
--hb-version=1 set mavlink version of heartbeats
--hb-systemid=125 set system id of heartbeats. it is
recommended to set a different system
id for each router in the network
--hb-period=5 set period of heartbeats
--streamreq-disable do not request streams to Ardupilot
devices, that need an explicit request
in order to emit telemetry streams.
this task is usually delegated to the
router, in order to avoid conflicts when
multiple ground stations are active
--streamreq-frequency=4 set the stream frequency to request

Args:
[<endpoints>] Space-separated list of endpoints. At least one
endpoint is required. Possible endpoints kinds are:

udps:listen_ip:port (udp, server mode)

udpc:dest_ip:port (udp, client mode)

udpb:broadcast_ip:port (udp, broadcast mode)

tcps:listen_ip:port (tcp, server mode)

tcpc:dest_ip:port (tcp, client mode)

serial:port:baudrate (serial)
udpc:dest_ip:port (udp, client mode)

udpb:broadcast_ip:port (udp, broadcast mode)

tcps:listen_ip:port (tcp, server mode)

tcpc:dest_ip:port (tcp, client mode)

serial:port:baudrate (serial)

udps:listen_ip:port (udp, server mode)

Flags:
-h, --help Show context-sensitive help.
--version print version.
-q, --quiet suppress info messages.
--print print routed frames.
--print-errors print parse errors singularly, instead of printing only their quantity every 5 seconds.
--read-timeout=10s timeout of read operations.
--write-timeout=10s timeout of write operations.
--idle-timeout=60s disconnect idle connections after a timeout.
--hb-disable disable heartbeats.
--hb-version=1 set mavlink version of heartbeats.
--hb-systemid=125 set system ID of heartbeats. it is recommended to set a different system id for each router in the network.
--hb-componentid=191 set component ID of heartbeats.
--hb-period=5 set period of heartbeats.
--streamreq-disable do not request streams to Ardupilot devices, that need an explicit request
in order to emit telemetry streams. this task is usually delegated to the router,
in order to avoid conflicts when multiple ground stations are active.
--streamreq-frequency=4 set the stream frequency to request.
```

## Standards
## Specifications

* [Mavlink standards](https://github.com/bluenviron/gomavlib#standards)
* [Mavlink specifications](https://github.com/bluenviron/gomavlib#specifications)

## Links

Expand Down
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ var cli struct {
WriteTimeout time.Duration `help:"timeout of write operations." default:"10s"`
IdleTimeout time.Duration `help:"disconnect idle connections after a timeout." default:"60s"`
HbDisable bool `help:"disable heartbeats."`
HbVersion string `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
HbVersion int `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
HbSystemid int `default:"125"`
HbComponentid int `help:"set component ID of heartbeats." default:"191"`
HbPeriod int `help:"set period of heartbeats." default:"5"`
StreamreqDisable bool
StreamreqFrequency int `help:"set the stream frequency to request." default:"4"`
Expand All @@ -175,7 +176,7 @@ func newProgram(args []string) (*program, error) {
return "print parse errors singularly, instead of printing only their quantity every 5 seconds."

case "hb-systemid":
return "set system id of heartbeats. it is recommended to set a different system id for each router in the network."
return "set system ID of heartbeats. it is recommended to set a different system id for each router in the network."

case "streamreq-disable":
return "do not request streams to Ardupilot devices," +
Expand Down Expand Up @@ -231,12 +232,13 @@ func newProgram(args []string) (*program, error) {
Endpoints: endpointConfs,
Dialect: generateDialect(cli.HbDisable, cli.StreamreqDisable),
OutVersion: func() gomavlib.Version {
if cli.HbVersion == "2" {
if cli.HbVersion == 2 {
return gomavlib.V2
}
return gomavlib.V1
}(),
OutSystemID: byte(cli.HbSystemid),
OutComponentID: byte(cli.HbComponentid),
HeartbeatDisable: cli.HbDisable,
HeartbeatPeriod: (time.Duration(cli.HbPeriod) * time.Second),
StreamRequestEnable: !cli.StreamreqDisable,
Expand Down
Loading