![]() |
Arcade Drive Troubles in Autonomous
Hi all,
I'm almost done with reprogramming this year's robot in C++ instead of LabVIEW. The only thing holding me back from marking it done is the autonomous. In autonomous I'm telling the robot to go forward like so: Code:
static const float autonomousForwardPower = -0.5;I even tried it in teleop and it does the same thing. So, yeah - I'm confused why this is happening. Thoughts? -Tanner |
Re: Arcade Drive Troubles in Autonomous
Have you checked the hardware? Does it work if you re-load the LabVIEW code?
|
Re: Arcade Drive Troubles in Autonomous
Quote:
In teleop the code is: Code:
//Drive the robotThe LabVIEW code would probably work if I hadn't lost my flash drive with it on it. -Tanner |
Re: Arcade Drive Troubles in Autonomous
Are you using Simple Robot or Iterative Robot ?
What other code do you have in autonomous besides what you posted ? |
Re: Arcade Drive Troubles in Autonomous
Quote:
Code:
void AutonomousContinuous(void) { |
Re: Arcade Drive Troubles in Autonomous
Save what you've got, then get rid of everything in autonomous except
drivetrain->ArcadeDrive(autonomousForwardPower, 0.0); ...and see if it drives properly. If it does, then you've got a weird problem somewhere else in your code. Like for example, are you protecting kicker->Act(); from re-entering? Edit: I just saw your other post. Uncontrolled re-entry could cause a stack overflow and crash your code. |
Re: Arcade Drive Troubles in Autonomous
Quote:
-Tanner |
Re: Arcade Drive Troubles in Autonomous
re-entering is when a function is called again before it finishes being called the first time. The variables in your kicker object may not be in a clean state for the second call, causing a crash
|
Re: Arcade Drive Troubles in Autonomous
Quote:
I think though re-entering has more to do with the robot crashing than the robot not being able to drive straight from arcadeDrive(). Unless they're somehow weirdly related and the kicker is affecting the drivetrain. -Tanner |
Re: Arcade Drive Troubles in Autonomous
Quote:
Removing everything except drivetrain->ArcadeDrive(autonomousForwardPower, 0.0); and testing to see if that fixes the problem is a quick way to help pinpoint the problem. |
Re: Arcade Drive Troubles in Autonomous
Quote:
drivetrain->ArcadeDrive(autonomousForwardPower, 0.0); and see if it fixes the problem. |
Re: Arcade Drive Troubles in Autonomous
Quote:
I'm not sure how I would rethink to fix this. How would I protect the function from reentry? A google search on the topic didn't bring up anything other than NASA links. -Tanner |
Re: Arcade Drive Troubles in Autonomous
Quote:
Code:
Declare a static boolean within the method, say "kicker_busy".drivetrain->ArcadeDrive(autonomousForwardPower, 0.0); |
Re: Arcade Drive Troubles in Autonomous
Quote:
I'll take a look at that tomorrow and then get back. Thanks for the help. -Tanner |
Re: Arcade Drive Troubles in Autonomous
I suspect that your problem is that your RobotDrive class is not set up properly for the way your robot is wired (one side is either not inverted (using RobotDrive::SetInvertedMotor()), or inverted when it shouldn't be).
It's probably just working in teleop mode by lucky coincidence, because your joystick setup looks strange - you're feeding what seems to be the twist axis (4) into the moveValue parameter of ArcadeDrive, and the Y-axis (2) into the rotateValue parameter. I doubt the non-reentrancy of your kicker function is the issue, because non-reentrant functions only cause problems when they're called more than once at the same time (i.e. by different threads), and I'm pretty sure all the Periodic/Continuous methods in IterativeRobot execute in the same thread. |
| All times are GMT -5. The time now is 12:32. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi