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.

    Codrone Pro won't recognize standard functions

    CoDrone Troubleshooting
    2
    3
    3281
    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.
    • R
      Ronan1 last edited by

      Hello,

      When I try to use standard codrone functions in Python it states the function is not defined. Any ideas please?

      NameError Traceback (most recent call last)
      <ipython-input-6-c2cfc033e4c6> in <module>
      6
      7 drone.takeoff() # takeoff for 2 seconds
      ----> 8 drone.go(UP, 3, 75) # go up for 3 seconds at 75% power
      9 drone.go(FORWARD) # go forward for 1 second at 50% power
      10 drone.go(LEFT, 6) # go left for 6 seconds at 50% power

      NameError: name 'UP' is not defined

      1 Reply Last reply Reply Quote 0
      • R
        Ronan1 @robolink_leila last edited by

        Perfect thank you for the help! @robolink_leila

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

          Hi, @Ronan1!
          In Python, using the go() function is a little bit different than in Arduino. You will need to import the Direction class separately:

          #Python code
          import CoDrone
          from CoDrone import Direction
          
          def main(): 
              drone = CoDrone.CoDrone()
              drone.pair()
              drone.takeoff()
          
              drone.go(Direction.FORWARD)         # Go forward for 1 second at 50% power
              drone.go(Direction.UP, 5)           # Go up for 5 seconds at 50% power
              drone.go(Direction.BACKWARD, 3, 70) # Go backwards for 3 seconds at 70% power
          
          if __name__ == '__main__':
              main()
          

          You can find the documentation here 🙂

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