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
-
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% powerNameError: name 'UP' is not defined
-
Perfect thank you for the help! @robolink_leila
-
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