robot_state.cpp
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Copyright (c) 2011, Southwest Research Institute
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are met:
00009  *
00010  *      * Redistributions of source code must retain the above copyright
00011  *      notice, this list of conditions and the following disclaimer.
00012  *      * Redistributions in binary form must reproduce the above copyright
00013  *      notice, this list of conditions and the following disclaimer in the
00014  *      documentation and/or other materials provided with the distribution.
00015  *      * Neither the name of the Southwest Research Institute, nor the names
00016  *      of its contributors may be used to endorse or promote products derived
00017  *      from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029  * POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #include "ros/ros.h"
00033 #include "industrial_robot_client/robot_state_interface.h"
00034 #include "simple_message/simple_message.h"
00035 #include "simple_message/socket/tcp_client.h"
00036 
00037 using industrial_robot_client::robot_state_interface::RobotStateInterface;
00038 using namespace industrial::simple_message;
00039 using namespace industrial::tcp_client;
00040 using namespace industrial::simple_socket;
00041 
00042 int main(int argc, char** argv)
00043 {
00044 
00045   const unsigned int IP_ARG_IDX = 1;
00046   TcpClient connection;
00047   ros::init(argc, argv, "state_interface");
00048 
00049   if (argc != 1) //Only one argument, the robot IP address is accepted
00050   {
00051     ROS_INFO("Robot state connecting to IP address: %s", argv[IP_ARG_IDX]);
00052     connection.init(argv[IP_ARG_IDX], StandardSocketPorts::STATE);
00053 
00054     std::vector<std::string> joint_names;
00055     joint_names.push_back("joint_s");
00056     joint_names.push_back("joint_l");
00057     joint_names.push_back("joint_e");
00058     joint_names.push_back("joint_u");
00059     joint_names.push_back("joint_r");
00060     joint_names.push_back("joint_b");
00061     joint_names.push_back("joint_t");
00062 
00063     RobotStateInterface rsi;
00064     if (rsi.init(&connection, joint_names))
00065     {
00066       rsi.run();
00067     }
00068 
00069   }
00070   else
00071   {
00072     ROS_ERROR("Missing command line arguments, usage: robot_state <robot ip address>");
00073   }
00074 
00075   return 0;
00076 }
00077 


dx100
Author(s): Shaun Edwards (Southwest Research Institute)
autogenerated on Mon Oct 6 2014 02:25:34