|
|
|
#include <iostream>
|
|
|
|
#include <include/stepper.h>
|
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
using namespace simon;
|
|
|
|
namespace po = boost::program_options;
|
|
|
|
po::options_description desc("This small program allows to control SMcam. Allowed options");
|
|
|
|
desc.add_options()
|
|
|
|
("help", "Produce help message")
|
|
|
|
("axis", po::value<std::string>(), "Name of the axis to rotate")
|
|
|
|
("settings", po::value<std::string>(), "Settings file name")
|
|
|
|
("rotate", po::value<int>(), "Rotation in degrees. Positive means clockwise.");
|
|
|
|
po::variables_map vm;
|
|
|
|
po::store(po::parse_command_line(argc, argv, desc), vm);
|
|
|
|
po::notify(vm);
|
|
|
|
if (vm.count("help")) {
|
|
|
|
std::cout << desc << "\n";
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
stepper::c_stepper* ptr_stepper = nullptr;
|
|
|
|
if (vm.count("axis") && vm.count("settings")) {
|
|
|
|
auto axis = vm["axis"].as<std::string>();
|
|
|
|
auto fname_settings = vm["settings"].as<std::string>();
|
|
|
|
ptr_stepper = new stepper::c_stepper(axis, fname_settings);
|
|
|
|
if (vm.count("rotate")) {
|
|
|
|
auto degrees = vm["rotate"].as<int>();
|
|
|
|
ptr_stepper->rotate(degrees);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
std::cerr << "Please specify axis and settings file.\n";
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
if (ptr_stepper != nullptr)
|
|
|
|
delete ptr_stepper;
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|