Some advice required for getting a script running on a newer MRL build please!

Hi all, 

This used to work fine under the earlier builds. I can't get it to work in build 1723 which I'm told is worky.

I had LEDs connected to the right Arduino and the jaw servo to the left one.

Now I can only hear voice as it's running but the error says the jaw can't connect.

I uploaded the correct MRLComm (from the resources file) as per Mat's video to both Arduinos. The port numbers are correct. I manually opened two Arduino services. I tried opening a servo service for the jaw but MRL wouldn't let me attach it. The attach button wouldn't work though the pin and port number was correct.

 

Do I need to add file paths in MRL even if I've already uploaded MRL Comm in the IDEs? There is a window for the file path which was not there in earlier builds.

 

Any ideas would be appreciated. I confirmed there was power going to the jaw servo. Did I need to manually open a jaw servo service and the inmoov service? Which other services did I need to manually open and which open automatically from the script? 

 

Thanks in advance for any thoughts. I'm getting back into this after a break and have forgotten things. I am sure this script worked before. 

 

--------------

import random

import threading

import itertools

 

leftPort = "/dev/cu.usbmodem1411"

rightPort = "/dev/cu.usbmodem1421"

 

i01 = Runtime.createAndStart("i01", "InMoov")

right = Runtime.start("i01.right", "Arduino")

right.setBoard("mega2560")

right.connect(rightPort)

right.pinMode(22, Arduino.OUTPUT)

right.pinMode(24, Arduino.OUTPUT)

right.pinMode(26, Arduino.OUTPUT)

 

i01.startMouth()

mouth = i01.mouth

i01.startMouthControl(leftPort)

i01.head.jaw.setMinMax(0,170)

i01.mouthControl.setmouth(0,160)

i01.head.jaw.setRest(70)

 

right.publishState()

 

right.digitalWrite(22,1)

right.digitalWrite(24,1)

right.digitalWrite(26,1)

sleep(4)

 

i01.mouth.speak("Hello. My name is Ghost")

right.digitalWrite(22,1)

right.digitalWrite(24,0)

right.digitalWrite(26,1)

sleep(2)

i01.mouth.speak("My maker named me after the Deus Ex Machina. The Ghost in the machine.")

right.digitalWrite(22,1)

right.digitalWrite(24,0)

right.digitalWrite(26,1)

sleep(6)

 

 

[.....etc etc]


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
MdG_NL's picture

Hi Humanoid, In your code you

Hi Humanoid,

In your code you need to use other comands for the servo's !

Pin numbers 22, 24 and 26 are servo outputs and not digital outputs !

Here a simple Head script from Gaël:

https://github.com/MyRobotLab/pyrobotlab/blob/master/home/hairygael/InMoov3.minimalHead.py

Please check how he send some commands to the servo's.

I hope this helps :-)

 

BTW, did you solved your Arduino IDE problem ?

Regards,

Marten

Humanoid's picture

Arduino servo issue

Thanks, Marten.

The Arduino servo issue turned out to relate to the setting of the 'continuous rotation' servos using Arduino IDE.

I had been setting the 'rest' position of my servos using a separate Arduino with an Arduino script.  I had then been installing them in my robot then using MRL with a script.  They would then start spinning wildly, causing many tears and breakages.

This didn't happen with the elbow servo as it was not modified for continuous rotation.  Those ones worked as predicted once installed.

I didn't know that you can't set servos this way if they are modified for continuous rotation because they can't find the position they are set for when they are used through MRL afterwards. 

Once I figured that out it was plain-sailing. Ahoy!  Now I set my servos rest positions using MRL if they are continuous rotation ones.