Welcome to the Robolink Community forum!
Trouble getting real time feedback form sensors
robolink_arnold last edited by
@beraug Can you try running this code instead to verify everything works https://support.robolink.com/codrone-library/getgyroangles let me know what results you get.
@robolink_arnold Can you take a look at this?
Thanks guys, will have a look.
The link to download the lates library would also be highly regarded.
I've actually manage to get the code running with this code, although when the drone is flying it don't send the data. He can only send when has finished the flight command. I wonder how to make then work in parallel?
global height, horizontal_position_X, horizontal_position_Y
height = getHeight()
horizontal_position_X = horizontal_position.X
horizontal_position_Y = horizontal_position.Y
#set the event handler
drone = CoDrone.CoDrone(True, False, False, False, False)
horizontal_position = drone.getOptFlowPosition()
height = drone.getHeight()
#request for the angle data
time.sleep(0.05)#make sure to have a delay
@beraug Ohhh, I see, Jupyter notebook. We haven't yet tested running CoDrone using a Jupyter Notebook yet, unfortunately. That explains why you're running into errors. At the moment, I would recommend following the PyCharm setup to use Python with CoDrone, since that's what we've supported so far. It can be a bit cumbersome and technical, which we're currently trying to improve on. That said, here is the tutorial on how to set that up.
Our team is currently exploring Jupyter notebook for a different project, but we haven't used it with CoDrone yet. @robolink_arnold Are you familiar with what the error might mean, and whether we even have access to the latest CoDrone library via Jupyter notebook?
Hi guys, sorry for my late reply, I’m in Australia so a bit of lag on my answers.
I’m using the command lines directly from Jupiter notebook. Cheers.
robolink_arnold last edited by
Hello @beraug are you using pycharm?
HI Arnold and Wes, Thanks very much for replying my question.
I've actually had a bit of trouble finding the latest library that actually works with the functions in the link sent. Not sure but when I've installed CoDrone using pip it gave me a different version from the latest.
I'm getting the files from here: https://github.com/RobolinkInc/CoDrone and have also tried to just replace the files in the installed directory to update them to the latest revision but does not look like it is working. I'm getting the same error:
***NameError Traceback (most recent call last)
<ipython-input-8-d219565f103e> in <module>()
19 #set the event handler
---> 20 drone.setEventHandler(DataType.Imu, eventUpdateAttitude)
NameError: name 'DataType' is not defined***
Could you please share the repository of the latest code?
As @robolink_arnold mentioned, looks like the code you're running is using the old library. If you check out the URL he linked, you'll be able to use a newer set of functions that hopefully are easier to use and understand.
Let us know if you have any other questions or have trouble getting it to work!
robolink_arnold last edited by robolink_arnold