Go to Post Last year we saved a ton of money by using a good bit of square tubing for the frame of our robot, square tubing is a lot cheaper then C channel. We get to use so much raw material that the cost should go down in certain places. - Derrick Maust [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-01-2017, 19:28
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
ADXRS450 Gyro board not feeding back

Hi guys, we are having some issues getting feedback from our ADXRS450 gyro. We have exhausted all of the troubleshooting that we can think of, but maybe somebody else experienced similar issues and is able to help.

self.gyro = wpilib.ADXRS450_Gyro(0)

^Here's the init

wpilib.SmartDashboard.putNumber("GyroAngle",self.g yro.getAngle())
^Here's the output command to the java dashboard.

When we implement the gyro in we can run and drive the robot but we get the

'wpilib.motorsafety : Robot Drive... Output not updated often enough.'

error over and over again.

-We have the latest version of robotpy
-We are on the right port
-our dashboard accepts feedback from other sources
-We've rotated the RIO on all 6 axis's to try and get feedback
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2017, 00:16
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

Hm. What does the rest of your code look like?

I've not tried the ADXRS450 gyro (I don't have one)... but it should work? I just reviewed the source code and it looks identical to the java code... the one thing I'm not 100% sure on is the readRegister function, as it creates a ByteBuffer in BIG_ENDIAN mode.. but that's only called on initialization, and if there's an error there it would set .spi to None. Can you check to see if .spi is None? If it is, I can dig into this a bit more tomorrow night.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2017, 11:09
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

I forgot that this came in the kit of parts, I've retrieved one and I'll test it tonight when I get home.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2017, 14:01
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
Re: ADXRS450 Gyro board not feeding back

We actually tested all of the ports that it can look for, 0/None through 5, and we got errors whenever the ID passed to it isn't equal to 0/None.

I'd post code but I'm currently getting yelled at for not committing my changes to GitHub, and because they aren't committed I can't pull them up right now

I'll merge it tonight at around 6:30 EST and either post a link to the github or just paste it in a post

Thanks for your time.
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2017, 18:13
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
Re: ADXRS450 Gyro board not feeding back

https://github.com/Team74/FRC_2017_Python

All of the code is in the robot.py file
Reply With Quote
  #6   Spotlight this post!  
Unread 25-01-2017, 21:50
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

I tried out the gyro, works like a charm under RobotPy.

The error is in your code, there's no reason to call calibrate -- it's already called in the constructor. Additionally, calibrate basically freezes the robot's operation for 5 seconds -- during which time you'll see the motor safety errors.

Get rid of the calibrate and it should work.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #7   Spotlight this post!  
Unread 26-01-2017, 19:23
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
Re: ADXRS450 Gyro board not feeding back

We updated the code not to have the calibrate or reset functions, no feedback from the gyro.

Next, we copied the sampleRobot code from the wpilib website, and implemented only the gyro code, no feedback.

We then deployed C++ onto the same robot, and got feedback from the gyro, so we know it's not a hardware problem. You can see the current code we are using in the Initial-Code-Copy branch.

I'd hate to ask for a code snippet but we are on day 4 of trying to get this thing working at this point

https://github.com/Team74/FRC_2017_P...-Copy/robot.py
^Current Robot Code

https://github.com/Team74/FRC_2017_P...ging/Robot.cpp
^C++ code for comparison

https://github.com/Team74/FRC_2017_P...gging/Robot.py
^SampleRobot tests

Currently running pyfrc version 2017.0.4
Reply With Quote
  #8   Spotlight this post!  
Unread 26-01-2017, 20:12
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

Quote:
Originally Posted by CloakAndDagger View Post
We updated the code not to have the calibrate or reset functions, no feedback from the gyro.

Next, we copied the sampleRobot code from the wpilib website, and implemented only the gyro code, no feedback.

We then deployed C++ onto the same robot, and got feedback from the gyro, so we know it's not a hardware problem. You can see the current code we are using in the Initial-Code-Copy branch.

I'd hate to ask for a code snippet but we are on day 4 of trying to get this thing working at this point

https://github.com/Team74/FRC_2017_P...-Copy/robot.py
^Current Robot Code

https://github.com/Team74/FRC_2017_P...ging/Robot.cpp
^C++ code for comparison

https://github.com/Team74/FRC_2017_P...gging/Robot.py
^SampleRobot tests

Currently running pyfrc version 2017.0.4
Oh interesting, you have something in the constructor. Maybe that's it? Here's how I tested it:
  • ssh into the robot
  • frcKillRobot.sh -t
  • python3
Code:
>>> import wpilib
>>> a = wpilib.ADXRS450_Gyro()
>>> print(a.getAngle())

Move the roborio

>>> print(a.getAngle())
So.. that's it. Nothing else getting in the way. I won't be home for a few hours, I'll try your code when I get there.

One difference that I thought of is that I'm using a slightly newer version RobotPy that I'm working on adding some things to, but I don't think there have been any changes that would impact it. I'll try installing 2017.0.4 also to make sure that works also.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #9   Spotlight this post!  
Unread 26-01-2017, 20:51
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
Re: ADXRS450 Gyro board not feeding back

We just tried it over SSH and it works great, but our robot code doesn't receive any feedback from the gyro
Reply With Quote
  #10   Spotlight this post!  
Unread 26-01-2017, 20:58
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

Quote:
Originally Posted by CloakAndDagger View Post
We just tried it over SSH and it works great, but our robot code doesn't receive any feedback from the gyro
With or without an argument in the constructor? I note that you have another variable that you're putting to the dashboard... is it incrementing and showing on your dashboard, or is it also not showing?
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #11   Spotlight this post!  
Unread 27-01-2017, 00:31
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

I am able to confirm that your sample program does not work. Digging some more into this, it's very strange.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #12   Spotlight this post!  
Unread 27-01-2017, 02:05
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: ADXRS450 Gyro board not feeding back

The issue is that HALInitialize was being called twice. This bug is fixed in RobotPy 2017.0.5, please upgrade and let me know if that addresses your issue.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #13   Spotlight this post!  
Unread 28-01-2017, 14:24
CloakAndDagger CloakAndDagger is offline
Registered User
FRC #0074 (CHAOS)
Team Role: Programmer
 
Join Date: Apr 2016
Rookie Year: 2015
Location: Holland, MI
Posts: 32
CloakAndDagger is on a distinguished road
Re: ADXRS450 Gyro board not feeding back

Patch works great! It is all working as intended now, thanks so much for your help, now, on to vision code!
Reply With Quote
Reply


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 11:25.

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