Comments (11)
which QTM version are you using on the mocap computer and which version do you have installed on pip?
This all is not related to the firmware of the crazyflie as you have no problem connecting it. It is just going wrong at the qualisys api
from crazyflie-lib-python.
My qtm version is 2022.2 (build 7710)
and pip version is pip 23.1 from C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
the qtm version installed on pip is
Name: qtm
Version: 2.1.1
Summary: QTM Python SDK
Home-page: https://github.com/qualisys/qualisys_python_sdk
Author: Martin Gejke
Author-email: [email protected]
License: MIT
Location: C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires:
Required-by: qfly
and qfly version is
Name: qfly
Version: 0.2
Summary: Qualisys Drone SDK
Home-page: https://github.com/qualisys/qualisys_drone_sdk
Author: Mehmet Aydin Baytas c/o Qualisys AB
Author-email: [email protected]
License: MIT
Location: C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires: cflib, pynput, qtm
Required-by:
from crazyflie-lib-python.
I can not reproduce this in our system. We are running QTM 2023.02, but I also tested on 2021.02 and that also worked fine. I'm also using V2.1.1 of the python qtm module. qfly is not used by the qualisys_hl_commander.py script.
I'm not sure why you get this problem, but maybe you can check with Qualisys?
from crazyflie-lib-python.
I can not reproduce this in our system. We are running QTM 2023.02, but I also tested on 2021.02 and that also worked fine. I'm also using V2.1.1 of the python qtm module. qfly is not used by the qualisys_hl_commander.py script.
I'm not sure why you get this problem, but maybe you can check with Qualisys?
We first raised the issue with Qualisys and they said that the issue is with crazyflie. Also the Sr. Tech. Engineer from Qualisys asked us not to upgrade the Qualisys software. Can you please reproduce and check the issue on QTM 2022.2 (Build 7710)?
Also, why does it matter what version of QTM Version we are using?
From what I know, QTM just gives the data related to position and orientation of crazyflie. The crazyflie is identified in the
GUI of the QTM software, so there should be no problem in receiving the data from QTM.
from crazyflie-lib-python.
Also, why does it matter what version of QTM Version we are using?
The qualisys_hl_commander.py script connects to QTM to get the position of the Crazyflie, which is then forwarded to the Crazyflie itself. The python lib qualisys_python_sdk from Qualisys is used to handle the connection and the qualisys_hl_commander.py script. Back in 2020 there was a change in the QTM protocol that was not handled by the qualisys lib, see issue #13, but that was fixed in version 2.1.0
To me it looks like the error you get happens when the qualisys_python_sdk lib tries to find out if there are any QTM systems on the network (discovery)
qtm_instance = await self._discover()
^^^^^^^^^^^^^^^^^^^^^^
File "d:\Gaurav Singh Bhati\MoCap\qualisys_hl_commander.py", line 120, in _discover
async for qtm_instance in qtm.Discover('0.0.0.0'):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 85, in __anext__
protocol.send_discovery_packet()
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 50, in send_discovery_packet
self.transport.sendto(
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 508, in sendto
self._loop_writing()
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 540, in _loop_writing
self._protocol.error_received(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'QRTDiscoveryProtocol' object has no attribute 'error_received'
The script pretty much just calls discover, connect and gets the data back in a callback, see
crazyflie-lib-python/examples/qualisys/qualisys_hl_commander.py
Lines 106 to 117 in ab0898a
I'm not sure what else we could do?
I think the problem is some sort of incompatibility between your QTM and qualisys_python_sdk.
from crazyflie-lib-python.
Also, why does it matter what version of QTM Version we are using?
The qualisys_hl_commander.py script connects to QTM to get the position of the Crazyflie, which is then forwarded to the Crazyflie itself. The python lib qualisys_python_sdk from Qualisys is used to handle the connection and the qualisys_hl_commander.py script. Back in 2020 there was a change in the QTM protocol that was not handled by the qualisys lib, see issue #13, but that was fixed in version 2.1.0
To me it looks like the error you get happens when the qualisys_python_sdk lib tries to find out if there are any QTM systems on the network (discovery)
qtm_instance = await self._discover() ^^^^^^^^^^^^^^^^^^^^^^ File "d:\Gaurav Singh Bhati\MoCap\qualisys_hl_commander.py", line 120, in _discover async for qtm_instance in qtm.Discover('0.0.0.0'): File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 85, in __anext__ protocol.send_discovery_packet() File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 50, in send_discovery_packet self.transport.sendto( File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 508, in sendto self._loop_writing() File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 540, in _loop_writing self._protocol.error_received(exc) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'QRTDiscoveryProtocol' object has no attribute 'error_received'The script pretty much just calls discover, connect and gets the data back in a callback, see
crazyflie-lib-python/examples/qualisys/qualisys_hl_commander.py
Lines 106 to 117 in ab0898a
I'm not sure what else we could do?
I think the problem is some sort of incompatibility between your QTM and qualisys_python_sdk.
Can you provide the versions of every software/package/tools on which the high level commander is working in your system. We will try to see if it works for us with same version. Specifically, we need versions of QTM, python, qfly, QTM python SDK and any other dependencies, if any.
I'm referring this issue to Qualisys as well.
from crazyflie-lib-python.
As far as I know this has been working since the issue above was fixed, but we do not test with all QTM releases.
I have written a script for you to try. It connects to QTM, waits a bit and disconnects. If you have a rigid body defined in QTM with the name "cf" it will also print the position of this body. There is no connection or code related to the Crazyflie in this script.
If you also have problems with this script, it is not related to the Crazyflie.
Have you checked that you are actually running the python version with the correct qtm lib? Is is possible that you have an older version of the lib installed in some other python version that you run accidentally?
import asyncio
import math
import time
import xml.etree.cElementTree as ET
from threading import Thread
import qtm
# The name of the rigid body in QTM that represents the Crazyflie
rigid_body_name = 'cf'
class QtmWrapper(Thread):
def __init__(self, body_name):
Thread.__init__(self)
self.body_name = body_name
self.on_pose = None
self.connection = None
self.qtm_6DoF_labels = []
self._stay_open = True
self.start()
def close(self):
self._stay_open = False
self.join()
def run(self):
asyncio.run(self._life_cycle())
async def _life_cycle(self):
await self._connect()
while (self._stay_open):
await asyncio.sleep(1)
await self._close()
async def _connect(self):
qtm_instance = await self._discover()
host = qtm_instance.host
print('Connecting to QTM on ' + host)
self.connection = await qtm.connect(host)
params = await self.connection.get_parameters(parameters=['6d'])
xml = ET.fromstring(params)
self.qtm_6DoF_labels = [label.text.strip() for index, label in enumerate(xml.findall('*/Body/Name'))]
await self.connection.stream_frames(
components=['6D'],
on_packet=self._on_packet)
async def _discover(self):
async for qtm_instance in qtm.Discover('0.0.0.0'):
return qtm_instance
def _on_packet(self, packet):
header, bodies = packet.get_6d()
if bodies is None:
return
if self.body_name not in self.qtm_6DoF_labels:
print('Body ' + self.body_name + ' not found.')
else:
index = self.qtm_6DoF_labels.index(self.body_name)
temp_cf_pos = bodies[index]
x = temp_cf_pos[0][0] / 1000
y = temp_cf_pos[0][1] / 1000
z = temp_cf_pos[0][2] / 1000
r = temp_cf_pos[1].matrix
rot = [
[r[0], r[3], r[6]],
[r[1], r[4], r[7]],
[r[2], r[5], r[8]],
]
if self.on_pose:
# Make sure we got a position
if math.isnan(x):
return
self.on_pose([x, y, z, rot])
async def _close(self):
await self.connection.stream_frames_stop()
self.connection.disconnect()
if __name__ == '__main__':
# Connect to QTM
qtm_wrapper = QtmWrapper(rigid_body_name)
qtm_wrapper.on_pose = lambda pose: print(pose[0], pose[1], pose[2])
time.sleep(5)
qtm_wrapper.close()
from crazyflie-lib-python.
Apologies for the late response.
We only have one installation of python and QTM which is mentioned above. We have a new PC so there is no chance of any previously installed versions creating problem. Do you have any suggestion to which we should change versions of python or QTM.
We are getting the same error for your code (see below).
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 536, in _loop_writing
self._write_fut = self._loop._proactor.sendto(self._sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 543, in sendto
ov.WSASendTo(conn.fileno(), buf, flags, addr)
OSError: [WinError 10022] An invalid argument was supplied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "d:\qtest.py", line 30, in run
asyncio.run(self._life_cycle())
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "d:\qtest.py", line 33, in _life_cycle
await self._connect()
File "d:\qtest.py", line 39, in _connect
qtm_instance = await self._discover()
^^^^^^^^^^^^^^^^^^^^^^
File "d:\qtest.py", line 53, in _discover
async for qtm_instance in qtm.Discover('0.0.0.0'):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 85, in __anext__
protocol.send_discovery_packet()
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\qtm\discovery.py", line 50, in send_discovery_packet
self.transport.sendto(
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 508, in sendto
self._loop_writing()
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 540, in _loop_writing
self._protocol.error_received(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'QRTDiscoveryProtocol' object has no attribute 'error_received'
However we are able to run this code with QTM and Crazyflie. However, we need to use High Level Commander for our experiments. Please suggest what we can do.
from crazyflie-lib-python.
Related Issues (20)
- Using URI with address doesn't work with cfloader HOT 1
- Timeout Error while setting parameter at _connected() callback HOT 1
- Crazyflie's are falling when they are top of each other HOT 2
- Serial uart crtp does not connect without usb connected HOT 1
- Serial UART CRTP has an CRC error HOT 1
- Getting Fatal Python error while running ramp.py example. HOT 3
- Enable the new geo estimation for 1 LH basestation HOT 1
- Make trajectory uploader part of the cflib HOT 2
- multi-threading issue in get_estimated_positions HOT 1
- UdpDriver encondes bytes incorrectly HOT 1
- Sync classes do not handle lost connection in a good way
- Race condition in parameter handling
- Fullstate setpoint implementation HOT 4
- Quat decompress part of cflib? HOT 4
- remove any highlevel commander start parameters in scripts HOT 2
- Enforce CPX version
- motion commander, start_linear_motion reverse yaw HOT 2
- Fixes to the wall following demo
- CI should test examples
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crazyflie-lib-python.