Go to Post Omni wheels are cool... but mecanum wheels are COOL!! - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 15 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 08-05-2013, 15:53
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Here's Some Sensor Test Code for the Gyro & PID, Accelerometer, and Magnetic Encoder

I created some test code for making sure various sensors were working, and understanding how to use the WPILIB PID class(for the gyro). After I finished, I commented them for others to use and expanded upon the comments in the README.md that can be read on github easily.

Let me know if anything is unclear or if there are any questions.

Each link links to a git repository on github. On the page is some information about setting up the device for running the code. If you aren't familiar with git, the code can be downloaded as a compressed file(click the zip button).

Each repository is a contains a netbeans project for ease of use. Just click open>Open Project... and navigate to the extraced folder to add the project to netbeans.

ADXL345 Accelerometer Test Code
Am-2067 Gyroscope Test code
Am-2067 Gyroscope and PID Example
AS5145B Encoder - Incremental Mode Test Code
AS5145B Encoder - Absolute Mode Test Code
Reply With Quote
  #2   Spotlight this post!  
Unread 08-05-2013, 16:19
joelg236 joelg236 is online now
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Here's Some Sensor Test Code for the Gyro & PID, Accelerometer, and Magnetic Enco

From what I saw, it looks like these basically just log the values. Any reason you use a separate project just for logging a sensor's value instead of just putting it in your normal code?
__________________
All opinions are my own.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-05-2013, 03:20
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Here's Some Sensor Test Code for the Gyro & PID, Accelerometer, and Magnetic Enco

Quote:
Originally Posted by joelg236 View Post
From what I saw, it looks like these basically just log the values. Any reason you use a separate project just for logging a sensor's value instead of just putting it in your normal code?
All of them are basically logging values, except for the Gyro rotation one; just logging values may seem easy, but actually knowing what classes and methods to use is kind of time consuming to figure out without examples. WPILIB doesn't do a very job describing the behaviour of classes and its methods, and I needed to know if the . Basically I needed to see what the output was to get.

Just using these classes with my actual robot code would have been be next to impossible this year if I didn't write some(very basic) test to code to verify that the device was indeed correctly wired, and to see what the output looked like.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-05-2013, 20:48
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Here's Some Sensor Test Code for the Gyro & PID, Accelerometer, and Magnetic Enco

Quote:
Originally Posted by Azrathud View Post
Just using these classes with my actual robot code would have been be next to impossible this year if I didn't write some(very basic) test to code to verify that the device was indeed correctly wired, and to see what the output looked like.
Is there any reason why you made your own program instead of using the LiveWindow? Testing sensors on robots was one of the reasons why the LiveWindow was made.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
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 22:32.

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