Pull request for the Extensions interface only (#655)

* Modify halsim to be able to load extension libraries if they are available.

It will read the list of libraries to try from the HALSIM_EXTENSIONS
environment variable.  Multiple libraries can be given if separated
by ';' (Windows) or ':' (Unix).

The library must have an 'HALSIM_InitExtension' method that returns >= 0 on success.

The library is expected to use the interface expressed by
  hal/src/src/main/native/include/MockData

* Add a simple halsim library that just prints robot values.

This makes a good test bed for cross platform purposes,
and provides the ultimate in light weight simulators.

This initial version only prints PWM values.
This commit is contained in:
Jeremy White
2017-10-18 02:27:55 -05:00
committed by Peter Johnson
parent 2fc60680f4
commit be77f9cb26
11 changed files with 284 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017 FIRST. 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 the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
/**
* HAL Simulator Extensions are libraries that provide additional simulator
* functionality, such as a Gazebo interface, or a more light weight simulation.
*
* An extension must expose the HALSIM_InitExtension entry point which is
* invoked after the library is loaded.
*
* The entry point is expected to return < 0 for errors that should stop
* the HAL completely, 0 for success, and > 0 for a non fatal error.
*/
typedef int halsim_extension_init_func_t(void);
extern "C" {
int HAL_LoadOneExtension(const char* library);
int HAL_LoadExtensions(void);
}