Vi-Cell Blu Python Communication

Hi,

I’m working on a python based OPC-UA client to communicate and run a Vi-Cell Blu. I’m able to properly connect, receive information from the device, and send commands like setting the automation lock on and off. For some reason, I cannot get it to run an automation cup sample. Does anyone with any experience with the Vi-Cell Blu driver know what issues could be causing this?

Below is the code I’m currently using to communicate:

client = Client(URL)
client.application_uri = "urn:vesalius:robocell:client"
client.set_user(USER)
client.set_password(PASS)
client.set_security_string(f"{POLICY},{CERT_DER},{KEY_PEM}")
client.connect()

c_methods = client.get_node("ns=2;i=15272")
play_control = client.get_node("ns=2;i=15309")
start_sample = client.get_node("ns=2;i=15310")

data_classes = load_type_definitions(client)[1]
data_enums = load_enums(client)

valid_cell_types = vc_methods.call_method("2:GetCellTypes")
sample_cfg = data_classes["SampleConfig"]()

sample_cfg.SampleName = f"Test_sample_{int(time.time())}"
sample_cfg.SampleStatus = data_enums["SampleStatusEnum"]["NotProcessed"]
sample_cfg.Dilution = 1
sample_cfg.CellType = valid_cell_types.CellTypes[0]
sample_cfg.Tag = "testing"
sample_cfg.SaveEveryNthImage = 1
sample_pos = data_classes["SamplePosition"]()
sample_pos.Column = 1
sample_pos.Row = "A"
sample_cfg.SamplePosition = sample_pos

lock_resp = vc_methods.call_method("2:RequestLock")

result = play_control.call_method("2:StartSample", sample_cfg)

vc_methods.call_method("2:ReleaseLock")
client.disconnect()

When trying to run the sample I get back the error: ‘Failed to process SampleSet ‘Automation Cup Sample Set’: NoSamplesDefined, InvalidStageAndCarrier, CarrierNotDefined, InvalidSamplePosition, ErrorLevel: ErrorLevelEnum.Error’

If I instead try to run the method StartSampleSet, with the same sample config in an array, it runs with no issue. I’ve also tried different variations of the SamplePosition variable, both the default value and a None value, both create errors as well.

I think there must be some issue with the way the Vi-Cell is configured in this communication but I’m not sure how to change it.

This is definitely out of my wheelhouse, but having a ViCell Blu in the lab I’m very interested in what you’ve got going.

Looking at Beckman’s instructions for this I see a few things that might cause some issues?

The instructions have SampleConfig.Name not SampleConfig.SampleName. Same goes for a few other properties you’re trying to set Position instead of SampePosition. I don’t see a SampleStatus?

I’m not Python literate, so take my suggestions with a grain of salt. But do post back if you get it working!

Edit: I see your last paragraphs now, I guess I got excited and didn’t read them before. Looks like StartSample should only be used for a single sample in a sample cup and position isn’t used, but the instructions say it’s ignored, not that you shouldn’t include it.

Do you have the code for a SampleSet that works? Can you post that?