So I want to start using python scripts to get multiple servos or groups of servos to act together. At this point I have some questions as to how to go about that. I have run "myrobotlab" by clicking on the icon and by starting it from a command line. I am NOT a command line kind of guy. I only resort to it when absolutely necessary, or when someone gives me those directions and I have not yet discovered that clicking on the .exe icon does the same thing.  By the way if I seem a bit dense here I have a pile of good excuses for needing things spelled out in detail but those are for some other post.

  In a quick start or getting started post somewhere I read that one of the first things to do is to set the usb port speed to 115200 (dunno if tyhat is bits or baud). That is 12 times the normal speed o the ports and I have no problem with that. The problem arrises every time I power up the usb hub. The port numbers change. I check to see which ports are available by either opening the device manager, or more quickly and accurately starting the Arduino IDE and under the tools header click on ports. and the numbers keep changing.

  Is there any way to keep them from changing? it is getting annoying to have to then go to the device manager and open them up change the data rate close the device manager ..... Then I have to go through the process of determining which port is which by starting the Arduino service and the servo service select a port and move a finger or other joint in order to determine which is which. I coiuld of course leaave the Robot powered up all the time with the motor bus powered down, but I don't think that is a good idea.

 Is there some settings file somewhere that can be used to keep say ports 3 and 4 permanently assigned to the left and right Arduino boards and permanently set the data rate 115200? If so that would be really nice to know.

  Next question. In order to run the python service and the "InMoov hand" script. Is it necessary to start the Arduino service first. If so I should have to run it twiice How is that done? If not 

 

kwatters

6 years 8 months ago

Ahoy MikeG,  glad to see the questions posted.  Let's see if we can help answer some of them.

 

1. using the command line is good, fear it not.  When you launch MyRobotLab from the command line, you'll also see the prompt for the Agent, and some of the log messages.  This can be very useful when trying to understand what's going on.  Using the command line is my "go-to" for doing pretty much anything.

2. MyRobotlab is actually a ".jar" file, not a ".exe".  The Jar file is associated with the java.exe program to launch.  Double clicking on the myrobotlab.jar file will launch it using java.exe.  Using the START_INMOOV.bat file actually runs "java -jar myrobotlab.jar" for you.  (and a bunch of other minor things to tweak the environment.

3. The MrlComm.ino sketch is set (and generally hard-coded) to run at 115200 baud.  (roughly equivilant to bits/second, excluding the partity and stop bits.)  This is normal, USB ports actaully can support much higher transfer rates, but we've chosen 115200 as our starting place as it seems like the Arduino can keep up with it.  It's important to note, that you don't explicitly need to set the baud rate for the port, when MRL connects to the arduino it does this for you.

4. Yes, the port numbers do jump around a bit, this is an issue with the operating system because when you plug in the hardware it needs to hand out an open COM port.  Often the same board will come up with the same port, but as you've noted, this is not always the case.  Unfortunately, I have no fix or suggestion for this, only that on windows the "device manager" is your friend ...

5. I'm faiirly certain the inmoov hand script will start the arduino and connect it for you so long as you specify the com port in the script correctly.  (I'm not exactly sure which script you're using, so this is a bit of speculation.)  Of most importance is that the MrlComm.ino sketch is loaded on the Arduino before you attempt to run the script.  Otherwise the arduino will have no brain and will just sit there and you'll end up with a whole log of error connecting and ack not received messages.

6 (and lastly) It's very important to make sure your servo motors are powered with an external power supply.  A USB port typically does not provide enough Amps to power the arduino and a servo.  You might get away with powering 1 small MG966r servo, but when you start moving it a lot, the current draw will increase and this will cause the arduino to reset.  Many issues that have come up here are related to not properly wiring the servos to an external power supply.

 

Hope this helps!  I look forward to more questions and to see progress!  

 

 

 

 

 

GroG

6 years 8 months ago

This does nothing .... except "temporarily" set the parameters ..
MRL actually sets the port to 115200 automatically - if your doing this through device manager its not needed.

At this point almost "everything" has the ability to set the rate and the details of the com port
the device manager is just another "thing" that can do it - but its meaningless, because the "real" thing of interest - like MRL controlling an Arduino has its own ability to change the port to what it needs.
 
In regards to keeping the same "com" port - this is entirely under the control of the operating system & the device drive (meaning mrl cannot set this)
 
There is a way in Linux to uniquely and consistently name a com port - its done with "udev" rules - in windows its not so consistent - you can look more into the details here -> https://stackoverflow.com/questions/13741853/how-to-get-stable-com-port…
 
It becomes even more of a gamble when there is a usb hub ..