Logging data and Permissions

Firmware/software/electronics/mechanics
Post Reply
lolz123
Beginner
Posts: 2
Joined: Fri Sep 01, 2017 4:03 pm

Logging data and Permissions

Post by lolz123 »

Hello,

I have two issues, one which I believe is a bit beyond regular support.

I would like to fly and record some data (in particular: accelerometer, gyroscope, and control inputs). The last one is important, but I cannot find a way to log the controller inputs from the client.

I assume I can write a separate Python program that logs controller state and timestamps them, but it would be nice if I could just record these as well.

This leads me to another issue: I want to record the data to my user config directory, which seems to require that I run the client without sudo (I am on Arch linux). If I run the client with sudo, I cannot easily retrieve the logs without copying the files. If I run without sudo though, I get the following error:

Code: Select all

Error while opening/initializing  input device

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cfclient/utils/input/__init__.py", line 318, in start_input
    self._selected_mux.add_device(device, role)
  File "/usr/lib/python3.6/site-packages/cfclient/utils/input/mux/__init__.py", line 69, in add_device
    self._open_new_device(dev, role)
  File "/usr/lib/python3.6/site-packages/cfclient/utils/input/mux/__init__.py", line 55, in _open_new_device
    old_dev = self._devs[role]
KeyError: '&Device'
Not sure what this is, I added a guard to the Python code to prevent the code from running if the key is not in the dictionary, but while the error disappears then, I still cannot control the Crazyflie 2.

Interestingly, the controller state is visible from the input configuration screen. I can move the sticks and it shows up there, but nothing happens outside of that screen. I also note that the bottom of the client says "Using Normal mux with N/A".

This may be a permissions issue. For the Crazyradio PA I tried adding the udev rules as described in one of the git repos, but they didn't work. Instead, I added my user to the root group, after which I can connect to the crazyflie. So, I also tried a custom rule for the controller, but that didn't work either.

So, in summary:
- Would be nice to have controller state logging
- Permissions don't work on Manjaro linux? (my Arch distribution)
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Logging data and Permissions

Post by arnaud »

Hi,

First of all you should not run the client with sudo. It is strange that the udev rules are not working on your system. Have you looked at the arch wiki to see if Arch is handling udev rules differently than other distrib?

What might happen for the input device is that some files in your config folder might be own by root and not readable by the client. You can locate the config folder by opening it in the client menu "settings/open config folder", and you can try to either remove the config folder or 'chmown' it to your user.

To log the setpoint you ca use the log that are already setup in the stabilizer loop file: https://github.com/bitcraze/crazyflie-f ... zer.c#L164.
lolz123
Beginner
Posts: 2
Joined: Fri Sep 01, 2017 4:03 pm

Re: Logging data and Permissions

Post by lolz123 »

Hello,

Thanks for the response!

I looked around for what might set my system apart from others that could cause this issue, and the only thing I could find is that the user groups may be different sometimes. Unfortunately, I wasn't able to figure out what to do from there, as I tried adding my user to several other groups (and changing the udev file), but it didn't make a difference. Instead, I just ran it with sudo, and copied the files into my user directory from root.

For the timestamping, I just modified the Python client code to use machine-relative timestamps. This way I was able to write a controller logging script that uses the same timestamping, after which I use another script to "zip" them together.

So, I have it all working now, although it would still be nice to be able to not have to use sudo. I will take a look and see if there are any files that I don't have proper permissions for, as you suggest. I will let you know of any progress there!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Logging data and Permissions

Post by arnaud »

Hi, thanks for the update. It is still very strange that the udev rules are not working, maybe the 'almost bleeding edge' version of systemd/udev that arch uses has changed something in the udev rules.

For the timestamps I am glad you found a solution. Out of curiosity: what was the problem with logging setpoints from within the Crazyflie?
Post Reply