function
closeEventHandler(h)
sim.addLog(sim.verbosity_scriptinfos,
'Window '
..h..
' is closing...'
)
simUI.hide(h)
end
function
joint1_rotate(ui,id,newVal)
simUI.setLabelText(ui,3000,
'theta1 set to '
..newVal)
sim.setJointTargetPosition(joint1, newVal*deg)
end
function
joint2_rotate(ui,id,newVal)
simUI.setLabelText(ui,3000,
'theta2 set to '
..newVal)
sim.setJointTargetPosition(joint2, newVal*deg)
end
function
joint3_rotate(ui,id,newVal)
simUI.setLabelText(ui,3000,
'theta3 set to '
..newVal)
sim.setJointTargetPosition(joint3, newVal*deg)
end
function
joint16_rotate(ui,id,newVal)
simUI.setLabelText(ui,3000,
'theta16 set to '
..newVal)
sim.setJointTargetPosition(joint16, newVal*deg)
sim.setJointTargetPosition(joint20, -newVal*deg)
end
function
sysCall_init()
joint1 = sim.getObjectHandle(
'motor1'
)
joint2 = sim.getObjectHandle(
'motor2'
)
joint3 = sim.getObjectHandle(
'motor3'
)
joint16 = sim.getObjectHandle(
'motor16'
)
joint20 = sim.getObjectHandle(
'motor20'
)
i = 0
deg =
math.pi
/180
print
(i)
xml = [[
<ui closeable=
"true"
on-close=
"closeEventHandler"
resizable=
"true"
>
<label text=
"This is a demo of the CustomUI plugin. Browse through the tabs below to explore all the widgets that can be created with the plugin."
wordwrap=
"true"
/>
<tabs>
<tab title=
"Numeric"
>a
<label text=
"Sliders can be oriented horizontally or vertically, and have optional properties that can be set (in the XML) such as minimum and maximum value."
wordwrap=
"true"
/>
<label text=
""
id=
"3000"
wordwrap=
"true"
/>
<label text=
"theta1"
/> <hslider tick-position=
"above"
tick-interval=
"1"
minimum=
"0"
maximum=
"360"
on-change=
"joint1_rotate"
/>
<label text=
"theta2"
/> <hslider tick-position=
"above"
tick-interval=
"1"
minimum=
"-90"
maximum=
"65"
on-change=
"joint2_rotate"
/>
<label text=
"theta3"
/> <hslider tick-position=
"above"
tick-interval=
"1"
minimum=
"-90"
maximum=
"185"
on-change=
"joint3_rotate"
/>
<label text=
"theta16"
/> <hslider tick-position=
"above"
tick-interval=
"1"
minimum=
"0"
maximum=
"15"
on-change=
"joint16_rotate"
/>
</tab>
</tabs>
</ui>
]]
ui=simUI.create(xml)
end