Glad I have more than six weeks with you.
Home
Go Back   Chief Delphi > Technical > Programming
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 Today, 14:07
shadow.tar.gz's Avatar
shadow.tar.gz shadow.tar.gz is offline
Registered User
AKA: Manpreet Singh
FRC #3786 (Chargers)
Team Role: Mentor
 
Join Date: Feb 2017
Rookie Year: 2014
Location: Seattle
Posts: 4
shadow.tar.gz is an unknown quantity at this point
Gyroscope -> Arduino -> RoboRIO

We're trying to use a Gyroscope on our robot this year. The gyroscope we're trying to use is the Adafruit BNO055. So far, the way we're found to get information from it is with an Arduino Driver that adafruit provides. So naturally we are trying to get the data from the gyroscope with an arduino, and then trying to pipe it to the RoboRIO.

We got the arduino to read the Gyroscope no problem. But now we're trying to get the arduino to pipe the data to the RoboRIO via the I2C bus. We threw some code together, for both the RoboRIO side of things, and the Arduino side of things.

So the trouble is, we don't know how to use the Wire library on the Arduino to send the gyroscope values back to the RoboRIO when it asks for them. We got the RoboRIO to send over data to the Arduino, telling it what to send, but we can't get the arduino to send anything back.

When sending data back to the RoboRIO(the master) device, do we need to specify the address of the device? Asking since the Arduino acts as the master device to the Gyroscope, but a Slave device to the RoboRIO.

We've tried the I2C address scanner code to try and find the address for the roborRIO that way. But then we found that there was a board from Rev robotics called the RIODuino, which has example code using the I2C bus. So we found that the examples used the address of 84. We tried telling the Wire library to begin a Transmission with device 84, but that made the Arduino sketch crash.

Is it worth it to try and write our own Driver for the Gyroscope and remove the Arduino middle man altogether?
Reply With Quote
  #2   Spotlight this post!  
Unread Today, 14:10
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,133
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Gyroscope -> Arduino -> RoboRIO

Buy a NavX, avoid the headache altogether. One of the best controls investments your team can make.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #3   Spotlight this post!  
Unread Today, 14:15
Brian Michell's Avatar
Brian Michell Brian Michell is offline
Timelord and programmer
FRC #6488 (RoboRams)
Team Role: Programmer
 
Join Date: Aug 2015
Rookie Year: 2015
Location: Houston
Posts: 26
Brian Michell is an unknown quantity at this point
Re: Gyroscope -> Arduino -> RoboRIO

This year we tried to use an Arduino to send gyroscope and acrostic pinger values to the roboRIO. Using a formatted serial.out() we could pull the separate values out using a VISA read. If you're using LabVIEW, I can post some sample code we are using for autonomous when I get home.
__________________

5416
2015-Programming, Drive Coach (Worlds)
2016-Programming, Drive Coach
6488
2017-Programming
Reply With Quote
  #4   Spotlight this post!  
Unread Today, 15:05
Andrew Lobos Andrew Lobos is online now
Registered User
FRC #0225 (TechFire)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Lancaster, PA
Posts: 62
Andrew Lobos is a jewel in the roughAndrew Lobos is a jewel in the roughAndrew Lobos is a jewel in the rough
Re: Gyroscope -> Arduino -> RoboRIO

I've used the BNO055 on some personal projects involving a cRIO - here's the "driver" I wrote for talking to it (mostly based on Adafruit's python library): https://github.com/4ndr3w/BallBot/bl...ter/BNO055.cpp

Some notes if you move forward with something based on this:
  • Since this wasn't a competition robot and just a fun project, I just used while loops to structure the init process. You DO NOT want to copy-paste this as-is in your code - it will lock up if the gyro doesn't finish initializing
  • getYaw() assumes big endian
  • If I remember correctly shift-left by one is an artifact of the cRIO addressing and not required on the roboRIO

EDIT:

Just wanted to tack on that there are a ton of COTS gyro solutions that let you avoid headache, like Oblarg said:

- WCP's Spartan board with the ADXRS450 gyro (we use)
- CTRE's Pigeon IMU
- NavX
- If you're just looking to do some simple gyro turns/drive straight in auto, you could use an analog gyro and be pretty safe
__________________
2012-2014: 225 Driver, Programmer & Co-Captain
2012-2014: FTC 4977 Driver, Programmer, & Team Captain
2011: 225 Operator & Programmer

2013: FRC: Springside-Chestnut Hill Winner (w/341 & 1495), Midknight Mayhem Winner (w/316, 369, & 869), Battle O' Baltimore Winner (w/1640, 2914 & 339), Duel on the Delaware Finalist (w/816 & 369), Ramp Riot Winner (w/341, 304, & 4637) FTC: PA State Finalist
2014: FRC: Springside-Chestnut Hill Winner (w/316 & 1495), Greater DC Winner (w/1731 & 4464), Midknight Mayhem Winner (w/25, 1626 & 329) FTC: PA State Champion

Last edited by Andrew Lobos : Today at 15:17.
Reply With Quote
  #5   Spotlight this post!  
Unread Today, 15:16
wt200999's Avatar
wt200999 wt200999 is online now
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 327
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Gyroscope -> Arduino -> RoboRIO

I'm curious, if you are already using i2c, why not interface to the sensor directly?
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
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 15:30.

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