mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
23 lines
496 B
C++
23 lines
496 B
C++
|
|
/*
|
||
|
|
* SimSpeedController.cpp
|
||
|
|
*
|
||
|
|
* Created on: May 28, 2014
|
||
|
|
* Author: alex
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include "simulation/SimFloatInput.h"
|
||
|
|
#include "simulation/MainNode.h"
|
||
|
|
|
||
|
|
SimFloatInput::SimFloatInput(std::string topic) {
|
||
|
|
sub = MainNode::Subscribe("~/simulator/"+topic, &SimFloatInput::callback, this);
|
||
|
|
std::cout << "Initialized ~/simulator/"+topic << std::endl;
|
||
|
|
}
|
||
|
|
|
||
|
|
double SimFloatInput::Get() {
|
||
|
|
return value;
|
||
|
|
}
|
||
|
|
|
||
|
|
void SimFloatInput::callback(const msgs::ConstFloat64Ptr &msg) {
|
||
|
|
value = msg->data();
|
||
|
|
}
|