Go to Post The most amazing and inspiring character I've met in FIRST, Wayne [Cokeley] has definately shown me the character of a true leader. - Bharat Nain [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 29-01-2017, 08:30
TakeItEasy TakeItEasy is offline
Registered User
FRC #3034
 
Join Date: Jan 2017
Location: Israel
Posts: 2
TakeItEasy is an unknown quantity at this point
Exclamation accelerometer return acceleration 0

Today I tried to program the "FRC GYRO & ACCEL" we got on FIRST CHOICE. It is a On-Board accelerometer and gyro. the gyro work fine but the accelerometer always returns me 0 XYZ. The robot drove about 5m and noting changes. I used the ADXL362 class at the wpilib and tried all the functions to read the acceloration. Also tried to chage the sesor to another one. Help please.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2017, 22:27
acastagna acastagna is offline
Registered User
FRC #1493
 
Join Date: Jan 2012
Location: Albany High School
Posts: 38
acastagna is an unknown quantity at this point
Re: accelerometer return acceleration 0

Post your code
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2017, 02:48
TakeItEasy TakeItEasy is offline
Registered User
FRC #3034
 
Join Date: Jan 2017
Location: Israel
Posts: 2
TakeItEasy is an unknown quantity at this point
Re: accelerometer return acceleration 0

Quote:
Originally Posted by acastagna View Post
Post your code
Code:
public class Robot extends IterativeRobot {
	RobotDrive myRobot;
	Joystick joystick;
	ADXL362  acc;
	CANTalon[] drive = new CANTalon[4];
	
	@Override
	public void robotInit() 
	{
		for(int i = 1; i < 5; i++)drive[i-1] = new CANTalon(i);
		myRobot = new RobotDrive(drive[2],drive[0]);
		joystick = new Joystick(0);
		acc = new ADXL362(Accelerometer.Range.k4G);
	}

	@Override
	public void autonomousInit() {
		
	}

	@Override
	public void autonomousPeriodic() {

	}

	@Override
	public void teleopInit() {
	}

	@Override
	public void teleopPeriodic() {
		myRobot.arcadeDrive(joystick);
		if(acc.getX() != 0)System.out.println("X " + acc.getX());
		if(acc.getY() != 0)System.out.println("Y " + acc.getY());
		if(acc.getZ() != 0)System.out.println("Z " + acc.getZ());
	}

	@Override
	public void testPeriodic() {
		LiveWindow.run();
	}
}
i tried this code for testing but it doesnt print anything.
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 09:46.

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