Go to Post It only takes micro-seconds to release the magic smoke and empty the teams' budget. - Jim E [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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:12.

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