Go to Post Imagine a time before alliances. A time when secrecy was rampid and the Delphi Forum was just in it's baby stage. - Andy Grady [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 01-11-2016, 14:42
RaneLafraze RaneLafraze is offline
Registered User
FRC #5712
 
Join Date: Nov 2016
Location: Michigan
Posts: 2
RaneLafraze is an unknown quantity at this point
Robot Code Compiles but doesn't Run.

Hello, folks! Our team has recently made the switch from Java to C++. (Command Based) Over the Summer offseason, we worked on "porting" our old Java code to C++. We were able to eliminate the last of the compiler errors just last week. Our code compiles and uploads to the roboRio, however, the Robot doesn't do anything. The Driver's Station opens, and the code seems to be on the robot, but the robot never moves, whether it is Autonomous or Teleop.

At this point, our team is at a dead end, and we aren't sure how to go about solving this problem. Is there an easy fix to this issue, or does it require a large amount of change and modifications? If anyone would be willing to take a look at our code on GitHub, it would be greatly appreciated! (https://github.com/Team5712/FRC_2016_Cpp)

Thanks so much in advance!
Reply With Quote
  #2   Spotlight this post!  
Unread 09-11-2016, 19:16
RaneLafraze RaneLafraze is offline
Registered User
FRC #5712
 
Join Date: Nov 2016
Location: Michigan
Posts: 2
RaneLafraze is an unknown quantity at this point
Re: Robot Code Compiles but doesn't Run.

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.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-11-2016, 20:42
ctt956 ctt956 is offline
Too many threads, too little time
FRC #0900 (♞The Zebracorns♞)
Team Role: Student
 
Join Date: Oct 2015
Rookie Year: 2016
Location: Planet Earth
Posts: 691
ctt956 is a splendid one to beholdctt956 is a splendid one to beholdctt956 is a splendid one to beholdctt956 is a splendid one to beholdctt956 is a splendid one to beholdctt956 is a splendid one to behold
Re: Robot Code Compiles but doesn't Run.

Any possibility that this is a hardware problem, or otherwise unrelated to the code? Do you have another robot you could test this on?
__________________

"You know, it's amazing how many things you can take apart with just one ordinary screwdriver!" - Calvin, from Calvin and Hobbes
"There's nothing a little duct tape and surgical tubing can't accomplish." - Sheldon J. Plankton
Reply With Quote
  #4   Spotlight this post!  
Unread 09-11-2016, 20:44
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: 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: 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
  #5   Spotlight this post!  
Unread 14-11-2016, 21:08
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Robot Code Compiles but doesn't Run.

Quote:
Originally Posted by euhlmann View Post
<snip>
^ Exactly. I'm surprised your code even compiles. You shouldn't be able to assign values to const static variables in a constructor.

It's also a little weird that your project files and directories are organized a lot like the ones RobotBuilder generates, but the code looks like it was written by hand. Any particular reason for that?
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
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 13:10.

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