Subvertion

So when you checkout the myrobotlab collection,

-is there any way that I can damage myrobotlab collection?

-am I editing the live collection?

-if I am successfull in creating a new service/module etc, how to share it to the community?

-be gentle, new at this...

 

GroG's picture

Feel free to tear it up

Feel free to tear it up !

Nothing you can do can damage MRL.  In fact you can't "check-in" until I give you access too.  So dont worry about that. 

When your ready to share your new service to the world, I'll help you "check it in" by giving rights to do so.  We will code-review it together...  very excited for your contributions..

Glad you've made it so far !

Thanks !

 

Schlick's picture

A Klingon Plea:  jIH ghaj

A Klingon Plea: 

jIH ghaj ghobe' chay' Daq ta' vam Daq QaH maH (explitives wouldn't convert)

Any Chance you've got time to do an idiots guide to service creation?

I feel like I'm sitting in the cockpit of a jet plane with all the buttons, switches, throttles....

and no idea how to get it in the air....

 

 

GroG's picture

 HIja' loDnI' tlhIngan jIH

 HIja' loDnI' tlhIngan jIH DIchDaq QaH

I would be glad to help brother Klingon design the next Tatical Battle Service.  
So, lets start with step 1.

Design it.

A MRL Service is a thingy which provides a simple API for functionality, processing, and / or data.

Given the above sentence, what will your service do?  I'm excited that you are going to make a service, even more so if you can share it with Romulans, Vulcans (and dare I say it) the Federation.  I don't know what you have in mind, but if you can make it useful for others it would be  [super] Dun.

What inputs will it have ?

What will it do ?

What outputs will it have ?

How will it be used ?

How will others use it ?

What should it be called ?

Lets begin with design before tackling some of the technicall challenges.

Schlick's picture

OK, I think it would be

OK, I think it would be cool

1) to be able to show a gui with a combobox of active sensors operating with MRL. (List active I/O assignments like analog in pins, digital pin states, etc...)

2) Create a remote connection to a port I decide for output on localhost.

3) Provide selected data routed to this port.

Big surprise, above is my focus for the Thingspeak project. 

But since I feel like I have not even any crayons to draw with, 

I would be happy with an example showing, how to align the _template

to show the gui app, provide simple example to draw the combobox and some example of 

how to connect to anything in MRL....

I was able to Checkout the collection, and somehow once get mrl to launch, but only once.

I can see the services available and they seem mostly comprehendable, but to start from nothing seems impossible.  Is there a code wizard or something available....

blah, blah, blah, I think the more I type the less I say....

-very interested, sorry for the burden....

 

GroG's picture

1) - have you used the Oscope

1) - have you used the Oscope in the Arduino service yet?  The scope can trace multiple IO pins analog and digital - The pin panel in addition to the oscope shows pin state. The pins can be configured to do continuous updates - or if preferrable they can show only state changes - keeping chatter on the serial line to a minimum.  It can even debounce your lines if you so desire. (more selections on the editor-> tool menu)

2) - MRL has the capabiity of sharing resources in a peer network.  (ie a MRL can connect to another MRL - over TCP or UDP.  It also has a web server. The key to connectivity is the RemoteAdapter. Starting this service allows connectivity from other MRL(s). It could be configured to allow connectivity only on localhost if so desired.

3 - Thingspeak is a service I "started" - really just copied from the Template - if you look in your check-out'd source you'll find its lack of implementation.  I would be excited in finishing it - if you are interested in working together..

"I was able to Checkout the collection, and somehow once get mrl to launch, but only once."

Through eclipse ?  I'm impressed.. Your Code-Fu is strong...

Uh code wizard ? I though you were :)

Given the the information you have given me my suggestion would be we work together to finish the ThingSpeak service.  I signed up for an account and just recently (on prompt from your post) signed into it - appears to still work..

So if this seems like it would be of interest to you then lets go for it.  You'll need to post your setup - e.g. details of sensors you have and what you want posted, (pictures always appreciated) And we'll work on implementing your vision..

 wabmey QaQ?

 

Schlick's picture

 it does 'sounds

 it does 'sounds good'...

going out to convert some wood to ash tonight so we'll get going next year!

Thanks for your cooperation/assistance/knowledge/funding....

just kidding...  

the eclipse environment is a new machine to me.  I just need some pushing in the right direction to get cozy

with it.  

The code is so deep it seems how could anyone know where to interject anything?

ceeya in the eclipse!

 

 

GroG's picture

Great ! Step 1. Make a new

Great !

Step 1.

Make a new post - describe  your current sensors, micro-controllers & experience or links to ThingSpeak API

Step 2 - we'll start adding code to ThingSpeak.java

GroG's picture

This looks like the main API

This looks like the main API - http://community.thingspeak.com/documentation/api/

Looking through it quickly - it seems pretty straight-forward - simple HTTP GET requests to do updates to a channel which is already defined.

This - http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/  looks like a straight Arduino -> ThingSpeak if you have ethernet shield, but we won't need one since the computer is connected via USB & is running MRL.

Seems like they have other functionality too since I last visited them - TweetSpeak and other apps.. probably worth investigating at some point - but will go with basic functionality first 

Created a new public channel on ThingSpeak - 

https://www.thingspeak.com/channels/4050

Now I'll do some experiments to get data in - then we can figure out how we want data from the Arduino to post ...

Are you with me ?  Are we flying yet ?

GroG's picture

I created a  faux Arduino pin

