Hello this is my first post, My name is Bart an I have a little problem. I designed articulating neck with 2 Y servos. But in i01.Head is only one Y servo for tracking. Is there possible to getY position from one OpenCV tracking? I write many of codes and I have always two OpenCV each one for each servo. Sorry for my english I hope that You undestand me. 3 Servo Y and 2 Servo X is for Eyes and Head Tracking.
How to create more that one tracking service from one OpenCV camera like is in i01.head.tracking and i01.eyes.tracking?
Here is one of my simple code but it doesn't work.
port = "COM3"xServoPin = 13yServoPin = 12xServoPin2 = 38yServoPin2 = 40tracker = Runtime.createAndStart("tracker", "Tracking")servo2X = Runtime.createAndStart("servo2x", "Servo")servo2X.setPin(xServoPin2)servoX = tracker.getX() #first X ServoservoX.setPin(xServoPin)servoX.setMinMax(30, 150)servoY = tracker.getY()servoY.setPin(yServoPin)servoY.setMservo2X = servoX.getPos() #second X servoservo2Y = servoY.getPos()servo2Y.setPin(yServoPin2)servo2Y.setMinMax(30, 150)opencv = tracker.getOpenCV()opencv.setCameraIndex(0)tracker.connect(port)tracker.startLKTracking()
Syncronizing servos
Hi bartcam
I made a small demo script on how to syncronize servos. In this demo, the left and the right eye moves in sync, but you can use the same method to syncronize any two ( or more ) servos.
In this demo the left eye is the master and the right eye is the slave.
You will need to change the script to fit your configuration. In your case I think it would be a good start to test the scripts with the left neck servo and the right neck servo.
https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Mats/SyncServ…
/Mats
listen to servo events
hi Mats
thanks of this example of a servo event listener. How would you do that if more than 1 servo should get observed - I do not see a direct connection of "def onServoEvent" with "addServoEventListener". In your example all servo publishers would trigger the onServoEvent?
Very thank You, after small
Very thank You, after small modyfications work great.
You are correct
Hi Juerg
I agree to what you write. So I added the onServoEvent method to the servo service. So now you can do it this way:
I also updated the example, since I think this is a better way to do it.
https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Mats/SyncServ…