View Single Post
  #1   Spotlight this post!  
Unread 01-17-2016, 07:54 PM
rod@3711 rod@3711 is offline
Registered User
AKA: rod nelson
FRC #3711 (Iron Mustangs)
Team Role: Mentor
 
Join Date: May 2014
Rookie Year: 2014
Location: Trout Lake, WA
Posts: 64
rod@3711 is an unknown quantity at this point
Shared pointers? Unique pointers?

We're having some issues getting the code to work. It seems that this year's coding approach is different than last year's.
What are shared pointers for?
The problem arose when we were attempting to get the value of the joystick.

Code:
void Chassis::SixDrive(std::shared_ptr<Joystick>& stickPosition){  
	tankdrive->ArcadeDrive(stickPosition->GetX(), stickPosition->GetZ());
}
Code:
void Drivewithjoystick::Execute() {
	Robot::chassis->SixDrive(Robot::oi->getDriveJoystick());
}
This is where our problem is, when referencing the drivejoystick, it seems we have a shared_ptr issue.

Declaration of the joystick
Code:
std::shared_ptr<Joystick> OI::getDriveJoystick() {
   return driveJoystick;
}

Thank you!
Reply With Quote