Go to Post Sometimes the best hiding places are in plain sight. - Robert Cawthon [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 15-02-2016, 16:16
dibblec's Avatar
dibblec dibblec is offline
Registered User
AKA: Mr. C
FRC #4824 (BerryBotics)
Team Role: Mentor
 
Join Date: Dec 2013
Rookie Year: 2013
Location: Indiana
Posts: 20
dibblec is an unknown quantity at this point
Need Assistance: Issues with Robot Builder and code errors

This is also posted on FIRST Forums, but with time winding down trying to get our programmers as much help as possible.

Our students are working with C++ this year. They have been able to get a robot that drives with the help from a mentor early on using iterative setup . They have been trying to use Robot Builder to speed up the process with our subsystems. They can create a new project, launch Robot Builder add subsystems and update the project. From there they get errors and cannot get a driving robot. We have watched the YouTube video (based around Java) to try to help, but like most resources does not give a full picture. They have looked at sample code from other teams, with not luck. The good/bad of C++ different ways to approach the same task. Here is some of the errors:

This is a four motor drive train:
1) In RobotMap.cpp, they get the error that "RobotMap has not been declared and Member declaration not found" with this line of code: std::shared_ptr<SpeedController> RobotMap::driveTrainTalon1;
2) In DriveTrain.cpp they get the error "symbol driveTrainTalon1 could not be resolved" with this line of code: talon1 = RobotMap::driveTrainTalon1;
3) In RobotMap.cpp getting error on "LiveWindow *lw = LiveWindow::GetInstance();" it says "Function 'GetInstance' could not be resolved.
4) In RobotMap.cpp getting error on driveTrainTalon1.reset(new Talon(0)); "Method 'reset' could not be resolved".

Again, I know this is not a complete picture, however maybe these are common errors that someone may have an answer for. Here is the first part of RobotMap.cpp:


#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"


// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
std::shared_ptr<SpeedController> RobotMap::driveTrainTalon1;
std::shared_ptr<SpeedController> RobotMap::driveTrainTalon2;
std::shared_ptr<SpeedController> RobotMap::driveTrainTalon3;
std::shared_ptr<SpeedController> RobotMap::driveTrainTalon4;
std::shared_ptr<RobotDrive> RobotMap::driveTrainRobotDrive;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION

void RobotMap::init() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
LiveWindow *lw = LiveWindow::GetInstance();

driveTrainTalon1.reset(new Talon(0));
lw->AddActuator("Drive Train", "Talon 1", std::static_pointer_cast<Talon>(driveTrainTalon1)) ;
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2016, 21:07
euhlmann's Avatar
euhlmann euhlmann is online now
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 322
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Need Assistance: Issues with Robot Builder and code errors

Are these errors from eclipse or from the build?

If it builds you can ignore eclipse errors.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2016, 08:30
dibblec's Avatar
dibblec dibblec is offline
Registered User
AKA: Mr. C
FRC #4824 (BerryBotics)
Team Role: Mentor
 
Join Date: Dec 2013
Rookie Year: 2013
Location: Indiana
Posts: 20
dibblec is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

These are all in Eclipse. I don't recall if it builds as they have tried many different combinations. We will give it a try tonight. Thank you.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2016, 08:58
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

Sometimes rebuilding the index eliminates these false errors.

Right click on the project folder in eclipse and select Index->Rebuild
Reply With Quote
  #5   Spotlight this post!  
Unread 16-02-2016, 13:49
dibblec's Avatar
dibblec dibblec is offline
Registered User
AKA: Mr. C
FRC #4824 (BerryBotics)
Team Role: Mentor
 
Join Date: Dec 2013
Rookie Year: 2013
Location: Indiana
Posts: 20
dibblec is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

Good tip, but we have tried that numerous times. Has not helped.
Reply With Quote
  #6   Spotlight this post!  
Unread 16-02-2016, 16:12
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

Sounds like these are real compiler or linker errors. Definitely check the "Console" output instead of "Problems"

At first glance it looks like something in Robotmap.h could be messed up since all the errors you list make use of robotmap. Could you post the .h and .cpp of those. Someone might have butterfingered in the file or robot build might have a bug when it generated the robotmap.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-02-2016, 16:19
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

Here is the same snippet from my RobotMap.cpp
Code:
// RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// C++ from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"


// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
std::shared_ptr<CANTalon> RobotMap::driveTrainCANTalonRight;
std::shared_ptr<CANTalon> RobotMap::driveTrainCANTalonLeft;
std::shared_ptr<RobotDrive> RobotMap::driveTrainRobotDrive;
std::shared_ptr<AnalogGyro> RobotMap::driveTrainGyro;
std::shared_ptr<AnalogInput> RobotMap::driveTrainMaxSonarAI;
std::shared_ptr<SpeedController> RobotMap::shooterElevationMotor;
std::shared_ptr<SpeedController> RobotMap::shooterFlyWheelMotor;
std::shared_ptr<SpeedController> RobotMap::shooterHookMotor;
std::shared_ptr<Encoder> RobotMap::shooterElevationEncoder;
std::shared_ptr<DigitalInput> RobotMap::shooterElevationHome;
std::shared_ptr<DigitalInput> RobotMap::shooterElevationMax;
std::shared_ptr<DigitalInput> RobotMap::shooterHookHome;
std::shared_ptr<DigitalInput> RobotMap::shooterHookMax;
std::shared_ptr<SpeedController> RobotMap::shooterBallKicker;
std::shared_ptr<DigitalInput> RobotMap::shooterBallSensor;

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION

