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

Add calibrateInertiaSensor function and add calibration function with dialog #562 #565

Merged
merged 6 commits into from
Apr 13, 2015
Merged

Add calibrateInertiaSensor function and add calibration function with dialog #562 #565

merged 6 commits into from
Apr 13, 2015

Conversation

k-okada
Copy link
Contributor

@k-okada k-okada commented Apr 12, 2015

  • [hrpsys_config.py] remove waitInputConfirmWithDisplayCheck(), since waitInputConfirm() in waitInput.py now support non-X environment
  • [hrpsys_config.py] previous commit changes waitInputConfirm() behavior, it returns True/False for Ok/Cance, not raise error
  • [waitInput.py] if window is not available, ask via screen
  • Add calibrateInertiaSensor function and add calibration function with dialog

@k-okada
Copy link
Contributor Author

k-okada commented Apr 12, 2015

waitInputConfirmを以下のようにしましたがどうでしょうか?
displayが無いとscreenに文字を出してキーボード入力を要求します.
(つまりこれを知らないでプログラムを書くと,プログラムが止まって進まない)
これで,
#480
にあるように,いままでは
displayがない,Cancelを押す,とexceptionがでてきますが
これからは,
今度はOKを押す,displayがない後のスクリーンの{y/n}でyを押すとtrue
今度はCancelを押す,displayがない後のスクリーンの{y/n}でnを押すとfalse
それ以外がexceptionになります.
これで,k-okada@df93ef2
が必要になります.
これいがいに見つけているのでは,
https://github.com/start-jsk/rtmros_hironx/blob/hydro-devel/hironx_ros_bridge/src/hironx_ros_bridge/hironx_client.py#L498
です.(@130s)

def waitInputConfirm(msg):
    root = None
    try:
        root = Tk()
    root.withdraw()
        ret = askokcancel("waitInputConfirm", msg)
    return ret == True
    except Exception:
        e1, e2, e3 = sys.exc_info()
        if "couldn't connect to display" in str(e2):
            c = raw_input(msg+' (Enter [Y/y] to proceed) ').lower()
            return c == 'y' or c == ''
        raise e1, e2, e3
    finally:
        if root:
            root.destroy()
    return True

@k-okada
Copy link
Contributor Author

k-okada commented Apr 12, 2015

Refer to this link for build results (access rights to CI server needed):
http://jenkins.jsk.imi.i.u-tokyo.ac.jp:8080/job/hrpsys-qnx/1940/
Test PASSed.

@k-okada
Copy link
Contributor Author

k-okada commented Apr 12, 2015

Refer to this link for build results (access rights to CI server needed):
http://jenkins.jsk.imi.i.u-tokyo.ac.jp:8080/job/hrpsys-qnx/1941/
Test PASSed.

k-okada added 5 commits April 13, 2015 08:33
…es behavior of waitInputConfirm() which previously raise error on cancel input, but not it returns False
…r, it returns True/False for Ok/Cance, not raise error
…aitInputConfirm() in waitInput.py now support non-X environment
@k-okada
Copy link
Contributor Author

k-okada commented Apr 13, 2015

Refer to this link for build results (access rights to CI server needed):
http://jenkins.jsk.imi.i.u-tokyo.ac.jp:8080/job/hrpsys-qnx/1943/
Test PASSed.

@snozawa
Copy link
Contributor

snozawa commented Apr 13, 2015

今度はOKを押す,displayがない後のスクリーンの{y/n}でyを押すとtrue
今度はCancelを押す,displayがない後のスクリーンの{y/n}でnを押すとfalse
それ以外がexceptionになります.

この挙動に大賛成です.
今まではホントはcancelを押してfalseがかえってきて欲しいところも,
問答無用でexceptionになっていまして,この変更をもともと要望していました.
#480

また,waitInput系の関数を
#562
ではhrpsys_config.pyにいれてましたが,これはexceptionがfalseのかわりにつかわれてるからで,
CancelボタンがfalseになったらwaitINput.pyにいれてよさそうです.

(つまりこれを知らないでプログラムを書くと,プログラムが止まって進まない)

もともとwaitInputConfirmがあるコードなので,これをインタプリタ的につかうユーザも
プログラムがとまることを想定しているということにしちゃって良いと思います.
しいていうなら,ドキュメントをちょっと充実くらいでしょうか(confirmのダイアログがでますよ,と)

fkanehiro added a commit that referenced this pull request Apr 13, 2015
…ction

Add calibrateInertiaSensor function and add calibration function with dialog #562
@fkanehiro fkanehiro merged commit 0a1ba84 into fkanehiro:master Apr 13, 2015
@k-okada k-okada deleted the add_calibrate_inetria_sensor_function branch April 13, 2015 09:24
@k-okada
Copy link
Contributor Author

k-okada commented Apr 13, 2015

メモですが,
k-okada@922ffe2
hrpsys_config.py にある

  • def waitInputConfirmWithDisplayCheck(self, print_str):

はなくなって,waitInputConfirm()を使うようになりました

Cc: @eisoku9618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants