Ubuntu and Arduino

I am starting a new thread here that takes over from a previous thread that nolonger matches it's title.

I had lot's of trouble getting my Arduino to work on Win7-64 so I have installed it under Ubuntu 12.0.4 and I am still having trouble. The old thread is here:

http://myrobotlab.org/content/first-time-arduino-softreset

Basically I can program the Arduindo OK, but MRL cannont communicate with it - has anyone else got this working?

rekabuk's picture

Need to fix this :(

Can I enter the Hex bytes to send in the arduino.serial window and press "send" to send the equivalent of "getVersion"?

If so, could someone tell me what those bytes are please, or point me at an interface spec? Then I can look on the scope, see what is being sent by MRL/Ubuntu and what is returned, so that I can fix this issue.

Andrew

GroG's picture

Sorry your having so much

Sorry your having so much trouble rekabuk.
I think you are doing all the right things...   this one is really tough for me, because it seems like you are following everything logically, but the computer & the Arduino are not talking to one another ...

Grrrr !

Now you brought the oscope out !   Nice :)

yes ...  MAGIC_NUMBER is at the beginning of every message both Computer --to--> Arduino and
Arduino --to--> Computer.

The communication should be 57600 8 data bits 1 stop bit no parity bits..
All messages start with MAGIC_NUMBER = 170

Message format is as follows :

MAGIC_NUMBER|NUM_BYTES|FUNCTION|DATA0|DATA1|....|DATA(N)
              NUM_BYTES - is the number of bytes after NUM_BYTES to the end
 
 
the first thing which comes to mind is the MRLComm is out of sync with the Arduino service.
You used the one which came with myrobotlab.jar right ?  The one in the editor ?
 
GroG's picture

I'll try to get a similar

I'll try to get a similar platform and follow along with you - then we can compare results...

Work as a team o/

rekabuk's picture

Thanks

Hi GroG

Yes I coped thecode from the MRL Arduino Serial window into a blank document in the Arduino IDE. I then compiled it and successfully uploaded it.

My bet is there is something wrong with the tty configuration on my box and the tty driver is echoing the command or something silly like that.

How can I send specific bytes in HEX format? Can I do it by putting "AA 01 34 BD FG" in the send window? After a send, I get lot's of hex bytes echo'd back in that box?

I won't be able to play over the weekend and I am away Monday/Tuesday, but I will keep an eye on the emails.

Thanks for your paitience.

Andrew

rekabuk's picture

Multiple bytes

If I put "AA 01" in the send box and hit "send", a lot more than two bytes are sent!

rekabuk's picture

Ah - It is sending the "AA

Ah - It is sending the "AA 01" as chars i.e. "41 41 20 30 31 0a 0a" !

How do I send HEX?

rekabuk's picture

Thinking about it... As my

Thinking about it...
As my Arduino is an object within MRL, can I use the cli to call a method or something to get MRL to send a get version at my command?
Andrew

GroG's picture

yes - you can acess all

yes - you can acess all methods through the cli

This would include all Serial & Arduino methods....

/arduino/getVersion
 

would invoke the getVersion call...

Unfortunately, I'm in the middle of major changes which I'll be done with shortly, but as I promised I'll try to get the same version as you on another Ubuntu 64 system...

GroG's picture

Hi rekabuk, I've gone through

Hi rekabuk,

I've gone through the latest build on an Ubuntu 64 laptop

Starting with downloading the latest jar

When working on the command line I was "root" the whole time, because I don't like messing around with permissions of devices. 

So ... started mrl up, installed all services

After the installation of all services I restarted mrl.

Then started an Arduino

I copied the MRLComm from inside the arduino tab in MRL to Arduino IDE so I could compile and upload the correct version.  It compiled and uploaded correctly.

Then I connected the Serial to /dev/ttyACM0 - it did a getVersion method and I got 27 back which is what it expected.

I then started a servo and attached it to the arduino .. and verified I had control over it..

It all worked..  On reviewing the issues you are having I think possibly the MRLComm loaded on your board does not match the mrl your running.  The one from the arduino tab is the one to use - it needs to be loaded only once .. but once per version.  Good Luck !

rekabuk's picture

Hi GroG, Thanks for trying

Hi GroG,

Thanks for trying that for me, here are the versions installed on my machine:

Java 1.7.0.91

MRL 1.0.1012

Arduino IDE 1.6.7

MRLComm  - "Version Unknown"

When you compiled the sketch in Arduino IDE did you get any warnings? I'm guessing this must be where my problem is?

rekabuk's picture

MRLCOmm

I thought you had to add this library to Arduino IDE - turns out you don't have to?

When I click the CLI tab, I have no CLI???? :(

GroG's picture

MRLComm sketch needs to be

MRLComm sketch needs to be uploaded into the Arduino for control.

It needs to be loaded whenever you change myrobotlab.jar versions.

The one in the "arduino" tab matches versions for the myrobotlab.jar that is currently running.

kwatters made a nice tutorial video 

Cli interface is created - through the command line if you started myrobotlab from the command line with

java -jar myrobotlab.jar

or through the web gui

there currently is no interface through the swing gui.

rekabuk's picture

I hear you GroG...

When I run MRL, I can see in the "runtime" tab that the CLI task is running.

When I click on the CLI tab I was expecting w window where I could enter commends but all I get is a blank white tab - should I be able to enter commands in this CLI tab - like do a getVersion on my Arduino instance?

I completely understand about only reloading the Arduino when MRL versions change :-)

 

