View Single Post
  #4   Spotlight this post!  
Unread 11-09-2016, 08:44 PM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
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: Robot Code Compiles but doesn't Run.

Quote:
Originally Posted by RaneLafraze View Post
We are also getting the following error:

Code:
Program "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl" not found in PATH
Other posts claim this not to be a concern. However, we haven't had any luck getting our robot to run.
It's not a concern. There's actually a way to fix it but I forget the solution atm and it doesn't matter.

Your problem is in RobotMap. More specifically, you are actually getting either zeros or garbage (I don't know the internals of GCC, so I don't know which ) when trying to access your RobotMap values. Print one and you'll see. This is because they aren't initialized.
Now why aren't RobotMap values initialized? Because you never call the constructor where you have the initializations. So you could either call the constructor before you use any RobotMap values, or (the better solution) reorganize RobotMap.

Here's how it might look instead
Code:
// RobotMap.h (get rid of RobotMap.cpp)
#pragma once

class RobotMap
{
public:
	static const int DRIVESTICK_JOYSTICK = 0;
	static const int SHOOTSTICK_JOYSTICK = 1;
	
	static const int LEFT_FRONT_MOTOR = 0;
	static const int LEFT_REAR_MOTOR = 1;
	static const int RIGHT_FRONT_MOTOR = 2;
	static const int RIGHT_REAR_MOTOR = 3;
	// and so on
};
This makes sure the variables are correctly initialized at program start, so you can use the actual values you want without further hassle.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote