Navigation

    Robolink logo
    • Register
    • Login
    • Search
    • [[global:header.categories]]
    • [[global:header.recent]]
    • [[global:header.tags]]
    • [[global:header.popular]]
    • [[global:header.users]]
    • [[global:header.groups]]
    As of September 2021, we have moved technical support to Robolink Help

    Welcome to the Robolink Community forum!

    You can post here to interact with others in the Robolink community. We're checking it weekly, and we'll respond to some messages. If you're looking for technical support, head over to Robolink Help.

    Trouble getting real time feedback form sensors

    CoDrone Lite/Pro
    3
    11
    9527
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robolink_arnold
      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.

      1 Reply Last reply Reply Quote 0
      • robolink_wes
        robolink_wes @beraug last edited by

        @robolink_arnold Can you take a look at this?

        1 Reply Last reply Reply Quote 0
        • B
          beraug last edited by

          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?

          import time

          def eventUpdateAttitude(data):
          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)
          drone.connect()
          drone.setEventHandler([drone.getHeight(),drone.getOptFlowPosition()], eventUpdateAttitude)

          horizontal_position = drone.getOptFlowPosition()
          height = drone.getHeight()

          drone.takeoff()

          while(drone.isConnected()):
          #request for the angle data
          drone.sendRequest([drone.getHeight(),drone.getOptFlowPosition()])
          time.sleep(0.05)#make sure to have a delay
          print(horizontal_position.X, horizontal_position.Y,height)

          robolink_wes 1 Reply Last reply Reply Quote 0
          • robolink_wes
            robolink_wes last edited by

            @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?

            1 Reply Last reply Reply Quote 0
            • B
              beraug last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • robolink_arnold
                robolink_arnold last edited by

                Hello @beraug are you using pycharm?

                1 Reply Last reply Reply Quote 0
                • robolink_wes
                  robolink_wes last edited by

                  @beraug Let me check with @robolink_whoseop to make sure you're getting the proper version and library.

                  Quick question before I get back with Whoseop's help, are you running in PyCharm or just purely command line?

                  1 Reply Last reply Reply Quote 0
                  • B
                    beraug last edited by

                    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>()
                    18
                    19 #set the event handler
                    ---> 20 drone.setEventHandler(DataType.Imu, eventUpdateAttitude)
                    21
                    22

                    NameError: name 'DataType' is not defined***

                    Could you please share the repository of the latest code?

                    Cheers.

                    1 Reply Last reply Reply Quote 0
                    • robolink_wes
                      robolink_wes last edited by

                      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!

                      1 Reply Last reply Reply Quote 0
                      • robolink_arnold
                        robolink_arnold last edited by robolink_arnold

                        Hello @beraug Are you using our latest library with the most updated functions we have recently created? Check out this link it has sample code we have created for our library https://support.robolink.com/ Let me know if you have any other questions.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post