rekabuk's picture

Compiling/Uploading

rekabuk's picture

Latest Version

Where can I get the latest version?

The download page point at 119, I'm using 1012 and you used 1056. You sent me a link before and that shows 1065, but didn't seem to give me any content in the tabs (and two python tabs??)?

At startup I see this error wizz past:

21:13:56.086 [main] ERROR c.myrobotlab.framework.Service - python error NullPointerException - null java.lang.NullPointerException
 

Andrew

GroG's picture

the "latest build" link is

the "latest build" link is above the shoutbox (top left)

It points here http://mrl-bucket-01.s3.amazonaws.com/current/develop/myrobotlab.jar

GroG's picture

Yeah ... as I mentioned that

Yeah ... as I mentioned that 'would have' been the plan to use the cli through the swing gui ...
This is the current state:

MRL has 4 interfaces you can do stuff with - 

Swing GUI - that's the one your using .. its the oldest.. we don't have a lot of plans to keep is going, new functionality will definately not be here...  - and Ya the CLI tab doesnt alow you to type in it.

WebGui - this is were we are going .. new functionality and new services will have their interfaces implemented through this gui - its also possible to to interface through the webgui's Cli interface 

REST interface - The WebGui has the ability for you to call any method on any service with the following notation : 

http://localhost:8888/api/services/{service name}/{method}/{param 0}/{param 1}/...

so for your Arduino, if you named it 'arduino' - you can do this

http://localhost:8888/api/services/arduino/getVersion

To list methods you can use you can do this 

http://localhost:8888/api/services/arduino/ 

for the current 'state' of the service you can do this

http://localhost:8888/api/services/arduino

I think 

http://localhost:8888/api/services

gives you a list of current services 

then comes the Cli

which I said you can type directly into the terminal shell you started with:
much of the Cli is identical to the REST api

e.g.

/arduino/getVersion

will call the service named arduino's getVersion method

rekabuk's picture

Web Interface

I like the idea of that :0)

Sadly on my mahine it returns "Unable to connect", according to netstat (and I'm no expert), no one is listening on 8888.

Andrew

 

Mats's picture

Warnings when compiling the sketch

Hi

From you screenshots I see lots of warnings when you compile the sketch. I don't remember seeing them when I compiled the sketch. Almost like if it's trying to compile the same code twice. Retry the compile and upload it to the Arduino again. If you get warnings or errors, then upload the logfile from the compile. 

Also make sure that the board you have matches the board that you select when compile the sketch.

/Mats

 

rekabuk's picture

GroG got the same

I kind of agree you Mats, but if you look back at GroG's screenshots you will see in the background that he got the same warnings.

Thanks for the help though - I am getting a little frustrated now, I have InMoov's Head, Neck and Torso printed, but still cannot control it :(

Andrew

Mats's picture

Compiling with Arduino IDE 1.6.7.

I tried compiling a´with the same verion of Arduino IDE and I didn't get any warnings at first. But then I turned warnings on and I get the same warnings as you. It's not a problem. I can commnicate with the Arduino.

 

To start the new WebGui you go the runtime tab in MyRobotlab. Find WebGui in the list. Right-click on it and select start. Type WebGui in the dialog box that comes up and press . Your browser should start shortly after.

rekabuk's picture

Progress!!!!!

I like the WebGUI - might be better with my other glasses :-)

Sorry GroG I thought you meant WbGUI had replaced CLI - didn't realise you had to start it.

Using the WebGui my Arduino now replies!

But it reports Version 27 and 25 was expected. This is because yesterday I went back a few versions of MRL.

When I try to move forward to the latest nothing works :-(

I did a freesh install in a new directory, but can't get up the menu to install any services!!!

At least I know my Arduino is working. I need to go in now an spend time with the family, but I might try again later.

Regards

Andrew

Mats's picture

Commandline install

You can install the services from the commandline this way

Change directory to where you have the myrobotlab.jar

cd <mrl directory>

then exceute this command

java -jar myrobotlab.jar -install 

Mats's picture

WebGui services

Hi

If you want only a single service in it's own tab in the browser, you can use this type of URL

http://localhost:8888/#/service/<servicename> 

The windows in the WebGui can also be moved around. I'm a bit color blind, so sometimes it's difficult to see the borders of the windows.

 

rekabuk's picture

Goodtimes...

This is really frustrting... Since running the GUI and re-installing for the nth time, I can contrl the servo, but I can't see what I have changed! I haven't updated the Arduino code for over a week now, so it must be something on the machine itself!

I can control the servo through the standard MRL gui. Having used the WbGui a little I find I cannot close sub-windows and everything sits on top of everything else.

Time now to try and run some InMoov script, thanks to everyone for there help.

 

rekabuk's picture

Install running....

Thanks :)