Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble Homing/Calibrating #24

Open
tloanPhytec opened this issue Dec 3, 2019 · 4 comments
Open

Trouble Homing/Calibrating #24

tloanPhytec opened this issue Dec 3, 2019 · 4 comments

Comments

@tloanPhytec
Copy link

Greetings,

I often experience trouble homing/calibrating joints J3 and J4 using the Python API v1.4.2. Please follow my steps below and let me know if I am misunderstanding the homing process.

>>> from dorna import Dorna
>>> r = Dorna(r"C:\Users\tloan\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\dorna-1.4.2-py3.7.egg\dorna\config.yaml")
>>> r.connect()
Progressing...
    100%  |████████████████████████████████|      7/7 commands
'{"id": "0084-084a-18c6-39c", "connection": 2, "port": "COM16", "fv": 1.21, "config": "C:\\\\Users\\\\True Loan\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python37-32\\\\Lib\\\\site-packages\\\\dorna-1.4.2-py3.7.egg\\\\dorna\\\\config.yaml", "state": 0, "version": "1.4.2"}'
>>> r.home("j0")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j1")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j2")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j3")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.play({"command":"move","prm":{"path":"joint","movement":0,"joint":[0,0,0,0,0]}})
'[{"id": 98, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 0, "joint": [0, 0, 0, 0, 0]}}]'
>>> #pic0 - we can see that j4 is not calibrated (the other joints look ok), the arrow should be pointing down

pic0

>>> r.play({"command":"move","prm":{"path":"joint","movement":1,"j4":90}})
'[{"id": 100, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 1, "j4": 90}}]'
>>> r.play({"command":"move","prm":{"path":"joint","movement":1,"j4":30}})
'[{"id": 102, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 1, "j4": 30}}]'
>>> r.play({"command":"move","prm":{"path":"joint","movement":1,"j4":10}})
'[{"id": 104, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 1, "j4": 10}}]'
>>> r.play({"command":"move","prm":{"path":"joint","movement":1,"j4":10}})
'[{"id": 106, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 1, "j4": 10}}]'
>>> #pic1 - the arrow is now pointing down and I will calibrate this to be 0 degrees for J4

pic1

>>> r.calibrate([0,0,0,0,0])
'[0, 0, 0, 0.0, 0.0]'
>>> r.save_config(r"C:\Users\True Loan\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\dorna-1.4.2-py3.7.egg\dorna\config.yaml")
'{"id": "0084-084a-18c6-39c", "connection": 2, "port": "COM16", "fv": 1.21, "config": "C:\\\\Users\\\\True Loan\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python37-32\\\\Lib\\\\site-packages\\\\dorna-1.4.2-py3.7.egg\\\\dorna\\\\config.yaml", "state": 0, "version": "1.4.2"}'
>>> r.terminate()
>>> #pic2 - I powered off the arm, moved it back to the rest position, rotated J4 so it's not at 0 degrees, and then powered the arm back on

pic2

>>> r = Dorna(r"C:\Users\True Loan\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\dorna-1.4.2-py3.7.egg\dorna\config.yaml")
>>> r.connect()
Progressing...
    100%  |████████████████████████████████|      7/7 commands
'{"id": "0084-084a-18c6-39c", "connection": 2, "port": "COM16", "fv": 1.21, "config": "C:\\\\Users\\\\True Loan\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python37-32\\\\Lib\\\\site-packages\\\\dorna-1.4.2-py3.7.egg\\\\dorna\\\\config.yaml", "state": 0, "version": "1.4.2"}'
>>> r.home("j0")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j1")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j2")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.home("j3")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
>>> r.play({"command":"move","prm":{"path":"joint","movement":0,"joint":[0,0,0,0,0]}})
'[{"id": 98, "state": 0, "error": null, "message": null, "command": "move", "fulfill": true, "key": null, "prm": {"path": "joint", "movement": 0, "joint": [0, 0, 0, 0, 0]}}]'
>>> r.position()
'[0, 0, 0, 0.0, 0.0]'
>>> #pic3 - we can see that J4 is not at 0 degrees. It seems like calibrating doesn't work for J4

pic3

@bensnell
Copy link

bensnell commented Dec 6, 2019

