Go to Post STEM: Science, Trial, Error, Math. - hrench [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
  #1   Spotlight this post!  
Unread 22-02-2016, 21:19
josephno1's Avatar
josephno1 josephno1 is offline
Registered User
FRC #3647
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: murica
Posts: 20
josephno1 is an unknown quantity at this point
ADIS16448 reading y values

Alright so I have downloaded this file
https://github.com/juchong/ADIS16448...16448_IMU.java

Anyways I want to access the method
Code:
  public synchronized double getAngleY() {
    return m_integ_gyro_y;
  }
So in my Robot.java file I added the line
Code:
SmartDashboard.putNumber("IMU",imu.getAngleY());
Here the except of the code where that is from
Code:
package org.usfirst.frc.team3647.robot;

import edu.wpi.first.wpilibj.BuiltInAccelerometer;
import edu.wpi.first.wpilibj.Compressor;
//import edu.wpi.first.wpilibj.DriverStation;
//import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.smartdashboard.*;

import org.usfirst.frc.team3647.auto.*;
import org.usfirst.frc.team3647.subsystems.ADIS16448_IMU;

//import edu.wpi.first.wpilibj.Joystick;

/**
 * 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 Robot extends IterativeRobot {

	public static boolean shootTest = false;
	public static boolean shootTest1 = false;
	
	Compressor c = new Compressor();
	
	private BuiltInAccelerometer accel = new BuiltInAccelerometer();
	ADIS16448_IMU imu=new ADIS16448_IMU();
	
	Command autonomousCommand;
	SendableChooser autoChooser;
	
	
	

	/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	public void robotInit() {
		
		updateDashboard();
		
    	autoChooser = new SendableChooser();
    	autoChooser.addDefault("Default Autonomous", new Default());
   
    	SmartDashboard.putData("Autonomous mode chooser", autoChooser);
    	
    	System.out.println("The Robot is ready");

	}

	/**
	 * This function is called periodically during autonomous
	 */
	 public void autonomousInit(){
	    	//resetAndDisableSystems();
	    	
	    	autonomousCommand = (Command) autoChooser.getSelected();
	    	autonomousCommand.start();
	    	
	    	
	    }
	
	public void autonomousPeriodic() {
		Scheduler.getInstance().run();
    	updateDashboard();
	}

	/**
	 * This function is called periodically during operator control
	 */
	public void teleopPeriodic() {
		// resetAndDisable();
		updateDashboard();
		LogitechJoystick.controllers();
		Drivetrain.arcadeDrive();
		ShooterAngleMotor.angleShooter();
		BallShooter.shootBalls();

	}

	/**
	 * This function is called periodically during test mode
	 */
	public void testPeriodic() {

	}

	public void resetAndDisable() {
		// BallShooter.LShooter.set(0);
		BallShooter.rShooter.set(0);
		ShooterAngleMotor.angle.set(0);
		// Piston.BallShooterPiston.set(0);
	}
	
	public void updateDashboard() {

		SmartDashboard.putData("IMUs", imu);
		imu.updateTable();
		SmartDashboard.putNumber("IMU",imu.getAngleY());
		System.out.println(imu.getAngleY());
	}
	}
Reply With Quote
  #2   Spotlight this post!  
Unread 23-02-2016, 05:22
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: ADIS16448 reading y values

I don't have any experience working with this sensor (my disclaimer), however in looking at the source, I did notice two things to check:
  1. Did you connect your sensor to the SPI pins on the expansion port (the MXP port)? This looks like what the default constructor expects. If you have connected your sensor to the main SPI port on the roboRIO, you may need to change line 117 in ADIS16448_IMU.java.
  2. When you put your driver station in test mode, do you see the "ADIS16448_IMU" object displayed and does it report angle information?

Finally, you may want to see if there are any error messages or stack trace dumps in the driver station console (or riolog viewer) to help track down where things are going bad.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2016, 11:27
josephno1's Avatar
josephno1 josephno1 is offline
Registered User
FRC #3647
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: murica
Posts: 20
josephno1 is an unknown quantity at this point
Re: ADIS16448 reading y values

Quote:
Originally Posted by pblankenbaker View Post
I don't have any experience working with this sensor (my disclaimer), however in looking at the source, I did notice two things to check:
  1. Did you connect your sensor to the SPI pins on the expansion port (the MXP port)? This looks like what the default constructor expects. If you have connected your sensor to the main SPI port on the roboRIO, you may need to change line 117 in ADIS16448_IMU.java.
  2. When you put your driver station in test mode, do you see the "ADIS16448_IMU" object displayed and does it report angle information?

Finally, you may want to see if there are any error messages or stack trace dumps in the driver station console (or riolog viewer) to help track down where things are going bad.
I'll try putting it on test once I get to work the robot today.
The sensor is plugged in on the custom electronics port
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 08:10.

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