Python accel_includes_gravity property error

Questions about our Python API
Post Reply
istvanbor
Posts: 12
Joined: Thu Jul 09, 2020 4:11 am

Python accel_includes_gravity property error

Post by istvanbor » Thu Sep 17, 2020 5:51 am

Hello!

I have a system with 4 modules in a family and I want to set the accel_includes_gravity false, but it gives me a bunch of errors.

My code:

Code: Select all

families = ['mecanumBase']
names = ['frontLeft', 'backLeft', 'frontRight', 'backRight']
group = lookup.get_group_from_names(families, names)
group_command = hebi.GroupCommand(group.size)
starter_fbk= group.get_next_feedback()
group_command.accel_includes_gravity=[False,False,False,False]
group.send_command(group_command)
The error:

Traceback (most recent call last):
File "./IMUodom.py", line 34, in <module>
group_command.accel_includes_gravity=[False,False,False,False]
File "/usr/local/lib/python3.6/dist-packages/hebi/_internal/ffi/_message_types.py", line 2534, in accel_includes_gravity
_marshalling.set_group_command_bool(self._command_refs, enums.CommandBoolAccelIncludesGravity, value)
File "/usr/local/lib/python3.6/dist-packages/hebi/_internal/ffi/_marshalling.py", line 1380, in <lambda>
set_group_command_bool = lambda msg, field, value: __set_bool_group(msg, field, value, api.hwCommandSetBool)
File "/usr/local/lib/python3.6/dist-packages/hebi/_internal/ffi/_marshalling.py", line 1218, in __set_bool_group
setter(refs, bfr, size, field)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: expected LP_c_int instance instead of c_bool_Array_4


Sadly I cannot understand any of this so here I am asking if did I do something wrong, or is this a bug?

Many thanks:
Istvan
User avatar
matt_tesch
HEBI Official
Posts: 7
Joined: Mon Mar 30, 2020 9:14 am
Location: Pittsburgh, USA

Re: Python accel_includes_gravity property error

Post by matt_tesch » Mon Sep 21, 2020 2:46 pm

Istvan,

Thanks for the question.

One quick note before debugging the python issue you are running into -- the "accel_includes_gravity" feature is implemented on the mobile I/O android and iOS apps, but not yet on the modules. From your suggestion, we are putting this together this as a feature on the modules; we should have this out by the end of the week if not sooner, and you will be able to update the modules through scope. I'll update this post when we finish testing and releasing that.

Regarding the python error you are getting -- I've been testing here, and am unfortunately unable to replicate the issue. I think this may be due to a python version mismatch? Can you run the following code in python so I can see what version of the Python API your system is running? I've just shown my output below from a python terminal:

Code: Select all

>>> import hebi
>>> hebi.version.py_version()
Version(major: 2, minor: 2, patch: 1, suffix: )
>>> hebi.version.loaded_c_api_version()
Version(major: 2, minor: 0, patch: 0, suffix: )
However, the code itself you listed looked fine. For reference, here is the sample code I was running to test the feature here; I'm again displaying the output from running in the Python terminal so you can see the result of each line in turn:

Code: Select all

>>> import hebi
>>> l = hebi.Lookup()
>>> group = l.get_group_from_names(['HEBI', 'HEBI'], ['A','B'])
>>> c = hebi.GroupCommand(2)
>>> group.send_command(c)
True
>>> c.accel_includes_gravity = [False, False]
>>> group.send_command(c)
True
>>> c.accel_includes_gravity = [True, True]
>>> group.send_command(c)
True
Thanks,
Matt
istvanbor
Posts: 12
Joined: Thu Jul 09, 2020 4:11 am

Re: Python accel_includes_gravity property error

Post by istvanbor » Tue Sep 22, 2020 3:45 am

Hello!

I ran the code that you provided, and my Python version was indeed old, so I upgraded it to 2.2.1 and now it compiles just fine. Many thanks, and I am looking forward to the actuator implementation :).

Istvan
User avatar
matt_tesch
HEBI Official
Posts: 7
Joined: Mon Mar 30, 2020 9:14 am
Location: Pittsburgh, USA

Re: Python accel_includes_gravity property error

Post by matt_tesch » Fri Oct 16, 2020 3:52 pm

Istvan,

I'm glad that worked for you!

Sorry for the delay -- we just released actuator version 15.5.0, which supports this feature. You can update modules on your network by opening Scope and going to the "firmware updates" tab in scope.

Let us know if you have any issues here.

Best,
Matt
Post Reply