I've run into similar problems, for both joints 3 and 4. The homing offsets change depending on the orientation of the joints at the start of the homing procedure.

Joints 3 and 4 are homed by probing for the position of magnets embedded in the gears. In practice, this makes homing unrepeatable under arbitrary conditions since the position of magnets is not unique for each pair of (j3, j4) orientations. For example, on my robot, for both poses [ "j3" : -90, "j4" : 90 ] and [ "j3" : 90, "j4" : -90 ], the magnets are at the same location. Since the robot only "sees" these magnets, there is no observable difference between these two poses for the robot. As a result, the homing result will be different for each.

One solution, which I have implemented here, requires the user to:

  1. Observationally estimate a new parameter called the probe_offset and define this in the config.yaml file under a new heading homing like so:
homing:
 probe_offset: 30.0

This parameter need not be exact. It is intended to define the rough offset of the magnets for a specific robot. Each robot (presumably) has its magnets installed in a different location, so this parameter will vary from robot to robot. If you manually rotate j4 until the magnets lie across from each other, then rotate j3 until both red lights are on, the offset of j3 from the axis of the last "arm" (j2 --> j3) in the positive direction will be this probe_offset. For my robot, it is about 30º. As long as I never disassemble my robot, this value should never change. See the images below for reference. Notice how the magnets are across from each other and both red lights are active.

IMG_7899
IMG_7900

  1. When performing the homing procedure, always place joints 3 and 4 within these limits:
  • Joint 3 should be placed in the range [-90º, 90º) from the axis through the last arm (j2 --> j3). In other words, joint 3 should be pointing "outwards", within 90º of the axis indicated by the pink dotted line in the photo above. If it is positioned more than 90º beyond this axis, then j3=0º will be in the opposite direction. Obviously, this is problematic when using the robot with long tools (like the one above), since the tool will run into the robot when returning to j3=0º.

  • Joint 4 should be placed in the range [-180º, 180º). Since there is no obvious reference axis for this joint and since this range encompasses all possible orientations, placement of this joint should not be critical. However, if over the course of operating the robot joint 4 goes outside of this range (<-180º or >= 180º), then when it is re-calibrated, the angle will be wrapped back into this range. For example, -200º will be wrapped to 160º after homing (see below for example).

robot.position()
# prints '[0, 110, -90, 0, -200]'
robot.home(["j3"])
# prints '{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'
robot.position()
# prints '[0, 110, -90, 0, 160]'

An additional issue with calibration that I have yet to address occurs when joints 3 and 4 fail to home. This happens when one or both of these joints' magnets has activated the red lights before beginning the homing procedure. One fix would be to temporarily offset the magnets before probing; however, I have yet to implement this because the easiest fix is to manually move the joints to a position where neither of the red lights are on.

@smhty
Copy link
Collaborator

smhty commented Dec 18, 2019

@bensnell mentioned almost most points here.
The best way to get a consistent joint value (for joints 3 and 4) after homing is to start homing of joints 3 and 4 from similar position all the time. This initial position is different for each robot, as it depends on the position of the magnets on the two last pulley gears on the robot.

Another point, the homing signal triggers when the magnet switches from off to on. So, make sure that at the starting position the sensor lights on the pulleys are off.

Finally, given the value of the last two pulleys, we can uniquely identify j3 and j4. The homing process for the last two joints basically looks for a fixed position on the pulleys. So, if we start from a proper position we should get a consistent result all the time.

@cod65
Copy link

cod65 commented Dec 20, 2019

useful info. this has been driving me nuts. I cant see any way to ensure a mounted camera (or long tool) doesn't crash into the arm itself. Im experimenting with attaching a physical barrier (a pie plate) to the end so that my camera will be protected.

@artemplaksiy
Copy link

I'm using Dorna only few days, so maybe it's some kind of lack experience.. but..
@smhty I'm homing joints 3 and 4 from similar position and my magnets are off before homing, but I never can't achieve exactly the same position of the joint 4 (joint 3 looks OK). It's the same issue as @tloanPhytec have.
I need to make the robot working automatically as much as possible, so the manual calibration after each turn off/on is a little bit frustrating.. will try @bensnell 's solution.. maybe it will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants