Open sriranjanr opened 1 year ago
I have looked at the plugin source files. If I can set the UI slider numerically to a particular value then it should be a good point to start from. In the previous version of sketchy physics I was able to do this by
if(sname=="1")
$controlSliders[sname].value = MEMCLIENT.readval(1)
end
Is there such a provision in the MSphysics plugin source files..Please let me know.
After further digging I came across this function
set_slider_value(name, value)
How and where do I use this function in the ruby plugin files to set the range slider value? Because when I used it I got a reference error : sliders
I saw the definition of set_slider_value
I added a @ before sliders here below and the error disappeared but the slider value did not get updated!
cmd = "@sliders[\"#{cname}\"].setValue(#{value.to_f}); update_slider(\"#{cname}\");"
The function definition is below from the MSphysics source file..
def set_slider_value(name, value)
return false if @dialog.nil? || !@init_called
cname = name.to_s.gsub(/[\\\"\'\v\n\t\r\f]/, '')
data = @sliders[cname]
return false if data.nil? || @dialog.get_element_value("lcrs-" + cname).empty?
# below @ has been added
#cmd = "sliders[\"#{cname}\"].setValue(#{value.to_f}); #update_slider(\"#{cname}\");"
cmd = "@sliders[\"#{cname}\"].setValue(#{value.to_f}); update_slider(\"#{cname}\");"
execute_js(cmd)
true
Hello,
I want to control the servo joints as per angle values from a C or C++ program. How do I do this in MS physics? Please let me know. If there are any example programs which do this, then please let me know. Thanks in advance...