Files
allwpilib/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp

44 lines
1.7 KiB
C++
Raw Normal View History

/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 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. */
/*----------------------------------------------------------------------------*/
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
#include "AnalogPotentiometer.h"
#include "RobotController.h"
#include "SmartDashboard/SendableBuilder.h"
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
using namespace frc;
AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange,
artf4154: Get rid of raw pointers in C++. This deals with the majority of the user-facing code in wpilibC++Devices and a substantial portion of it in wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests are untouched except where it is necessary to make them work with the rest of the libraries. There is still a lot to do in the following areas: -The HAL (which we may not want to touch at all). -The I2C, Serial, and SPI interfaces in wpilibC++Devices, which I haven't gotten around to doing yet. -Most wpilibC++Devices classes have void* pointers for interacting with the HAL. -InterruptableSensorBase passes a void *params for the interrupt handler. -I haven't converted all the const char* to std::strings. -There are plenty of other cases of raw pointers still existing. -This doesn't fall directly under raw pointer stuff, but move syntax and rvalue references could be introduced in many places. -I haven't touched vision code. -The Resource classes conflict (one is in the hal, the other in wpilibC++). Someone should figure out a more permanent fix (eg, just renaming them), then doing what I did (making a new namespace for one of them, essentially the same as renaming it). A few other things: -I created a NullDeleter class which is marked as deprecated. What this does is it can be passed as the deleter to a std::shared_ptr so that when you are converting raw pointers to shared_ptrs the shared_ptr doesn't do any deletion if someone else owns the raw pointer. This should only be used in making old raw pointer UIs. -I had to alter the build.gradle so that it did not emit errors when deprecated functions called deprecated functions. Unfortunately, gradle doesn't appear to be actually printing out gcc warnigns for some reason. The best way I have found to fix this is to patch the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff) so that a deprecated function calling a deprecated function is fine but a non-deprecated function calling a deprecated function will throw a warning (which we then elevate with -Werror). I believe that clang deals with this properly, although I have not tried it myself. Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
double offset)
: m_analog_input(std::make_shared<AnalogInput>(channel)),
artf4154: Get rid of raw pointers in C++. This deals with the majority of the user-facing code in wpilibC++Devices and a substantial portion of it in wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests are untouched except where it is necessary to make them work with the rest of the libraries. There is still a lot to do in the following areas: -The HAL (which we may not want to touch at all). -The I2C, Serial, and SPI interfaces in wpilibC++Devices, which I haven't gotten around to doing yet. -Most wpilibC++Devices classes have void* pointers for interacting with the HAL. -InterruptableSensorBase passes a void *params for the interrupt handler. -I haven't converted all the const char* to std::strings. -There are plenty of other cases of raw pointers still existing. -This doesn't fall directly under raw pointer stuff, but move syntax and rvalue references could be introduced in many places. -I haven't touched vision code. -The Resource classes conflict (one is in the hal, the other in wpilibC++). Someone should figure out a more permanent fix (eg, just renaming them), then doing what I did (making a new namespace for one of them, essentially the same as renaming it). A few other things: -I created a NullDeleter class which is marked as deprecated. What this does is it can be passed as the deleter to a std::shared_ptr so that when you are converting raw pointers to shared_ptrs the shared_ptr doesn't do any deletion if someone else owns the raw pointer. This should only be used in making old raw pointer UIs. -I had to alter the build.gradle so that it did not emit errors when deprecated functions called deprecated functions. Unfortunately, gradle doesn't appear to be actually printing out gcc warnigns for some reason. The best way I have found to fix this is to patch the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff) so that a deprecated function calling a deprecated function is fine but a non-deprecated function calling a deprecated function will throw a warning (which we then elevate with -Werror). I believe that clang deals with this properly, although I have not tried it myself. Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
m_fullRange(fullRange),
m_offset(offset) {
AddChild(m_analog_input);
}
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
AnalogPotentiometer::AnalogPotentiometer(AnalogInput* input, double fullRange,
artf4154: Get rid of raw pointers in C++. This deals with the majority of the user-facing code in wpilibC++Devices and a substantial portion of it in wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests are untouched except where it is necessary to make them work with the rest of the libraries. There is still a lot to do in the following areas: -The HAL (which we may not want to touch at all). -The I2C, Serial, and SPI interfaces in wpilibC++Devices, which I haven't gotten around to doing yet. -Most wpilibC++Devices classes have void* pointers for interacting with the HAL. -InterruptableSensorBase passes a void *params for the interrupt handler. -I haven't converted all the const char* to std::strings. -There are plenty of other cases of raw pointers still existing. -This doesn't fall directly under raw pointer stuff, but move syntax and rvalue references could be introduced in many places. -I haven't touched vision code. -The Resource classes conflict (one is in the hal, the other in wpilibC++). Someone should figure out a more permanent fix (eg, just renaming them), then doing what I did (making a new namespace for one of them, essentially the same as renaming it). A few other things: -I created a NullDeleter class which is marked as deprecated. What this does is it can be passed as the deleter to a std::shared_ptr so that when you are converting raw pointers to shared_ptrs the shared_ptr doesn't do any deletion if someone else owns the raw pointer. This should only be used in making old raw pointer UIs. -I had to alter the build.gradle so that it did not emit errors when deprecated functions called deprecated functions. Unfortunately, gradle doesn't appear to be actually printing out gcc warnigns for some reason. The best way I have found to fix this is to patch the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff) so that a deprecated function calling a deprecated function is fine but a non-deprecated function calling a deprecated function will throw a warning (which we then elevate with -Werror). I believe that clang deals with this properly, although I have not tried it myself. Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
double offset)
: m_analog_input(input, NullDeleter<AnalogInput>()),
m_fullRange(fullRange),
m_offset(offset) {}
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
AnalogPotentiometer::AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
artf4154: Get rid of raw pointers in C++. This deals with the majority of the user-facing code in wpilibC++Devices and a substantial portion of it in wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests are untouched except where it is necessary to make them work with the rest of the libraries. There is still a lot to do in the following areas: -The HAL (which we may not want to touch at all). -The I2C, Serial, and SPI interfaces in wpilibC++Devices, which I haven't gotten around to doing yet. -Most wpilibC++Devices classes have void* pointers for interacting with the HAL. -InterruptableSensorBase passes a void *params for the interrupt handler. -I haven't converted all the const char* to std::strings. -There are plenty of other cases of raw pointers still existing. -This doesn't fall directly under raw pointer stuff, but move syntax and rvalue references could be introduced in many places. -I haven't touched vision code. -The Resource classes conflict (one is in the hal, the other in wpilibC++). Someone should figure out a more permanent fix (eg, just renaming them), then doing what I did (making a new namespace for one of them, essentially the same as renaming it). A few other things: -I created a NullDeleter class which is marked as deprecated. What this does is it can be passed as the deleter to a std::shared_ptr so that when you are converting raw pointers to shared_ptrs the shared_ptr doesn't do any deletion if someone else owns the raw pointer. This should only be used in making old raw pointer UIs. -I had to alter the build.gradle so that it did not emit errors when deprecated functions called deprecated functions. Unfortunately, gradle doesn't appear to be actually printing out gcc warnigns for some reason. The best way I have found to fix this is to patch the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff) so that a deprecated function calling a deprecated function is fine but a non-deprecated function calling a deprecated function will throw a warning (which we then elevate with -Werror). I believe that clang deals with this properly, although I have not tried it myself. Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
double fullRange, double offset)
: m_analog_input(input), m_fullRange(fullRange), m_offset(offset) {}
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
double AnalogPotentiometer::Get() const {
return (m_analog_input->GetVoltage() / RobotController::GetVoltage5V()) *
m_fullRange +
m_offset;
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
}
double AnalogPotentiometer::PIDGet() { return Get(); }
void AnalogPotentiometer::InitSendable(SendableBuilder& builder) {
m_analog_input->InitSendable(builder);
Initial commit of the WPILib simulation support in an alpha quality state. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
}