I created a  faux Arduino pin post URL - > http://api.thingspeak.com/update?key=AO4DMKQZY4RLWNNU&field1=pin&field2=A3&field3=value&field2=505

It returned with a "1"  - so I think that is good - don't see the data in the chart though...

Now I'll try to figure how to display it in their chart..

Some observations :

I "think" field1 field2 etc is thingspeaks requirement .. which is a little constrained in that the user doesnt get to choose the field names.. but whatever.. we can work with it..

Schlick's picture

Ok, I'm with ya,I posted

Ok, I'm with ya,

I posted some faux data as well.

http://api.thingspeak.com/update?key=O6KHZJEL4LXJZQKQ&field1=890

representing an analog voltage on pin5 relating to crude temp sensor@Should be viewable at @ https://www.thingspeak.com/channels/4044

engines are ready, request clearance for takeoff....

edit> didn't see your last until after post, so lemme digest that....

GroG's picture

The update method worked ! -

The update method worked ! - it posted a 5 on field 1 (display name "type")

It puts it in field 1 - not sure about the best strategy at the moment on how to take generalized data and send it to ThingSpeak..

Was curious about how to customize the charts - I "think" they expect you to create "plugins" - https://www.thingspeak.com/plugins ....   hmmm 

So at the moment a default chart gives you 1 line of data ... hmm wonder how many fields you can use..

In my simple mind's eye.. I think it would be "nice" if it displayed the oscope data - e.g. multiple colors for different traces etc...

 

GroG's picture

More info : I've done some

More info :

I've done some testing with URLs and can see the results on the test channel - https://www.thingspeak.com/channels/4050

I found out the API only allows updates every 15 seconds - so, thinking about the Strategic Klingon Battle Computer - um.. we don't want something hanging for 15 seconds until it can do an update.  

There is a return code - which is the numerical amount of data you've put in which comes back on an update.  This comes back as 0 when you update it too quickly..

We want to generalize the data going through our ThinkSpeak Service, so service besides Arduino can use it.

I've started the following method in ThingSpeak.java  Service

 

public Integer update(Object[] data) {
String result = "0";
try {
for (int i = 0; i < data.length; ++i)
{
Object o = data[i];
String url = String.format("%s?key=%s&field1=%s", updateURL, writeKey, o.toString());
HTTPRequest request = new HTTPRequest(url);
result = request.getString();
log.info(String.format("ThingSpeak returned %s",result));
}
} catch (IOException e) {
Service.logException(e);
}
 
return Integer.parseInt(result);
}
 
It takes an input paramters of the most general possible - and Object array - which can contain any amount of anything...  It iterates through the stuff that was passed in - changes it to strings - and posts them to ThingSpeak....

 

GroG's picture

Cute they give you iframe

Cute they give you iframe code - so you can quickly embbed the chart in a different web page.. gonna have to hook up and Arduino and get the thing posting...

Schlick's picture

cool, so I have 'refreshed'

cool, 

so I have 'refreshed' myrobotlab in eclipse, but see none of your changes, is it refactor that needs to be done?

edit > Replace with latest....

 

GroG's picture

I have to "check-in" Then you

I have to "check-in"

Then you right click on myrobotlab project -> Team -> update to head

 

I haven't checked in yet... still working on a few details ..

Schlick's picture

I have to admit,  I follow

I have to admit, 

I follow what you wrote, but its like my spanish, I can hear more than I can speak.

... I think I'm falling out of the plane

GroG's picture

Immersion is the only way to

Immersion is the only way to learn machinespeak...

Schlick's picture

I refreshed your thingspeak

I refreshed your thingspeak page, all kinds of activity!

nice work!

edit>

I think I will wait a bit, looks like you have checked in, but I'm not sure how this will be realized.

I'm gonna wait a bit, prob paint the bathroom, then download latest and look at the results.....

 

GroG's picture

WoooHoo Arduino -> MRL ->

WoooHoo Arduino -> MRL -> ThingSpeak Service -> ThingSpeak - not a single line of code :)

 

Step 1 - Load an Arduino & and ThingSpeak Service.

 

Step 2. - I hate this part (programming gaphically) - could be done in Python more cleanly.. but you can program message routes via the gui tab -
press the out of the Arduino - select pinPublish -> Pin  then the input of the ThingSpeak service update (Pin)

 

Turn on tracing - 

 

Step 3 - switch to the Arduino oscope page select a line trace it...

 

So now all data coming from the Arduino goes to the Thingspeak .. GAH - the some issues

1. It's my account DOH

2. Its too much data - hopefully they wont get mad - I think there probably used to this kind of abuse...
3. Theres no GUI fields for taking in specific info the read & write keys

 

 

 

 

 

GroG's picture

We're Flying Now

The ThingSpeak Service - http://myrobotlab.org/service/ThingSpeak

You can copy paste the Python example in the Python tab - You'll need to tweak a few values.. e.g. depending on your Arduino type, serial connection, and ThingSpeak write key...

But it should work for you out of the box....

I've checked in the code - there could be a lot of stuff added, gui additions and other thing about ThingSpeak I don't even understand yet...

Make sure you seat belt is buckled..

Schlick's picture

Heading back to work today

Heading back to work today (boo),

just had a peek, very cool.

I think I undervalued the ability of python to be able to set up some of what is capable.

It makes more sense, but I need to study it some....

very cool, its advertising for MRL too!  

GroG's picture

Python - superglue

FYI - The Python IDE has the capability of manipulating or interacting with any / all MRL Services (and more)