Strange behavior at Evo_backend initialization

Hello there,

I am a Tecan user and plan to use pylabrobot with our Tecan EVO. I was able to install all the driver, connect to the device and initialize it through pylabrobot.

However, the initialization crashes at the LiHa initialization. The issue was that when checking for a collision, pylabrobot retrives the LiHa position with: “EVOArm._pos_cache.setdefault(self.module, await self.report_x_param(0))”. For some unexpected reason on my install that function returns a string instead of an integer. I was able to proceed with the initialization by parsing the position to an integer ("“int(EVOArm._pos_cache.setdefault(self.module, await self.report_x_param(0))”).

I know the integration between pylabrobot and the Tecan is still underdevelopped, but I haven’t seen any similar issue on the forum nor in github.

Is that something specific to my installation? Would it make sense to do a pull request for that?

Thanks for the help,

Best,

Xavier

3 Likes

welcome to the forum!

that’s very interesting, thank you for figuring it out. could you please make a pull request? thanks for offering!

I think doing the cast in the self.report_x_param function would make the most sense

1 Like

thanks for the PR!

on closer inspection, I am surprise the response parser does not get this correct:

      data.append(int(x) if x.isdigit() else x)

https://github.com/PyLabRobot/pylabrobot/blob/b22e26591c8e1cb2cabdf48c5e5a37aef441d6cb/pylabrobot/liquid_handling/backends/tecan/EVO_backend.py#L124

what is the value exactly?

With pleasure!

Thanks for pointing out the exact parser line. In fact in my example, x was a negative value (-160 or something similar) str.isdigit() is indeed false for negatives. However, I cannot tell yet why the value received is negative, from what I understand from both PLR and Tecan the coordinates system should be strictly positive isn’t it?

The trick didn’t raise any issue during my initialization tho, so it doesn’t raised any of the Tecan error checks.

I can try to sniff a bit more of my Tecan positions to understand that better :slight_smile:

oh, that is very interesting.

from what I understand from both PLR and Tecan the coordinates system should be strictly positive isn’t it?

for both, actually: no!

  • in PLR: abstractly, the coordinate system has an arbitrary origin. It’s just a model of where things are relatively to each other. It’s only at the backend level that things get translated from PLR coordinates into machine coordinates (which do have an absolute 0).
  • some machines, like the EVO might have coordinate systems that run negative
    • what’s more: the evo actually allows people to define their own coordinate systems (which is kind of nice), and apparently these can run negative as your robot does

If you wouldn’t mind testing it, I am (read: claude is) writing backend to fix the root cause (the parser)

As some test I simply tried to print, the returned values of report_x_param and report_y_param during the initialization.

RPX response: [1273], param: 0
RPX response: [8999], param: 0
RPX response: [9860], param: 5
RPY response: [2859, 2859], param: 5
RPX response: ['-164'], param: 0
RPX response: [45], param: 0

From my understanding of both function, calling them with param = 0 gives the current position, and with param = 5 the range of the axis (so the maximum position) right ?

Overall the fix works as we are correctly parsing this ‘-164’ and the resulting command is accepted by the Tecan. It also goes to the expected location for the initialization part. However I am still a bit concern by both the datatype and the value. I will keep my prints when testing the library but so far I haven’t seen any other occurrences of a string nor a negative.

is this with my new branch?

if not, could you please check out this PR and let me know if it fixes the problem: Fix parsing of negative integers in Tecan response parser by rickwierenga · Pull Request #848 · PyLabRobot/pylabrobot · GitHub

yes
0: Report current position in 1/10 mm.
5: Report actual machine range in 1/10 mm .

There are actually many more, as of yet undocumented in PLR:

0	Report current position in 1/10 mm.
1	Report acceleration in 1/10 mm/s^2.
2	Report end speed in 1/10 mm/s.
3	Report initialization speed in 1/10 mm/s.
4	Report initialization offset in 1/10 mm.
5	Report actual machine range in 1/10 mm.
6	Report deviation in encoder increments.
7	Report displacement offset in 1/10 mm.
8	Report scale adjust factor.
9	Report slow speed in 1/10 mm/s.
10	Report scale factor.
11	Report target position in 1/10 mm.

I’ll document those

for the STAR we chose to convert everything to mm units on the Python level, just dealing with 0.1mm units on the firmware level (not user facing). I would like to make a similar change to the EVO if you’re ok with it. I think it’s better to do it sooner while the EVO backend has few users, rather than causing more pain like the STAR backend, setting up for greater future success

Oh sorry for the potential misunderstanding, your PR fixes indeed the problem. The RPX responses I have shared are print statement before your parse_response function call. The negative string (“-164”) is correctly parsed to a number (-164) with your fix.

Regarding the 0.1mm unit, let me check if I understand it correctly. Right now a value of 1273 means “127.3 mm” is that right? And you would like to change that to 127.3 in the python level? If that’s the case, I am definitely ok with it. It also aligns with how the units are shown on Freedom EvoWare as well, thus making the transition to PLR easier.

Btw, if I can be of any help with the documentation (depending on my time with my work), I’ll be happy to help :slight_smile:

1 Like

sweet

exactly. I will go through it this weekend

thanks!