Control

forum for discussing Control interface software

Register or log in - lost password?

Control » General

Looks cool, but could use a couple other features

(8 posts) (2 voices)
  • Started 2 years ago by ggpipe
  • Latest reply from admin

Tags:

  • bridesmaid dress cocktail
  • bridesmaids
  • catwoman costume
  • celebrity dresses
  • christian loubutin
  • cocktail dresses australia
  • dress for party
  • halloween costume ideas for women
  • iPhone make controller r2d2 servo rotation
  • javascript
  • osc
  • party dress
  • replica milus agenios watch,corum replica watches,r
  • typetags
  1. ggpipe
    Member

    I have been working on building a 1:1 scale R2D2 replica and have being trying to control it with my iPhone/iPad. The the past I have used a combination of TouchOSC and mrmr. I like that TouchOSC is bidirectional and supports custom OSC messages which lets me use a stock make controller to link buttons and controls to physical devices like lights/servos/switches etc. The make controller uses the OSC protocol as well. For example to set the position of servo 0 to 512 you would send the following to the make controller board:

    /servo/0/position 512

    TouchOSC lets me send custom OSC messages so I can do this, but unfortunately, the make controller only accepts integers and TouchOSC sends floating point numbers so the direct link doesn't quite make it.

    Can I set the number type sent to be float or int on Control?

    Also mrmr has a couple widget types that are useful like the text sending widget that allows you to enter something on the on screen keyboard and have that sent as an OSC message. mrmr also has a webview widget which is great for the onboard IP camera that my R2 has so I can control it remotely with a first person view.

    Are you planning on adding other widget types like a webview or text widget?

    You can see my controlling some servos and the R2 dome with TouchOSC here:

    http://www.youtube.com/watch?v=EjnjleUClYc
    http://www.youtube.com/watch?v=YRFg1LoHFNQ
    http://www.youtube.com/watch?v=019luFhRo4I
    http://www.youtube.com/watch?v=fa6Dm14mhaI

    I am intrigued about the ability to use javascript with the Control interfaces.

    Thanks,

    Glenn

    Posted 2 years ago #
  2. admin
    Key Master

    Hi Glenn,

    Nice videos! How far along on the project are you now?

    You can definitely specify ints to be sent. Documentation for the 1.2 update is a little lacking at this point, but you can send arbitrary messages as follows:

    oscManager.sendOSC("/domeControl", "iii", 4,5,6)

    The second parameter contains the typetags for the OSC message. Specifying "iii" means the message will contain three integers, "isf" means the message would contain an integer, a float and a string.

    Text widgets will make it in eventually for sure. You could always roll your own in JavaScript. I don't know if this is clear, but the whole interface in Control is a webview... and you can add your own custom widgets to any interface file. Take a look at the Label class for a simple widget to get an idea of what is needed. It should be pretty simple if you have some JavaScript knowledge to create an iframe that displays a URL or a textbox.

    https://github.com/charlieroberts/Control/blob/master/www/js/Label.js

    Let me know if there are questions. I'll try to get improve the documentation of the 1.2 update shortly. This post gives some of the info:

    http://charlie-roberts.com/Control/forum/topic.php?id=29

    Posted 2 years ago #
  3. ggpipe
    Member

    The mechanical part of the R2 is probably 80% complete, but the electrical part has been on hold waiting on new software for the JEDI controller I use which is a series of PC boards made for R2s to control lights, sounds and motors.

    Also I have been looking for ways to get the OSC interface working with the JEDI controller and more extensive control. I think Control may do the trick.

    I am new to javascript, so I guess I have some learning to do, but I work with Java and XML at work. I'll try doing some testing with Control and see what I come up with

    BTW my R2D2 blog is at http://astromech.wordpress.com

    Thanks,

    Glenn

    Posted 2 years ago #
  4. ggpipe
    Member

    I tried creating a slider and then sending an OSC message with only an int of the value but I checked the results and I am getting extra OSC messages. I get the ones with floats whenever I move my finger on the slider and I get my integer messages when my finger first touches the slider. See below:

    Here is the slider segment of the interface:

    {
    "name": "servo",
    "type": "Slider",
    "x": 0,
    "y": 0,
    "width": 1,
    "height": .1,
    "startingValue": .5,
    "color": "#ffffff",
    "min": 0,
    "max": 1024,
    "isInverted": false,
    "isVertical": false,
    "ontouchstart": "PhoneGap.exec('OSCManager.send', '/servo/0/position', 'i', this.value);",
    },

    Here is the OSC output

    /servo/0/position 1010
    /servo 938.667
    /servo/0/position 938
    /servo 820

    How can I get rid of (suppress) the extra messages?

    Posted 2 years ago #
  5. admin
    Key Master

    By default the slider will send out floats without having to enter any OSC related javascript. To disable this, add "isLocal":true to your JSON. Like so:

    {
    "name": "servo",
    "type": "Slider",
    "x": 0,
    "y": 0,
    "width": 1,
    "height": .1,
    "startingValue": .5,
    "color": "#ffffff",
    "min": 0,
    "max": 1024,
    "isInverted": false,
    "isVertical": false,
    "isLocal": true,
    "ontouchstart": "oscManager.sendOSC('/servo/0/position', 'i', this.value);",
    },

    Let me know if this doesn't work. - Charlie

    Posted 2 years ago #
  6. ggpipe
    Member

    It worked. Thanks!

    Posted 2 years ago #
  7. ggpipe
    Member

    Sorry about all the questions, but I have another one.

    I want to OSC messages from the make controller to Control on an iPad. I don't have much control over the form of the messages to/from the make controller. The ones I am mostly interested in that are sent from the make controller to Control are these:

    /analogin/4/value 512

    Where 4 is the channel number and 512 is the value. If I can create a slider widget with the same name it should update the slider widget on the iPad screen when the message is sent, but when I try creating a slider widget named analogin/4/value, I can't get it to work. I tried escaping the slashes with backslashes but it didn't seem to make any difference. Is there a way to do this?

    I tried:

    "address": "/analogin/4/value",

    and

    "address": "/analogin\/4\/value",

    Posted 2 years ago #
  8. admin
    Key Master

    Hmmm... I'm not sure why doesn't work and I'm off to play a show so I won't be able to look into it tonight. As an alternative, you can register your own custom OSC handler that will deal with any messages. Assuming you want to update a slider named slider1 put the following code at the top of your interface file:

    oscManager.delegate = {
        processOSC : function(oscAddress, typetags, args) {
            switch(oscAddress) {
                 case "/analogin/4/value":
                      slider1.setValue(args[0]);
                      break;
            }
        }
    }
    Posted 2 years ago #

RSS feed for this topic

Control is proudly powered by bbPress.