InfernalRobotics API

Provides RPCs to interact with Infernal Robotics Next. Provides the following classes:

Example

The following example gets the control group named “MyGroup”, prints out the names and positions of all of the servos in the group, then moves all of the servos to the right for 1 second.

#include <iostream>
#include <vector>
#include <thread>
#include <krpc.hpp>
#include <krpc/services/space_center.hpp>
#include <krpc/services/infernal_robotics.hpp>

using SpaceCenter = krpc::services::SpaceCenter;
using InfernalRobotics = krpc::services::InfernalRobotics;

int main() {
  auto conn = krpc::connect("InfernalRobotics Example");
  SpaceCenter space_center(&conn);
  InfernalRobotics infernal_robotics(&conn);

  InfernalRobotics::ServoGroup group = infernal_robotics.servo_group_with_name(space_center.active_vessel(), "MyGroup");
  if (group == InfernalRobotics::ServoGroup())
    std::cout << "Group not found" << std::endl;

  std::vector<InfernalRobotics::Servo> servos = group.servos();
  for (auto servo : servos)
    std::cout << servo.name() << " " << servo.position() << std::endl;

  group.move_right();
  std::this_thread::sleep_for(std::chrono::seconds(1));
  group.stop();
}