mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
merged from frcsim branch
verified to work on real robots adds sim eclipse plugins, fixed JavaGazebo, made wpilibC++Sim build on windows - Java and C++ simulation robot programs run on windows - simulation eclipse plugin delivers models and gazebo plugins - Java Gazebo now respects GAZEBO_IP variables and can work across networks - hal and network tables win32 hacked to work on windows - smart dashboard broken on windows due to network tables hacks - wpilibC++Sim, gz_msgs, and frcsim_gazebo_plugins build with CMake - removed constexpr for cross platform compatibility - msgs generated using .protos as a part of build process - some spare and unused cmake/pom files deleted - simulation ubuntu debians removed entirely - refactored CMake project flags and macros - updated to match non-sim C++ API - fixed and updated documentation - servo added to simulation Change-Id: Ia702ff0f1fee10d77f543810ad88f56696443b05
This commit is contained in:
@@ -10,31 +10,6 @@
|
||||
#define NT_CRITICAL_REGION(s) { NTSynchronized _sync(s);
|
||||
#define NT_END_REGION }
|
||||
|
||||
#if defined WIN32
|
||||
|
||||
#include <semLib.h>
|
||||
|
||||
class NTReentrantSemaphore
|
||||
{
|
||||
public:
|
||||
explicit NTReentrantSemaphore(){
|
||||
m_semaphore = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);
|
||||
};
|
||||
~NTReentrantSemaphore(){
|
||||
semDelete(m_semaphore);
|
||||
};
|
||||
void take(){
|
||||
semTake(m_semaphore, WAIT_FOREVER);
|
||||
};
|
||||
void give(){
|
||||
semGive(m_semaphore);
|
||||
};
|
||||
private:
|
||||
SEM_ID m_semaphore;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class NTReentrantSemaphore
|
||||
@@ -59,7 +34,6 @@ private:
|
||||
pthread_mutexattr_t mta;
|
||||
pthread_mutex_t m_semaphore;
|
||||
};
|
||||
#endif // WIN32
|
||||
|
||||
/**
|
||||
* Provide easy support for critical regions.
|
||||
@@ -76,18 +50,9 @@ class NTSynchronized
|
||||
public:
|
||||
explicit NTSynchronized(NTReentrantSemaphore&);
|
||||
//TODO remove vxworks SEM_ID support
|
||||
#if defined WIN32
|
||||
explicit NTSynchronized(SEM_ID);
|
||||
#endif
|
||||
virtual ~NTSynchronized();
|
||||
private:
|
||||
#if defined WIN32
|
||||
bool usingSem;
|
||||
NTReentrantSemaphore* m_sem;
|
||||
SEM_ID m_semaphore;
|
||||
#else
|
||||
NTReentrantSemaphore& m_semaphore;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,75 +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. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __NTTASK_H__
|
||||
#define __NTTASK_H__
|
||||
|
||||
#if defined WIN32
|
||||
|
||||
#include "NTErrorBase.h"
|
||||
|
||||
/**
|
||||
* WPI task is a wrapper for the native Task object.
|
||||
* All WPILib tasks are managed by a static task manager for simplified cleanup.
|
||||
**/
|
||||
class NTTask : public ErrorBase
|
||||
{
|
||||
public:
|
||||
static const UINT32 kDefaultPriority = 101;
|
||||
static const INT32 kInvalidTaskID = -1;
|
||||
|
||||
NTTask(const char* name, FUNCPTR function, INT32 priority = kDefaultPriority, UINT32 stackSize = 20000);
|
||||
virtual ~NTTask();
|
||||
|
||||
NTTask(const NTTask&) = delete;
|
||||
NTTask& operator=(const NTTask&) = delete;
|
||||
|
||||
#ifdef WIN32
|
||||
bool Start(void * arg0);
|
||||
#else
|
||||
bool Start(UINT32 arg0 = 0, UINT32 arg1 = 0, UINT32 arg2 = 0, UINT32 arg3 = 0, UINT32 arg4 = 0,
|
||||
UINT32 arg5 = 0, UINT32 arg6 = 0, UINT32 arg7 = 0, UINT32 arg8 = 0, UINT32 arg9 = 0);
|
||||
#endif
|
||||
|
||||
bool Restart();
|
||||
bool Stop();
|
||||
|
||||
bool IsReady();
|
||||
bool IsSuspended();
|
||||
|
||||
bool Suspend();
|
||||
bool Resume();
|
||||
|
||||
bool Verify();
|
||||
|
||||
INT32 GetPriority();
|
||||
bool SetPriority(INT32 priority);
|
||||
const char* GetName();
|
||||
INT32 GetID();
|
||||
|
||||
#ifdef WIN32
|
||||
FUNCPTR m_function;
|
||||
void * m_Arg;
|
||||
#endif
|
||||
private:
|
||||
char* m_taskName;
|
||||
|
||||
#ifdef WIN32
|
||||
bool StartInternal();
|
||||
HANDLE m_Handle;
|
||||
DWORD m_ID;
|
||||
#else
|
||||
FUNCPTR m_function;
|
||||
INT32 m_taskID;
|
||||
#endif
|
||||
|
||||
UINT32 m_stackSize;
|
||||
INT32 m_priority;
|
||||
bool HandleError(STATUS results);
|
||||
};
|
||||
|
||||
#endif // WIN32
|
||||
#endif // __TASK_H__
|
||||
Reference in New Issue
Block a user