Go to Post I'm going through waves of excitment and panic all at the same time. - je2164 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2015, 15:37
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Python: TypeError: unorderable types: complex() > float()?

Hi! We have a problem when trying to sqaure root our contoller's left and right axis for a nice speed curve. The error message is:
Code:
TypeError: unorderable types: complex() > float()
. I am doing
Code:
self.robot_drive.arcadeDrive(cmath.sqrt(self.joystick.getX()),cmath.sqrt(self.joystick.getX()))
Any help will be greatly appreciated!
  #2   Spotlight this post!  
Unread 23-01-2015, 15:46
Christopher149 Christopher149 is offline
Registered User
FRC #0857 (Superior Roboworks) FTC 10723 (SnowBots)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2007
Location: Houghton, MI
Posts: 1,101
Christopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond repute
Re: Python: TypeError: unorderable types: complex() > float()?

Shot in the dark guess: taking the square root of getX(), which can sometimes be negative, will give you an imaginary value. You need some way to avoid that and only produce real numbers for arcadeDrive().
__________________
2015-present: FTC 10723 mentor
2012-present: 857 mentor
2008-2011: 857 student

2015: Industrial Design, Excellence in Engineering, District Finalist, Archimedes Division (#6 alliance captain)
2014: Judges Award, District Engineering Inspiration, District Finalist, Galileo Division

  #3   Spotlight this post!  
Unread 23-01-2015, 16:05
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Python: TypeError: unorderable types: complex() > float()?

Quote:
Originally Posted by team-4480 View Post
Hi! We have a problem when trying to sqaure root our contoller's left and right axis for a nice speed curve.
Even after accounting for the sign of the value, taking the square root sounds like it would bend the speed curve in the wrong direction. It would make the motors more sensitive to small inputs, instead of giving the driver more low-speed control. Most suggestions I see call for squaring or cubing the joystick value.
  #4   Spotlight this post!  
Unread 23-01-2015, 16:36
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Python: TypeError: unorderable types: complex() > float()?

Quote:
Originally Posted by Alan Anderson View Post
Even after accounting for the sign of the value, taking the square root sounds like it would bend the speed curve in the wrong direction. It would make the motors more sensitive to small inputs, instead of giving the driver more low-speed control. Most suggestions I see call for squaring or cubing the joystick value.
My bad....I mixed those up....Thanks!
  #5   Spotlight this post!  
Unread 24-01-2015, 22:02
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Python: TypeError: unorderable types: complex() > float()?

Quote:
Originally Posted by Alan Anderson View Post
Even after accounting for the sign of the value, taking the square root sounds like it would bend the speed curve in the wrong direction. It would make the motors more sensitive to small inputs, instead of giving the driver more low-speed control. Most suggestions I see call for squaring or cubing the joystick value.
How would you square negatives? Thanks!
  #6   Spotlight this post!  
Unread 24-01-2015, 22:09
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Python: TypeError: unorderable types: complex() > float()?

Quote:
Originally Posted by team-4480 View Post
How would you square negatives? Thanks!
RobotDrive has support for this built in, so you should be able to just use this:
Code:
self.robot_drive.arcadeDrive(self.joystick.getX(), self.joystick.getX(), true)
This is how it is done internally:
Code:
if squaredInputs:
            # square the inputs (while preserving the sign) to increase fine
            # control while permitting full power
            if moveValue >= 0.0:
                moveValue = (moveValue * moveValue)
            else:
                moveValue = -(moveValue * moveValue)
            if rotateValue >= 0.0:
                rotateValue = (rotateValue * rotateValue)
            else:
                rotateValue = -(rotateValue * rotateValue)
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi