3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DonkeyCar ジョイスティックのステアリングをエクスポネンシャル化

Last updated at Posted at 2019-11-07

##ニュートラル付近のスティック操作はステアリングの変化量を小さくしたい
#~/projects/donkeycar/donkeycar/parts/controller.py

JoystickController クラス

_init__(self,...の引数リストに

  exponent = 1,

を追加
_init__(self,...の本体に

  self.exponent = exponent

を追加
def set_steering(self, axis_val): に

    if self.exponent > 1:
        if axis_val < 0:
            axis_val = (pow(self.exponent,abs(axis_val))-1) / (pow(self.exponent,1)-1) * -1
        else:
            axis_val = (pow(self.exponent,axis_val)-1) / (pow(self.exponent,1)-1)

を追加
def get_js_controller(cfg):の
ctr = cont_classの引数リストに

                            exponent=cfg.EXPONENT,

を追加

#~/mycar/myconfig.py

EXPONENT = 100

を追加

EXPONENT の値が1以下の時はエキスポネンシャル無し
y = x

設定する数値が大きいほどスティックの角度に対するステアリング値の0付近のカーブが緩やかになる
y = EXPONENT の x乗

無題.jpg
系列1:EXPONENT=1.1
系列2:EXPONENT=10
系列3:EXPONENT=50
系列4:EXPONENT=100
系列5:EXPONENT=500
系列6:EXPONENT=1000

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?