This is a brilliant tutorial and I am excited at the prospect of getting this to work but maybe I am being dumb because I cannot get my servos to move.
Open CV tracking is working fine and I have connected my servos to the arduino as per the diagram. When I upload the sketch the servos twitch but resolutely fail to move when I move the sliders. The board is communicating and the servos are attached with the buttons. I am powering the arduino externally from a wall socket. I am using a 1N4001 diode in the circuit -could this be the problem?
Apologies for asking for help so soon. Any advice would be greatly appreciated.
Twitchy Servos are typically from evil under-powered sources....
I think its great you got past the uploading sketch, and it seems you have successful communication (from MRL -to-> Arduino)
If it was me, I'd start with an Arduino servo test under examples - just to be sure its all hardware & power problem.
It's been my experience that servos vary greatly on power consumption - and power consumption is not linearly proportional to size. I've had a few very small & cheap servos consume much more power than large well made servos.
Thanks so much. Servos are now working after a bit of tweaking. I'm afraid I'm being really dumb now because I cannot find the python script .txt file you used in the tutorial.
Great jobs. Alessandro i need your help. I am going exactly as u describe in this tutorial and i am going step bu step until i reach pyton part. When i try to execute tracking.txt to pyton editor appears the follow error :
and this is the pyton error :
File string, line 2, in moduleAttributeError : org.myrobotlab.service.Tracking object has no Attribute setRestPosition.
After i changed to Tracking.minimal.py GUI works. Servos reacts but they are very very slow not in real time as we see on alesssandro`s tutorial. I wana ask some one if my servos could be the problem? i am using small servos from 9g? If i use bigger servos can i get real time reaciton? pls any suggestion...
I run the code on the page, but it did not work ... This error appears : (error tracker tracking could not initialize properly) ...What should I do in order to function correctly ...please help me ..
4. install all the services (runtime->system->install all)
5. restart
6. start python -> runtime -> possible services -> python -> right click -> start -> name it - python
7. try the script again
I am following this tutorial to make an automated stage lighting luminaire follow an object.
I have a TinkerKit DMX sheild that will output a value from 0 - 255 on any DMX channel.
What I am trying to do, is substitue the X and Y servos for a DMX channel, so that the automated luminaire can recieve a value, and point the light at the tracking object. (The camera is also mounted to the luminaire).
All I need to do, is take the values for X and Y that are coming in to the arduino, and send them to an arduino DMX shield, it will include them in a DMX packet and send them to the luminaire.
Firstly, I need to understand how MRL sends the data to the arduino for the servos, does it do the calculations for where the servos need to be indexed within the MRL environment. Or does it send the arduino, X and Y values in relation to the tracking service along with the reoslution of the servos for the arduino to calaulate the servo index value?
Any thoughts and guidance on this would be appreciated. Mainly on how to fiddle with the X and Y data for the servos and send it off to the DMX shield.
The DMX shield has a library that allows you to set the channel value via the serial window.
IE, to set channel 1 to 255, you enter 001c255w
Essentially, I need to replace the value for 001c with the X value for the X servo, and then the Y value for 003c value.
Firstly, I need to understand how MRL sends the data to the arduino for the servos, does it do the calculations for where the servos need to be indexed within the MRL environment. Or does it send the arduino, X and Y values in relation to the tracking service along with the reoslution of the servos for the arduino to calaulate the servo index value?
the Tracking services gets the location of the point it is to track in the video stream. It then runs it through a PID calculation. The value calculated is sent directly to the servo. X differences are sent to the pan servo, Y differences are sent to the tilt servo.
Currently it does not publish the X or Y differences.
In MRL many events are published, and available to other systems or services which subscribe to them. Its how the majority of communication is done in MRL (myrobotlab)
...
Reading your comments a little further I see the "consumer" in this case is the same or another Arduino.
...
You could simply hack MRLComm.ino for your own purposes. If DMX is of interest to us.. we would prefer to "BORG" it in .. and absorb it, so that it becomes just another optional thingy to control.
Hey venturehpr, if you already have uploaded the arduino script in your arduino board using the arduino ide.. Then you need to start the python script...
Copy the script which is on the top and paste it in the python service tab..then it the execute button
Hello please if someone can tell me why my servo sg-90 when i want to track somthing they turn slowly and turn not exactly to the object sorry for my english
they started to response but now they are stopped again. :(
the RX led of arduino is blinking which means that arduino is responding to the command but no further action
i tried the tracking script several times but when i run it, xpid, ypid, opencv tabs don't open. Also, i can't seem to enter the values for Ki, Kp, etc. When i open the opencv tab, despite selecting the webcam there's a blank screen. i've already checked if the webcam is in working condition.
could you specify which version of myrobotlab was used for this?
Thank You
Thank you for making a tutorial for those of us slow to build.
Tracking Service probs
This is a brilliant tutorial and I am excited at the prospect of getting this to work but maybe I am being dumb because I cannot get my servos to move.
Open CV tracking is working fine and I have connected my servos to the arduino as per the diagram. When I upload the sketch the servos twitch but resolutely fail to move when I move the sliders. The board is communicating and the servos are attached with the buttons. I am powering the arduino externally from a wall socket. I am using a 1N4001 diode in the circuit -could this be the problem?
Apologies for asking for help so soon. Any advice would be greatly appreciated.
robrobot
Welcome roborobot !
Twitchy Servos are typically from evil under-powered sources....
I think its great you got past the uploading sketch, and it seems you have successful communication (from MRL -to-> Arduino)
If it was me, I'd start with an Arduino servo test under examples - just to be sure its all hardware & power problem.
It's been my experience that servos vary greatly on power consumption - and power consumption is not linearly proportional to size. I've had a few very small & cheap servos consume much more power than large well made servos.
Thanks for your help
I will try some different servos tomorrow. Cheers for now
nearly there
Thanks so much. Servos are now working after a bit of tweaking. I'm afraid I'm being really dumb now because I cannot find the python script .txt file you used in the tutorial.
Are the scripts listed above
Are the scripts listed above not working ?
Tracking.minimal.py tested
Tracking.minimal.py tested and worky for me... Version 1909
Pyton error
Great jobs. Alessandro i need your help. I am going exactly as u describe in this tutorial and i am going step bu step until i reach pyton part. When i try to execute tracking.txt to pyton editor appears the follow error :
and this is the pyton error :
File string, line 2, in moduleAttributeError : org.myrobotlab.service.Tracking object has no Attribute setRestPosition.
whats prblem with pyton pls.
this is the tracking code :
tracker = Runtime.createAndStart("tracker", "Tracking")
tracker.setRestPosition(90,90);
tracker.setSerialPort("COM3");
tracker.setXServoPin(3);
tracker.setYServoPin(11);
tracker.setCameraIndex(1);
tracker.initTracking();
tracker.initControl();
tracker.initInput();
tracker.trackLKPoint();
Hi googy.. I LL check as soon
Hi googy.. I LL check as soon as i can.. Probably tracking service has changed a little.. So we need to update the script
Try using tracking.minimal.py
Try using tracking.minimal.py script in this page , modifing the com port and pins if necessary
Try using tracking.minimal.py
Try using tracking.minimal.py script in this page , modifing the com port and pins if necessary
Works but problem persist !
After i changed to Tracking.minimal.py GUI works. Servos reacts but they are very very slow not in real time as we see on alesssandro`s tutorial. I wana ask some one if my servos could be the problem? i am using small servos from 9g? If i use bigger servos can i get real time reaciton? pls any suggestion...
Bigger servos are better..
Bigger servos are better.. But reaction can ne regulated increasing Kp values in the PIDs tabs...
Values should be 10 by default.. Try increasing with steps of 5
Ki should be at 0.. I would pur it @ 1.0
Bigger servos are better..
Bigger servos are better.. But reaction can ne regulated increasing Kp values in the PIDs tabs...
Values should be 10 by default.. Try increasing with steps of 5
Ki should be at 0.. I would pur it @ 1.0
please Alessandruino help me
I run the code on the page, but it did not work ... This error appears : (error tracker tracking could not initialize properly) ...What should I do in order to function correctly ...please help me ..
You using a very very old
You using a very very old version of MyRobotLab - use the latest..
Steps:
1. make a directory like c:\mrl
2. download myrobotlab.jar and put it in the directory (download from here https://github.com/MyRobotLab/myrobotlab/releases)
3. type the following in a dos shell
cd c:\mrl
java -jar myrobotlab.jar
4. install all the services (runtime->system->install all)
5. restart
6. start python -> runtime -> possible services -> python -> right click -> start -> name it - python
7. try the script again
I use N14002 diode instead of
I use N14002 diode instead of the 1N4007
'150 x limit out of range'
Hi there Alessandruino,
I am tyring to follow your very good tutorial and am having difficulties,
After I run the python script, when tracking in the video screen window I get an error:
"150 x limit out of range"
Is there a reason for this and how do you know how to fix it?
Many thanks
Ryan.
Using MRL & Arduino to output DMX
Hi,
I am following this tutorial to make an automated stage lighting luminaire follow an object.
I have a TinkerKit DMX sheild that will output a value from 0 - 255 on any DMX channel.
What I am trying to do, is substitue the X and Y servos for a DMX channel, so that the automated luminaire can recieve a value, and point the light at the tracking object. (The camera is also mounted to the luminaire).
All I need to do, is take the values for X and Y that are coming in to the arduino, and send them to an arduino DMX shield, it will include them in a DMX packet and send them to the luminaire.
Firstly, I need to understand how MRL sends the data to the arduino for the servos, does it do the calculations for where the servos need to be indexed within the MRL environment. Or does it send the arduino, X and Y values in relation to the tracking service along with the reoslution of the servos for the arduino to calaulate the servo index value?
Any thoughts and guidance on this would be appreciated. Mainly on how to fiddle with the X and Y data for the servos and send it off to the DMX shield.
The DMX shield has a library that allows you to set the channel value via the serial window.
IE, to set channel 1 to 255, you enter 001c255w
Essentially, I need to replace the value for 001c with the X value for the X servo, and then the Y value for 003c value.
Many thanks,
Ryan.
Hello rycarroll92 and welcome
Hello rycarroll92 and welcome !
Firstly, I need to understand how MRL sends the data to the arduino for the servos, does it do the calculations for where the servos need to be indexed within the MRL environment. Or does it send the arduino, X and Y values in relation to the tracking service along with the reoslution of the servos for the arduino to calaulate the servo index value?
the Tracking services gets the location of the point it is to track in the video stream. It then runs it through a PID calculation. The value calculated is sent directly to the servo. X differences are sent to the pan servo, Y differences are sent to the tilt servo.
Currently it does not publish the X or Y differences.
In MRL many events are published, and available to other systems or services which subscribe to them. Its how the majority of communication is done in MRL (myrobotlab)
...
Reading your comments a little further I see the "consumer" in this case is the same or another Arduino.
...
You could simply hack MRLComm.ino for your own purposes. If DMX is of interest to us.. we would prefer to "BORG" it in .. and absorb it, so that it becomes just another optional thingy to control.
Humble Regards,
GroG
problems
Hello Alessandruino,
At moment I'm testing your project, but some problems has happened. Could you help me?
when I select arduino, the pin and click in attach, not happened.
the follow status show up:
Could not attach servo to pin 3 serial por is null - not initialized ?
Hey venturehpr, if you
Hey venturehpr, if you already have uploaded the arduino script in your arduino board using the arduino ide.. Then you need to start the python script...
Copy the script which is on the top and paste it in the python service tab..then it the execute button
If you want instead to
If you want instead to manually attach a servo, you got to before connect to the arduino com port writing this code in the python tab :
arduino.connect("Com port name here")
servo sg90 turn slowly
Hello please if someone can tell me why my servo sg-90 when i want to track somthing they turn slowly and turn not exactly to the object sorry for my english
my servo motors are responding to the X and Y testing procedure
they started to response but now they are stopped again. :(
the RX led of arduino is blinking which means that arduino is responding to the command but no further action
tracking script not working