How to mod the Spark ap or robot controller for iphone

Hi i am making a Uav
i have tons of moters going to be running at 1v.5am i need to ajust the speeds at a steady rate no jerkiness.

so i need to add a slide bar to voltage setting that will slide and adjust and moter will correlate kind of like a potentiometer or a joystick on a controller

there is a feature under analog write that is similar but one key feature is missing it wont slide with finger seamlessly. it will transfer to new voltage automatically without hitting voltages in between.

with current settings one mistake could crash my uav

Using the Tinker app as a joystick might not be the ideal solution. The app just makes a POST request to a Spark.function() as soon as you release the slider. If you’re going to let it pick up on underlying values, you’d have to make an infinite amount of request. Apart from that making you a bad ‘net neighbor’, it’s also rather slow depending on how many requests you’re making per second.
This is just complete guessing: I think there are more appropriate protocols for this, which work more directly, and much faster, things like UDP/TCP come to mind. I guess the Elites can elaborate much more about this; @bko @kennethlimcp, maybe you guys can offer some better advice

Good luck!

1 Like

I’m really curious to hear what other users think. In an early version of something very closely related to Spark, we used a TCP socket and sent commands for each step - we just sent a few characters with the new level and a newline to delineate (plus making sure to flush the buffer). It wasn’t realtime to the milisecond, but it was pretty close.

Another thing that helped was using socket.io which will automatically restart sockets, fallback to supported protocols if the desired one doesn’t work, etc. - unfortunately I don’t think you can use that on a Spark (though maybe something server-side only that will automatically restart the socket?).

In any case, you’d probably still have to make sure that it did something sensible if the connection was lost - e.g., enter a mode that tries to keep it level. Even in good conditions, the connection can drop, or at least be laggy.

You can also check out things like http://jqueryui.com/slider/ (or other jquery sliders) for inspiration - you can copy the code and bind a “send_level” function to the “change” event. More info at http://api.jqueryui.com/slider/

Excited to see how it works out!

I think you are going to be much better off with a local TCP connection than with any cloud-based connection, Spark or otherwise.

I would look at using TCP or perhaps UDP but the recent TI patch seems to be brought some issues with it for UDP.

I think you want to make an app for real-time performance, but if you want a web page (which can be near real-time), then the Jquery slider is good, but so is the new HTML5 input “range” type which renders as a slider in modern browsers.


    <input type="range" name="mySlider" id="mySliderId" min="0" max="180" step="1" value="90" list="myData" onchange="setValue(this)">
    <!-- This adds the tick marks to the range but does not work in Safari -->
    <datalist id="myData">
       <option value="-90">
       <option value="-60">
       <option value="-30">
       <option value="0">
       <option value="+30">
       <option value="+60">
       <option value="+90">
    </datalist>

I haven’t looked into it extensively enough to find out if you could pilot a UAV with it, but Cylon.JS might be worthy of further research.

Totally, I would recommend Cylon.JS, or Spark-IO and Johnny Five for fast and easy local communications: https://github.com/rwaldron/spark-io You can use the VoodooSpark firmware ( https://github.com/voodootikigod/voodoospark ) which will understand commands from both of those toolkits. :smile:

Thanks,
David

1 Like

thank you all for reply’s im gonna be ordering a few more sparks and try all above suggestions (for various experiments and to learn (student at itt tech)
but i think i figured my best solution was a whole different way connecting via Bluetooth n ps4 controller
may or may not work pretty sure it will. ill post what different methods i try and what works best. in a month or so.

plus i figure ill be able to do more when support for off cloud comes out this summer

1 Like