void RobotMap::init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    LiveWindow *lw = LiveWindow::GetInstance();

    driveTrainCANTalonRight.reset(new CANTalon(2));
    lw->AddActuator("Drive Train", "CAN Talon Right", driveTrainCANTalonRight);
    
    driveTrainCANTalonLeft.reset(new CANTalon(1));
    lw->AddActuator("Drive Train", "CAN Talon Left", driveTrainCANTalonLeft);
    
    driveTrainRobotDrive.reset(new RobotDrive(driveTrainCANTalonLeft, driveTrainCANTalonRight));
    
    driveTrainRobotDrive->SetSafetyEnabled(false);
        driveTrainRobotDrive->SetExpiration(0.5);
        driveTrainRobotDrive->SetSensitivity(0.5);
        driveTrainRobotDrive->SetMaxOutput(1.0);

    driveTrainGyro.reset(new AnalogGyro(0));
    lw->AddSensor("Drive Train", "Gyro", driveTrainGyro);
    driveTrainGyro->SetSensitivity(0.007);
    driveTrainMaxSonarAI.reset(new AnalogInput(2));
    lw->AddSensor("Drive Train", "Max Sonar AI", driveTrainMaxSonarAI);
    
    shooterElevationMotor.reset(new Talon(1));
    lw->AddActuator("Shooter", "Elevation Motor", std::static_pointer_cast<Talon>(shooterElevationMotor));
    
    shooterFlyWheelMotor.reset(new Talon(0));
    lw->AddActuator("Shooter", "Fly Wheel Motor", std::static_pointer_cast<Talon>(shooterFlyWheelMotor));
    
    shooterHookMotor.reset(new Talon(3));
    lw->AddActuator("Shooter", "Hook Motor", std::static_pointer_cast<Talon>(shooterHookMotor));
    
    shooterElevationEncoder.reset(new Encoder(2, 3, false, Encoder::k4X));
    lw->AddSensor("Shooter", "Elevation Encoder", shooterElevationEncoder);
    shooterElevationEncoder->SetDistancePerPulse(1.0);
    shooterElevationEncoder->SetPIDSourceType(PIDSourceType::kRate);
    shooterElevationHome.reset(new DigitalInput(0));
    lw->AddSensor("Shooter", "Elevation Home", shooterElevationHome);
    
    shooterElevationMax.reset(new DigitalInput(1));
    lw->AddSensor("Shooter", "Elevation Max", shooterElevationMax);
    
    shooterHookHome.reset(new DigitalInput(5));
    lw->AddSensor("Shooter", "Hook Home", shooterHookHome);
    
    shooterHookMax.reset(new DigitalInput(6));
    lw->AddSensor("Shooter", "Hook Max", shooterHookMax);
    
    shooterBallKicker.reset(new Talon(2));
    lw->AddActuator("Shooter", "Ball Kicker", std::static_pointer_cast<Talon>(shooterBallKicker));
    
    shooterBallSensor.reset(new DigitalInput(4));
    lw->AddSensor("Shooter", "Ball Sensor", shooterBallSensor);
    


    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
Reply With Quote
  #8   Spotlight this post!  
Unread 16-02-2016, 16:20
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: Need Assistance: Issues with Robot Builder and code errors

Here is RobotMap.h
Code:
// RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// C++ from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


#ifndef ROBOTMAP_H
#define ROBOTMAP_H
#include "WPILib.h"


/**
 * The RobotMap is a mapping from the ports sensors and actuators are wired into
 * to a variable name. This provides flexibility changing wiring, makes checking
 * the wiring easier and significantly reduces the number of magic numbers
 * floating around.
 */
class RobotMap {
public:
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	static std::shared_ptr<CANTalon> driveTrainCANTalonRight;
	static std::shared_ptr<CANTalon> driveTrainCANTalonLeft;
	static std::shared_ptr<RobotDrive> driveTrainRobotDrive;
	static std::shared_ptr<AnalogGyro> driveTrainGyro;
	static std::shared_ptr<AnalogInput> driveTrainMaxSonarAI;
	static std::shared_ptr<SpeedController> shooterElevationMotor;
	static std::shared_ptr<SpeedController> shooterFlyWheelMotor;
	static std::shared_ptr<SpeedController> shooterHookMotor;
	static std::shared_ptr<Encoder> shooterElevationEncoder;
	static std::shared_ptr<DigitalInput> shooterElevationHome;
	static std::shared_ptr<DigitalInput> shooterElevationMax;
	static std::shared_ptr<DigitalInput> shooterHookHome;
	static std::shared_ptr<DigitalInput> shooterHookMax;
	static std::shared_ptr<SpeedController> shooterBallKicker;
	static std::shared_ptr<DigitalInput> shooterBallSensor;

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS

	static void init();
};
#endif
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 12:14.

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