mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Fixed a few bugs with C++ due to the merge.
Change-Id: I6c5120ff502b40ecba0884f5a3631fa91822cfd4
This commit is contained in:
@@ -228,7 +228,7 @@
|
||||
<shortcut
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.launching.SimulateLaunchShortcut"
|
||||
description="Test the WPILib project using the Gazebo simulator."
|
||||
icon="resources/icons/wpi.ico"
|
||||
icon="resources/icons/Gazebo.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.launching.simulate"
|
||||
label="WPILib C++ Simulation"
|
||||
modes="run,debug">
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 780 B |
@@ -28,6 +28,7 @@
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.549514425" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1682909384" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1597382905" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/src""/>
|
||||
<listOptionValue builtIn="false" value="$cpp-location/include"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.963785380" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
@@ -38,7 +39,9 @@
|
||||
<listOptionValue builtIn="false" value="$cpp-location/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.libs.1072058280" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="WPILibAthena"/>
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="HALAthena"/>
|
||||
<listOptionValue builtIn="false" value="NetworkTables"/>
|
||||
<listOptionValue builtIn="false" value="FRC_NetworkCommunication"/>
|
||||
@@ -167,7 +170,9 @@
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.66697269" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
|
||||
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cpp.linker.base.2094820582" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
|
||||
<option id="gnu.cpp.link.option.libs.1563598353" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="WPILibSim"/>
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="gazebo"/>
|
||||
<listOptionValue builtIn="false" value="gazebo_transport"/>
|
||||
<listOptionValue builtIn="false" value="gazebo_msgs"/>
|
||||
|
||||
@@ -4,9 +4,9 @@ allwpilib=../..
|
||||
package-version = 1
|
||||
gazebo-plugins-version = 0.2
|
||||
gazebo-plugins-package-version = $(gazebo-plugins-version)-$(package-version)
|
||||
gazebo-models-version = 0.2
|
||||
gazebo-models-version = 0.3
|
||||
gazebo-models-package-version = $(gazebo-models-version)-$(package-version)
|
||||
gazebo-models-orig-url = https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1052?dl=1
|
||||
gazebo-models-orig-url = https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1070?dl=1
|
||||
eclipse-plugins-version = 0.1
|
||||
eclipse-plugins-package-version = $(eclipse-plugins-version)-$(package-version)
|
||||
eclipse-toolchain-version = 0.1
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
frcsim-gazebo-models (0.3-1) trusty; urgency=medium
|
||||
|
||||
* Fixed GearsBot gyro
|
||||
|
||||
-- Alex Henning <alex@thoriumrobotics.com> Tue, 12 Aug 2014 09:32:27 -0400
|
||||
|
||||
frcsim-gazebo-models (0.2-1) trusty; urgency=medium
|
||||
|
||||
* New models using the smaller plugins
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<mkdir dir="${project.build.directory}/sim-includes/sim/include"/>
|
||||
<copy todir="${project.build.directory}/sim-includes/sim/include">
|
||||
<fileset dir="include"/>
|
||||
<fileset dir="../wpilibC++/include"/>
|
||||
<fileset dir="../../networktables/cpp/include"/>
|
||||
<fileset dir="../../hal/include"/>
|
||||
</copy>
|
||||
|
||||
@@ -14,3 +14,4 @@ clean:
|
||||
install: all
|
||||
mkdir -p $(DESTDIR)$(lib.dir)
|
||||
install $(build.dir)/libWPILibSim.so $(DESTDIR)$(lib.dir)
|
||||
install $(build.dir)/build/wpilibC++/libWPILib.a $(DESTDIR)$(lib.dir)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<mkdir dir="${project.build.directory}/sim-includes/sim/include"/>
|
||||
<copy todir="${project.build.directory}/sim-includes/sim/include">
|
||||
<fileset dir="include"/>
|
||||
<fileset dir="../wpilibC++/include"/>
|
||||
<fileset dir="../../networktables/cpp/include"/>
|
||||
<fileset dir="../../hal/include"/>
|
||||
</copy>
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "Error.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "Timer.h"
|
||||
#include "Utility.h"
|
||||
|
||||
bool Error::m_suspendOnErrorEnabled = false;
|
||||
|
||||
Error::Error()
|
||||
: m_code(0)
|
||||
, m_lineNumber(0)
|
||||
, m_originatingObject(NULL)
|
||||
, m_timestamp (0.0)
|
||||
{}
|
||||
|
||||
Error::~Error()
|
||||
{}
|
||||
|
||||
void Error::Clone(Error &error)
|
||||
{
|
||||
m_code = error.m_code;
|
||||
m_message = error.m_message;
|
||||
m_filename = error.m_filename;
|
||||
m_function = error.m_function;
|
||||
m_lineNumber = error.m_lineNumber;
|
||||
m_originatingObject = error.m_originatingObject;
|
||||
m_timestamp = error.m_timestamp;
|
||||
}
|
||||
|
||||
Error::Code Error::GetCode() const
|
||||
{ return m_code; }
|
||||
|
||||
const char * Error::GetMessage() const
|
||||
{ return m_message.c_str(); }
|
||||
|
||||
const char * Error::GetFilename() const
|
||||
{ return m_filename.c_str(); }
|
||||
|
||||
const char * Error::GetFunction() const
|
||||
{ return m_function.c_str(); }
|
||||
|
||||
uint32_t Error::GetLineNumber() const
|
||||
{ return m_lineNumber; }
|
||||
|
||||
const ErrorBase* Error::GetOriginatingObject() const
|
||||
{ return m_originatingObject; }
|
||||
|
||||
double Error::GetTime() const
|
||||
{ return m_timestamp; }
|
||||
|
||||
void Error::Set(Code code, const char* contextMessage, const char* filename, const char* function, uint32_t lineNumber, const ErrorBase* originatingObject)
|
||||
{
|
||||
m_code = code;
|
||||
m_message = contextMessage;
|
||||
m_filename = filename;
|
||||
m_function = function;
|
||||
m_lineNumber = lineNumber;
|
||||
m_originatingObject = originatingObject;
|
||||
m_timestamp = GetTime();
|
||||
|
||||
Report();
|
||||
|
||||
// XXX: BROKEN! if (m_suspendOnErrorEnabled) suspendTask(0);
|
||||
}
|
||||
|
||||
void Error::Report()
|
||||
{
|
||||
// Error string buffers
|
||||
char *error = new char[256];
|
||||
char *error_with_code = new char[256];
|
||||
|
||||
// Build error strings
|
||||
if (m_code != -1)
|
||||
{
|
||||
snprintf(error, 256, "%s: status = %d (0x%08X) %s ...in %s() in %s at line %d\n",
|
||||
m_code < 0 ? "ERROR" : "WARNING", (int32_t)m_code, (uint32_t)m_code, m_message.c_str(),
|
||||
m_function.c_str(), m_filename.c_str(), m_lineNumber);
|
||||
sprintf(error_with_code,"<Code>%d %s", (int32_t)m_code, error);
|
||||
} else {
|
||||
snprintf(error, 256, "ERROR: %s ...in %s() in %s at line %d\n", m_message.c_str(),
|
||||
m_function.c_str(), m_filename.c_str(), m_lineNumber);
|
||||
strcpy(error_with_code, error);
|
||||
}
|
||||
// TODO: Add logging to disk
|
||||
|
||||
delete [] error_with_code;
|
||||
|
||||
// Print to console
|
||||
printf("\n\n>>>>%s", error);
|
||||
|
||||
delete [] error;
|
||||
|
||||
// printf("-----------<Stack Trace>----------------\n");
|
||||
// printCurrentStackTrace();
|
||||
}
|
||||
|
||||
void Error::Clear()
|
||||
{
|
||||
m_code = 0;
|
||||
m_message = "";
|
||||
m_filename = "";
|
||||
m_function = "";
|
||||
m_lineNumber = 0;
|
||||
m_originatingObject = NULL;
|
||||
m_timestamp = 0.0;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,14 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <execinfo.h>
|
||||
#include <cxxabi.h>
|
||||
|
||||
static bool stackTraceEnabled = false;
|
||||
static bool suspendOnAssertEnabled = false;
|
||||
|
||||
@@ -162,3 +170,57 @@ uint32_t GetFPGATime()
|
||||
return wpilib::internal::simTime * 1e6;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Demangle a C++ symbol, used for printing stack traces.
|
||||
*/
|
||||
static std::string demangle(char const *mangledSymbol)
|
||||
{
|
||||
char buffer[256];
|
||||
size_t length;
|
||||
int status;
|
||||
|
||||
if(sscanf(mangledSymbol, "%*[^(]%*[^_]%255[^)+]", buffer))
|
||||
{
|
||||
char *symbol = abi::__cxa_demangle(buffer, NULL, &length, &status);
|
||||
|
||||
if(status == 0)
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the symbol couldn't be demangled, it's probably a C function,
|
||||
// so just return it as-is.
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
// If everything else failed, just return the mangled symbol
|
||||
return mangledSymbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a stack trace, ignoring the first "offset" symbols.
|
||||
*/
|
||||
std::string GetStackTrace(uint32_t offset)
|
||||
{
|
||||
void *stackTrace[128];
|
||||
int stackSize = backtrace(stackTrace, 128);
|
||||
char **mangledSymbols = backtrace_symbols(stackTrace, stackSize);
|
||||
std::stringstream trace;
|
||||
|
||||
for(int i = offset; i < stackSize; i++)
|
||||
{
|
||||
// Only print recursive functions once in a row.
|
||||
if(i == 0 ||stackTrace[i] != stackTrace[i - 1])
|
||||
{
|
||||
trace << "\tat " << demangle(mangledSymbols[i]) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
free(mangledSymbols);
|
||||
|
||||
return trace.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@ SimGyro::SimGyro(std::string topic) {
|
||||
velSub = MainNode::Subscribe("~/simulator/"+topic+"/velocity",
|
||||
&SimGyro::velocityCallback, this);
|
||||
|
||||
commandPub->WaitForConnection();
|
||||
|
||||
std::cout << "Initialized ~/simulator/"+topic << std::endl;
|
||||
if (commandPub->WaitForConnection(gazebo::common::Time(5.0))) { // Wait up to five seconds.
|
||||
std::cout << "Initialized ~/simulator/" + topic << std::endl;
|
||||
} else {
|
||||
std::cerr << "Failed to initialize ~/simulator/" + topic + ": does the gyro exist?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void SimGyro::Reset() {
|
||||
|
||||
Reference in New Issue
Block a user