pacmod_game_control_node.cpp
Go to the documentation of this file.
00001 /*
00002 * Unpublished Copyright (c) 2009-2018 AutonomouStuff, LLC, All Rights Reserved.
00003 *
00004 * This file is part of the PACMod ROS 1.0 driver which is released under the MIT license.
00005 * See file LICENSE included with this software or go to https://opensource.org/licenses/MIT for full license details.
00006 */
00007 
00008 #include "publish_control_factory.h"
00009 #include "globals.h"
00010 #include "startup_checks.h"
00011 
00012 using namespace AS::Joystick;
00013 
00014 /*
00015  * Main method running the ROS Node
00016  */
00017 int main(int argc, char *argv[])
00018 {
00019   ros::init(argc, argv, "pacmod_gamepad_control");
00020   ros::AsyncSpinner spinner(2);
00021   ros::NodeHandle priv("~");
00022 
00023   // Wait for time to be valid
00024   while (ros::Time::now().nsec == 0);
00025   
00026   if(run_startup_checks_error(&priv) == true)
00027     return 0;
00028 
00029   // Check ROS params for board type
00030   int board_rev = 1;
00031   priv.getParam("pacmod_board_rev", board_rev);
00032 
00033   // Create an instance of the appropriate board type
00034   std::unique_ptr<PublishControl> board;
00035 
00036   try
00037   {
00038     board = PublishControlFactory::create(board_rev);
00039   }
00040   catch (const std::invalid_argument& ia)
00041   {
00042     ROS_ERROR("Invalid PACMod Board Version received. Board requested was %d", board_rev);
00043     return 0;
00044   }
00045 
00046   spinner.start();
00047   ros::waitForShutdown();
00048 
00049   return 0;
00050 }
00051 


pacmod_game_control
Author(s): Joe Driscoll
autogenerated on Thu Jun 6 2019 21:10:24