Go to Post For years, Dave Lavery couldn't fart without people trying to interpret it as a game hint. - Taylor [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 Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 22-01-2012, 00:01
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by ggorsuch View Post
You are using more than one accelerometer?
no just one, we tried both sets of 4 pins and both showed 0.
Reply With Quote
  #17   Spotlight this post!  
Unread 22-01-2012, 00:50
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Which physical slot of the cRio is the DIO module in.
By looking at your code it is in either slot 6 of 8 slot cRIO, or slot 4 of 4 slot cRIO.
Reply With Quote
  #18   Spotlight this post!  
Unread 22-01-2012, 11:20
That Canadian That Canadian is offline
Registered User
FRC #0346 (RoboHawks)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Chesterfield
Posts: 13
That Canadian is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Our team is having the same problem. We have the Accelerometer wired up correctly to the I2C slot, and the Digital Module is in cRIO slot 2. The ode should be working but we still get all 0's. I'll post our code below, maybe that may be the issue.
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.ADXL345_I2C;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends IterativeRobot {
    
    Victor leftVict, rightVict;
    Joystick leftJoy, rightJoy;
    Driver robot;
    ADXL345_I2C  Accelerometer;
    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
        System.out.println("Call init method");
        Accelerometer = new ADXL345_I2C(1,ADXL345_I2C.DataFormat_Range.k2G);
//        leftVict = new Victor(1);
//        rightVict = new Victor(2);
//        
//        leftJoy = new Joystick(1);
//        rightJoy = new Joystick(2);
//        
//        robot = new Driver(leftJoy, rightJoy, leftVict, rightVict);
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {

    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
        
//        robot.drive();
        //vict.set(leftJoy.getAxis(Joystick.AxisType.kY));
        //jag.set(leftJoy.getAxis(Joystick.AxisType.kY)); 
        System.out.println("Acceleration = " + Accelerometer.getAcceleration(ADXL345_I2C.Axes.kX));
            }
        
    }
    
}
Reply With Quote
  #19   Spotlight this post!  
Unread 23-01-2012, 20:30
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Sorry I didn't respond before, I forgot to check this thread. We're still having problems. The cable we got in the kit was broken, and we tried to fix it but ended up breaking it more. We have a different ribbon cable that was bought last year, but that doesn't seem to fix the issue.
Reply With Quote
  #20   Spotlight this post!  
Unread 23-01-2012, 20:38
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Actually, sorry, we got it to work. I replaced the round cable with a ribbon cable and moved the pwm's to the outside set of I2C ports. I think moving it to the outside is what actually fixed it, but I did both. Thanks everyone for your help!
Reply With Quote
  #21   Spotlight this post!  
Unread 24-01-2012, 20:22
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by flyvin View Post
Actually, sorry, we got it to work. I replaced the round cable with a ribbon cable and moved the pwm's to the outside set of I2C ports. I think moving it to the outside is what actually fixed it, but I did both. Thanks everyone for your help!
Actually, it definitely is the ribbon cable. Team 3504 switched out the cable but kept everything the same and it worked. So make sure you use the ribbon cable!
Reply With Quote
  #22   Spotlight this post!  
Unread 25-01-2012, 00:51
nuttle nuttle is offline
Registered User
AKA: Allen Nuttle
FRC #4080
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: United States
Posts: 104
nuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud ofnuttle has much to be proud of
Re: Accelerometer Showing All Zeros

This seems to be a common symptom, and there are probably many different underlying problems. In the case of 3504, the round cable (from prior years' KoP) was the issue. It seems to have signal integrity problems for any digital signals that change very quickly or that may not work properly in the face of noise.

It probably isn't a bad idea to keep the distance this cable has to span reasonably short and follow the suggestion in the instructions on how to rework the ribbon cable and shorten it if you're doing the rework anyway.
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 13:02.

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