Go to Post "Why do it the easy way when you can do it the hard way?:rolleyes:" - EricH [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 17-09-2014, 09:22
Ken P. Ken P. is offline
Registered User
FRC #1189
 
Join Date: Jan 2014
Location: Grosse Pointe Farms
Posts: 11
Ken P. is an unknown quantity at this point
C++ Robot Builder question

The way that RobotBuilder sets up it references is not what I am used to using. I expected to be able to use refer to a RobotDrive method "ArcadeDrive". I typed in "robotDrive41" - the pointer to the instance of RobotDrive and expected to see the methods etc. Instead it complains that it does not know anything about robotDrive41 despite its reference earlier in the file. Any suggestions are appreciated. Here is the code:

#include "DriveTrain.h"
#include "../Robotmap.h"
#include "../Commands/ArcadeDrive.h"


DriveTrain:riveTrain() : Subsystem("DriveTrain") {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
cANJaguar1 = RobotMap::driveTrainCANJaguar1;
cANJaguar2 = RobotMap::driveTrainCANJaguar2;
cANJaguar3 = RobotMap::driveTrainCANJaguar3;
cANJaguar4 = RobotMap::driveTrainCANJaguar4;
robotDrive41 = RobotMap::driveTrainRobotDrive41;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
}

void DriveTrain::InitDefaultCommand() {
// Set the default command for a subsystem here.
//SetDefaultCommand(new MySpecialCommand());
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
SetDefaultCommand(new ArcadeDrive());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
void DriveTrain::arcadeDrive(Joystick stick) {
robotDrive41
}
Reply With Quote
  #2   Spotlight this post!  
Unread 17-09-2014, 14:03
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 258
Jefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond repute
Re: C++ Robot Builder question

Quote:
Originally Posted by Ken P. View Post
The way that RobotBuilder sets up it references is not what I am used to using. I expected to be able to use refer to a RobotDrive method "ArcadeDrive". I typed in "robotDrive41" - the pointer to the instance of RobotDrive and expected to see the methods etc. Instead it complains that it does not know anything about robotDrive41 despite its reference earlier in the file. Any suggestions are appreciated. Here is the code:

#include "DriveTrain.h"
#include "../Robotmap.h"
#include "../Commands/ArcadeDrive.h"


DriveTrain:riveTrain() : Subsystem("DriveTrain") {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
cANJaguar1 = RobotMap::driveTrainCANJaguar1;
cANJaguar2 = RobotMap::driveTrainCANJaguar2;
cANJaguar3 = RobotMap::driveTrainCANJaguar3;
cANJaguar4 = RobotMap::driveTrainCANJaguar4;
robotDrive41 = RobotMap::driveTrainRobotDrive41;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
}

void DriveTrain::InitDefaultCommand() {
// Set the default command for a subsystem here.
//SetDefaultCommand(new MySpecialCommand());
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
SetDefaultCommand(new ArcadeDrive());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
void DriveTrain::arcadeDrive(Joystick stick) {
robotDrive41
}
I'm guessing you're trying to use the period, as in robotDrive41.TankDrive(Joystick1, Joystick2)

What you need to use is the arrow to reference the functions inside RobotDrive like this...
robotDrive41->TankDrive(Joystick1, Joystick2)
Reply With Quote
  #3   Spotlight this post!  
Unread 19-09-2014, 15:17
Ken P. Ken P. is offline
Registered User
FRC #1189
 
Join Date: Jan 2014
Location: Grosse Pointe Farms
Posts: 11
Ken P. is an unknown quantity at this point
Re: C++ Robot Builder question

Thanks! I had tried it both ways but neither caused the color of the text to change and allow the editor to pull down information on the classes. At least that did not occur until I had saved the changes after using the arrows. When they typed in the text on the WPI RobotBuilder video it seemed to appear faster, so I thought something was wrong. I really appreciate your taking the time to help.
Cheers,
Ken
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 14:05.

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