![]() |
Assistance with RobotBuilder and Drive
Greetings,
We're trying to use robotbuilder this year. We have PID and solenoids working, for some reason I'm having a lot of trouble getting the mecanum drivetrain code working. I followed this tutorial http://wpilib.screenstepslive.com/s/...-and-joysticks and got the drive subsystem all set. When I try to add the method to the execute() section of our DriveWithJoystick command, I get the error "No known conversion for argument 1 from 'Joystick*' to 'Joystick'. From the command DriveWithJoystick Code:
void DriveWithJoystick::Execute()In my header file for my driveSubsystem, I added this Code:
void takeJoystickInputs(Joystick stick);and finally in my driveSystem.cpp these are the two functions I added after InitDefaultCommand: Code:
void takeJoystickInputs(Joystick stick) |
Re: Assistance with RobotBuilder and Drive
Quote:
Did you mean to call getJoystick(1)? |
Re: Assistance with RobotBuilder and Drive
getJoystick1() returns a Joystick*, but I don't see a way to return the actual joystick instance instead of just a pointer
|
Re: Assistance with RobotBuilder and Drive
If you can't pass a Joystick, change the function to expect a Joystick * and change the stick.GetX() etc. to stick->GetX() instead.
|
Re: Assistance with RobotBuilder and Drive
Thanks for your help!
I changed the function to expect *Joystick and swapped the call to ->GetX() instead of .GetX() I'm down to one error - "undefined reference to `DriveSystem::takeJoystickInputs(Joystick*)" I included the drivesystem.h file in my driving command, so I'm unsure why its not defined. |
Re: Assistance with RobotBuilder and Drive
Quote:
|
Re: Assistance with RobotBuilder and Drive
This is the exact error, including the tick: undefined reference to `DriveSystem::takeJoystickInputs(Joystick*, Joystick*)'
|
Re: Assistance with RobotBuilder and Drive
Notice how for the InitDefaultCommand, the function is defined DriveSubsystem::InitDefaultCommand() { //whatever code }. (assuming you built with robotbuilder)
You need to say what class those functions are a part of, they don't know just because they have the same file name as the header file (they are becomming global functions and so are undefined when you call them as part of the DriveSubsystem class) . If the actuators you are calling functions on are part of that subsystem, you also don't need the Robot::driveSubsystem before each of them, though I suppose having it might not break it. So I think doing this in your DriveSystem.cpp might fix it: Code:
void DriveSubsystem::takeJoystickInputs(Joystick *stick)Also, is it DriveSubsystem or DriveSystem? You seem to go back and forth in your comments, just make sure it's consistent in your code :) |
| All times are GMT -5. The time now is 12:07. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi