23 #include <std_msgs/Float64.h>
28 int main(
int argc,
char** argv) {
29 ros::init(argc, argv,
"fmi_adapter_node");
33 if (!n.
getParam(
"fmu_path", fmuPath)) {
34 ROS_ERROR(
"Parameter 'fmu_path' not specified!");
35 throw std::runtime_error(
"Parameter 'fmu_path' not specified!");
38 double stepSizeAsDouble = 0.0;
39 n.
getParam(
"step_size", stepSizeAsDouble);
44 ROS_DEBUG(
"FMU has parameter '%s'", name.c_str());
48 std::map<std::string, ros::Subscriber> subscribers;
52 n.
subscribe<std_msgs::Float64>(rosifiedName, 1000, [&adapter, name](
const std_msgs::Float64::ConstPtr& msg) {
53 std::string myName = name;
56 subscribers[name] = subscriber;
59 std::map<std::string, ros::Publisher> publishers;
62 publishers[name] = n.
advertise<std_msgs::Float64>(rosifiedName, 1000);
67 double updatePeriod = 0.01;
68 n.
getParam(
"update_period", updatePeriod);
74 ROS_INFO(
"Simulation time %f is greater than timer's time %f. Is your step size to large?",
78 std_msgs::Float64 msg;
80 publishers[name].publish(msg);