Make MaxAngle configurable

Esse commit está contido em:
Felix Geisendörfer
2013-12-21 15:35:33 +01:00
commit 8921fbe17a
5 arquivos alterados com 11 adições e 3 exclusões
+1
Ver Arquivo
@@ -12,6 +12,7 @@ type Config struct {
LogFile string
LogLevel string
ControlTimeout time.Duration
MaxAngle int
RollPID []float64
PitchPID []float64
YawPID []float64
+4
Ver Arquivo
@@ -6,6 +6,10 @@ LogLevel = "debug"
# turn off. This keeps the drone from flying into space by accident.
ControlTimeout = "2s"
# The maximum rolll/pitch angle the client will send. Higher angle means faster
# horizontal movement.
MaxAngle = 12
# PID controller settings
# feel free to play with these to adjust control behavior
RollPID = [ 0.04, 0.0, 0.002 ]
+1
Ver Arquivo
@@ -77,6 +77,7 @@ func NewGoDrone(c Config) (g GoDrone, err error) {
Log: g.log,
Version: Version,
ControlTimeout: c.ControlTimeout,
MaxAngle: c.MaxAngle,
})
g.httpAddr = c.HttpAddr
g.navCh = make(chan navboard.Data)
+2 -2
Ver Arquivo
@@ -233,10 +233,10 @@
React.renderComponent(
<GoDrone
version={Config.version}
version={Config.Version}
wsUrl="ws://192.168.1.1/ws"
gamepadAxisMin={0.01}
maxAngle={6}
maxAngle={Config.MaxAngle}
flyButton={0}
pitchAxis={1}
rollAxis={0}
+3 -1
Ver Arquivo
@@ -24,6 +24,7 @@ type Config struct {
Log log.Interface
Version string
ControlTimeout time.Duration
MaxAngle int
}
// Handler provides a http.Handler.
@@ -115,7 +116,8 @@ func (h *Handler) handleWebsocket(conn *websocket.Conn) {
func (h *Handler) handleConfig(w http.ResponseWriter, r *http.Request) {
config := map[string]interface{}{
"version": h.config.Version,
"Version": h.config.Version,
"MaxAngle": h.config.MaxAngle,
}
data, err := json.Marshal(config)
if err != nil {