Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Using an SPI Gyro (http://www.chiefdelphi.com/forums/showthread.php?t=137066)

Cinnamon Toast 04-30-2015 09:41 AM

Using an SPI Gyro
 
Hey guys,

In past years we haven't used many sensors to dictate any kind of drive control on the robot. For the most part we have always done tank drive on traction wheels or some combination of traction and omni wheels. This year we decided to have at it with an omni h drive. Moving to a little more maneuverability in our drive train made auton interesting. Using the h drive in auton often led to rotation of the whole chassis (due o the H drive not being centered perfectly combined with un equal weight distribution). The obvious way to fix this would be to use some type of gyro. I've played around with the KOP gyro and I'm not impressed. After a lot of calibration work and debugging, it still drifts way to much for my liking. After reading some of the other posts like this one,

http://www.chiefdelphi.com/forums/sh...d.php?t=130538

I think it would be a good idea to check out a gyro like the ADXRS450.

http://www.analog.com/en/products/me...-evaluationkit

I've run into a couple of problems though, most having to do with my knowledge base. First of all, I haven't worked with SPI before. From what I can tell, the gyro class that is normally used in C++ won't be applicable because initialization arguments require an analog in pin number. How would I go about wiring and programming such a gyro? Sorry in advance for my lack of knowledge in this subject, so if you guys could provide detailed help I would be grateful. I looked into using the SPI class but the notation says that it probably shouldn't be used directly, and it's just used by other devices. Thank you all in advance!

-Cinnamon Toast

juchong 04-30-2015 02:23 PM

Re: Using an SPI Gyro
 
As a collaborative effort with a few other teams, we've been working behind the scenes to put together a library for that specific sensor. Unfortunately it's only available in LabVIEW, but work is being done to port it over to C++/Java!

slibert 05-01-2015 01:06 PM

Re: Using an SPI Gyro
 
Quote:

Originally Posted by Cinnamon Toast (Post 1478818)
Hey guys,

In past years we haven't used many sensors to dictate any kind of drive control on the robot. For the most part we have always done tank drive on traction wheels or some combination of traction and omni wheels. This year we decided to have at it with an omni h drive. Moving to a little more maneuverability in our drive train made auton interesting. Using the h drive in auton often led to rotation of the whole chassis (due o the H drive not being centered perfectly combined with un equal weight distribution). The obvious way to fix this would be to use some type of gyro. I've played around with the KOP gyro and I'm not impressed. After a lot of calibration work and debugging, it still drifts way to much for my liking. After reading some of the other posts like this one,

http://www.chiefdelphi.com/forums/sh...d.php?t=130538

I think it would be a good idea to check out a gyro like the ADXRS450.

http://www.analog.com/en/products/me...-evaluationkit

I've run into a couple of problems though, most having to do with my knowledge base. First of all, I haven't worked with SPI before. From what I can tell, the gyro class that is normally used in C++ won't be applicable because initialization arguments require an analog in pin number. How would I go about wiring and programming such a gyro? Sorry in advance for my lack of knowledge in this subject, so if you guys could provide detailed help I would be grateful. I looked into using the SPI class but the notation says that it probably shouldn't be used directly, and it's just used by other devices. Thank you all in advance!

-Cinnamon Toast

If you haven't already purchased the eval kit for the ADXRS450, please consider also the navX MXP. This was released since the original article you mention above, and is a plug-n-play sensor designed specifically for use w/the RoboRIO. It's a 9-axis sensor (3 gyros, 3 accelerometers, 3 magnetometers) with a motion processor, and it provides accurate, low-drift readings for use in driving straight, as well as field-centric drive. Hundreds of these boards are in use by FIRST FRC teams, and it includes libraries for LabView, Java and C++ as well as examples and other documentation.

Cinnamon Toast 05-01-2015 06:05 PM

Re: Using an SPI Gyro
 
Quote:

Originally Posted by slibert (Post 1479273)
If you haven't already purchased the eval kit for the ADXRS450, please consider also the navX MXP. This was released since the original article you mention above, and is a plug-n-play sensor designed specifically for use w/the RoboRIO. It's a 9-axis sensor (3 gyros, 3 accelerometers, 3 magnetometers) with a motion processor, and it provides accurate, low-drift readings for use in driving straight, as well as field-centric drive. Hundreds of these boards are in use by FIRST FRC teams, and it includes libraries for LabView, Java and C++ as well as examples and other documentation.

I have not gone ahead and bought the ADXRS450 so I'll go ahead and take a look at that! Reading on the website though, it mentioned that the device plugs straight into the MXP port on the roborio. Is it possible to get an extension cord out of the MXP port so I can mount this device somewhere else in the robot? The roborio is at quite the awkward angle right now, and I believe it's actually butted against the battery when in operation. Thank you for the recommendation though!

-Cinnamon Toast

Joe Ross 05-01-2015 06:10 PM

Re: Using an SPI Gyro
 
Quote:

Originally Posted by Cinnamon Toast (Post 1479363)
Reading on the website though, it mentioned that the device plugs straight into the MXP port on the roborio. Is it possible to get an extension cord out of the MXP port so I can mount this device somewhere else in the robot? The roborio is at quite the awkward angle right now, and I believe it's actually butted against the battery when in operation.

See https://code.google.com/p/navxmxp/wi...InstallOptions

Alan Anderson 05-01-2015 06:34 PM

Re: Using an SPI Gyro
 
Quote:

Originally Posted by Cinnamon Toast (Post 1479363)
Is it possible to get an extension cord out of the MXP port so I can mount this device somewhere else in the robot?

http://www.andymark.com/product-p/am-2997.htm

otherguy 05-01-2015 10:18 PM

Re: Using an SPI Gyro
 
We used the ADXRS453 this year and wrote a class in Java to interface with it.

I've described how to use the class in another thread on CD
See the post here: http://www.chiefdelphi.com/forums/sh...94&postcount=4

The port over to C++ should be pretty straight forward.

Feel free to contact me if you have any questions. james [at] team2168.org


All times are GMT -5. The time now is 10:45 AM.

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