例によって、上部のボタンは意味なし 。
原点に対する補正値を入れられるようにした。
起動時に、原点復帰を行う。
#!/bin/bash export test00=' echo $USER ' export SERVO0='50' export SERVO1='50' export SERVO2='50' export SERVO3='50' export SERVO4='50' export SERVO5='50' export SERVO6='50' export SERVO7='50' #原点に対する補正値の設定 export ADJUST0='4' export ADJUST1='3' export ADJUST2='-3' export ADJUST3='5' export ADJUST4='-4' export ADJUST5='-3' export ADJUST6='1' export ADJUST7='-3' for((i = 0; i <= 7; i++)); do echo $i=$((SERVO$i + ADJUST$i))% > /dev/servoblaster done export MAIN_DIALOG=' <window> <vbox> <hbox> <vbox> <hbox> <frame サーボ5(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1"> <default>50</default> <variable>SERVO5</variable> <action>bash -c "echo 5="$((SERVO5 + ADJUST5))"% > /dev/servoblaster"</action> <action type="refresh">TEXT5</action> </vscale> </frame> <frame サーボ4(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1"> <default>50</default> <variable>SERVO4</variable> <action>bash -c "echo 4="$((SERVO4 + ADJUST4))"% > /dev/servoblaster"</action> <action type="refresh">TEXT4</action> </vscale> </frame> </hbox> <hbox> <frame サーボ7(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1" inverted="true"> <default>50</default> <variable>SERVO7</variable> <action>bash -c "echo 7="$((SERVO7 + ADJUST7))"% > /dev/servoblaster"</action> <action type="refresh">TEXT7</action> </vscale> </frame> <frame サーボ6(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1"> <default>50</default> <variable>SERVO6</variable> <action>bash -c "echo 6="$((SERVO6 + ADJUST8))"% > /dev/servoblaster"</action> <action type="refresh">TEXT6</action> </vscale> </frame> </hbox> </vbox> <vbox> <hbox> <button> <label>ボタン 1</label> <action>echo $LANG</action> </button> <vbox> <button width-request="110"> <label>前進</label> <action>bash -c "$test00"</action> </button> <button> <label>後退</label> </button> </vbox> <button> <label>ボタン 4</label> </button> </hbox> <vbox> <frame> <text> <variable>TEXT0</variable> <input>echo "echo 0="$SERVO0"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT1</variable> <input>echo "echo 1="$SERVO1"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT2</variable> <input>echo "echo 2="$SERVO2"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT3</variable> <input>echo "echo 3="$SERVO3"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT4</variable> <input>echo "echo 4="$SERVO4"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT5</variable> <input>echo "echo 5="$SERVO5"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT6</variable> <input>echo "echo 6="$SERVO6"% > /dev/servoblaster"</input> </text> <text> <variable>TEXT7</variable> <input>echo "echo 7="$SERVO7"% > /dev/servoblaster"</input> </text> </frame> </vbox> <entry> <variable>FILE0</variable> <default>"./temp.txt"</default> </entry> <button> <label>新規作成</label> <action>echo "#!/bin/bash" > $FILE0</action> <action>echo "" >> $FILE0</action> <action>echo "echo 0="$((SERVO0 + ADJUST0))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 1="$((SERVO1 + ADJUST1))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 2="$((SERVO2 + ADJUST2))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 3="$((SERVO3 + ADJUST3))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 4="$((SERVO4 + ADJUST4))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 5="$((SERVO5 + ADJUST5))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 6="$((SERVO6 + ADJUST6))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 7="$((SERVO7 + ADJUST7))"% > /dev/servoblaster" >> $FILE0</action> </button> <button> <label>ポーズ追加</label> <action>echo "" >> $FILE0</action> <action>echo "sleep 1" >> $FILE0</action> <action>echo "" >> $FILE0</action> <action>echo "echo 0="$((SERVO0 + ADJUST0))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 1="$((SERVO1 + ADJUST1))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 2="$((SERVO2 + ADJUST2))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 3="$((SERVO3 + ADJUST3))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 4="$((SERVO4 + ADJUST4))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 5="$((SERVO5 + ADJUST5))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 6="$((SERVO6 + ADJUST6))"% > /dev/servoblaster" >> $FILE0</action> <action>echo "echo 7="$((SERVO7 + ADJUST7))"% > /dev/servoblaster" >> $FILE0</action> </button> </vbox> <vbox> <hbox> <frame サーボ0(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1" inverted="true"> <default>50</default> <variable>SERVO0</variable> <action>bash -c "echo 0="$((SERVO0 + ADJUST0))"% > /dev/servoblaster"</action> <action type="refresh">TEXT0</action> </vscale> </frame> <frame サーボ1(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1" inverted="true"> <default>50</default> <variable>SERVO1</variable> <action>bash -c "echo 1="$((SERVO1 + ADJUST1))"% > /dev/servoblaster"</action> <action type="refresh">TEXT1</action> </vscale> </frame> </hbox> <hbox> <frame サーボ2(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1" inverted="true"> <default>50</default> <variable>SERVO2</variable> <action>bash -c "echo 2="$((SERVO2 + ADJUST2))"% > /dev/servoblaster"</action> <action type="refresh">TEXT2</action> </vscale> </frame> <frame サーボ3(%)> <vscale height-request="200" range-min="10" range-max="90" range-step="1"> <default>50</default> <variable>SERVO3</variable> <action>bash -c "echo 3="$((SERVO3 + ADJUST3))"% > /dev/servoblaster"</action> <action type="refresh">TEXT3</action> </vscale> </frame> </hbox> </vbox> </hbox> </vbox> </window> ' gtkdialog -p MAIN_DIALOG -c
0 件のコメント :
コメントを投稿