Go to Post Excuse me while I rant on your comment here a bit. - Andrew Remmers [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 26-10-2016, 11:26
jvanetten jvanetten is offline
Registered User
FTC #11999
 
Join Date: Oct 2016
Location: Wyoming, MI
Posts: 4
jvanetten is an unknown quantity at this point
Hello from Team 11999!

Hello everyone.

We are a rookie team this year. I was wondering if we could get a hand with a question that has been a problem for a couple of weeks. Right now, our robot has a program that loads onto the driver station and seems to work (we can see the telemetry working for the remote and everything), but our robot does not move. I was wondering if anyone else has had this problem? Is it a problem with our code or is it a connectivity issue with the phone and the controller?

Thanks for helping out!
Reply With Quote
  #2   Spotlight this post!  
Unread 26-10-2016, 11:29
Bo8_87 Bo8_87 is offline
Registered User
no team
 
Join Date: Aug 2016
Rookie Year: 2014
Location: California
Posts: 17
Bo8_87 is an unknown quantity at this point
Re: Hello from Team 11999!

Quote:
Originally Posted by jvanetten View Post
Hello everyone.

We are a rookie team this year. I was wondering if we could get a hand with a question that has been a problem for a couple of weeks. Right now, our robot has a program that loads onto the driver station and seems to work (we can see the telemetry working for the remote and everything), but our robot does not move. I was wondering if anyone else has had this problem? Is it a problem with our code or is it a connectivity issue with the phone and the controller?

Thanks for helping out!
Could you post your code?
Reply With Quote
  #3   Spotlight this post!  
Unread 26-10-2016, 11:36
jvanetten jvanetten is offline
Registered User
FTC #11999
 
Join Date: Oct 2016
Location: Wyoming, MI
Posts: 4
jvanetten is an unknown quantity at this point
Re: Hello from Team 11999!

@TeleOp(name="Atlas: Teleop POV", group="WRW")

public class AtlasTeleop extends LinearOpMode {


HardwareAtlas robot = new HardwareAtlas();

double clawOffset = 0;
final double CLAW_SPEED = 0.02 ;


public void runOpMode() {
double left;
double right;
double max;


robot.init(hardwareMap);


telemetry.addData("Say", "Hello Atlas Driver");
telemetry.update();


waitForStart();


while (opModeIsActive()) {


left = -gamepad1.left_stick_y + gamepad1.right_stick_x;
right = -gamepad1.left_stick_y - gamepad1.right_stick_x;


max = Math.max(Math.abs(left), Math.abs(right));
if (max > 1.0)
{
left /= max;
right /= max;
}

robot.leftMotor.setPower(left);
robot.rightMotor.setPower(right);


if (gamepad1.right_bumper)
clawOffset += CLAW_SPEED;
else if (gamepad1.left_bumper)
clawOffset -= CLAW_SPEED;


clawOffset = Range.clip(clawOffset, -0.5, 0.5);
robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);
robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);


if (gamepad1.y)
robot.armMotor.setPower(robot.ARM_UP_POWER);
else if (gamepad1.a)
robot.armMotor.setPower(robot.ARM_DOWN_POWER);
else
robot.armMotor.setPower(0.0);


telemetry.addData("claw", "Offset = %.2f", clawOffset);
telemetry.addData("left", "%.2f", left);
telemetry.addData("right", "%.2f", right);
telemetry.update();


}
}
}
Reply With Quote
  #4   Spotlight this post!  
Unread 26-10-2016, 11:43
Bo8_87 Bo8_87 is offline
Registered User
no team
 
Join Date: Aug 2016
Rookie Year: 2014
Location: California
Posts: 17
Bo8_87 is an unknown quantity at this point
Re: Hello from Team 11999!

Quote:
Originally Posted by jvanetten View Post
@TeleOp(name="Atlas: Teleop POV", group="WRW")

public class AtlasTeleop extends LinearOpMode {


HardwareAtlas robot = new HardwareAtlas();

double clawOffset = 0;
final double CLAW_SPEED = 0.02 ;


public void runOpMode() {
double left;
double right;
double max;


robot.init(hardwareMap);


telemetry.addData("Say", "Hello Atlas Driver");
telemetry.update();


waitForStart();


while (opModeIsActive()) {


left = -gamepad1.left_stick_y + gamepad1.right_stick_x;
right = -gamepad1.left_stick_y - gamepad1.right_stick_x;


max = Math.max(Math.abs(left), Math.abs(right));
if (max > 1.0)
{
left /= max;
right /= max;
}

robot.leftMotor.setPower(left);
robot.rightMotor.setPower(right);


if (gamepad1.right_bumper)
clawOffset += CLAW_SPEED;
else if (gamepad1.left_bumper)
clawOffset -= CLAW_SPEED;


clawOffset = Range.clip(clawOffset, -0.5, 0.5);
robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);
robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);


if (gamepad1.y)
robot.armMotor.setPower(robot.ARM_UP_POWER);
else if (gamepad1.a)
robot.armMotor.setPower(robot.ARM_DOWN_POWER);
else
robot.armMotor.setPower(0.0);


telemetry.addData("claw", "Offset = %.2f", clawOffset);
telemetry.addData("left", "%.2f", left);
telemetry.addData("right", "%.2f", right);
telemetry.update();


}
}
}
Since you are using LinearOpMode, you need a create and call an waitForTick method in your loop.

/***
*
* waitForTick implements a periodic delay. However, this acts like a metronome with a regular
* periodic tick. This is used to compensate for varying processing times for each cycle.
* The function looks at the elapsed cycle time, and sleeps for the remaining time interval.
*
* @param periodMs Length of wait cycle in mSec.
*/
public void waitForTick(long periodMs) {

long remaining = periodMs - (long)period.milliseconds();

// sleep for the remaining portion of the regular cycle period.
if (remaining > 0) {
try {
Thread.sleep(remaining);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}

// Reset the cycle clock for the next pass.
period.reset();
}
Reply With Quote
  #5   Spotlight this post!  
Unread 26-10-2016, 11:48
jvanetten jvanetten is offline
Registered User
FTC #11999
 
Join Date: Oct 2016
Location: Wyoming, MI
Posts: 4
jvanetten is an unknown quantity at this point
Re: Hello from Team 11999!

Awesome! Thank you.
Reply With Quote
  #6   Spotlight this post!  
Unread 26-10-2016, 12:49
Daria Wing's Avatar
Daria Wing Daria Wing is offline
Registered User
FRC #2375 (Dragon Robotics)
Team Role: Engineer
 
Join Date: Sep 2014
Rookie Year: 2015
Location: Arizona
Posts: 26
Daria Wing is an unknown quantity at this point
Re: Hello from Team 11999!

I got so confused for a second because I was in FRC thinking mode and was like, 11999????? WAY too many numbers there! And then I stopped to think, and yah. I haven't slept very much lately.
Reply With Quote
  #7   Spotlight this post!  
Unread 26-10-2016, 12:53
jvanetten jvanetten is offline
Registered User
FTC #11999
 
Join Date: Oct 2016
Location: Wyoming, MI
Posts: 4
jvanetten is an unknown quantity at this point
Re: Hello from Team 11999!

Yeah we are FTC, and this is my first year in the robotics world. So far it has been exciting and fun.
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 11:37.

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