def __init__(self):
        self.robot_name          = rospy.get_param('~name', "warty")
        self.my_team_name        = rospy.get_param('~team_name', 'Cyan') # Use one from ATAK which are colors
        self.my_team_role        = rospy.get_param('~team_role', 'Team Member') # Use one from ATAK
        self.tak_ip              = rospy.get_param('~tak_ip', '127.0.0.1') 
        self.tak_port            = rospy.get_param('~tak_port', '8088') # Port for TCP un-encrypted connection
        self.my_callsign         = rospy.get_param('~callsign', 'default_callsign')
        self.baselink_frame      = rospy.get_param('~baselink_frame', 'base_link') # Base frame for the robot
        self.map_frame           = rospy.get_param('~map_frame', 'map') # The frame that the objects are located in
        self.odom_topic          = rospy.get_param('~odom_topic', 'map') # The frame that the objects are located in
        self.my_uid              = self.set_uid() # Unique ID for robot on TAK system
        self.robot_msg_uid        = rospy.get_param('~robot_msg_uid', 'warty1_goto') # ID used to figure out if this message belongs to this robot
        self.zone='18T'
        self.takmsg_tree = ''

        self.vis_pub = rospy.Publisher("goal_marker", Marker, queue_size=10) # TODO add this back in as a debug ability
        self.goal_pub = rospy.Publisher("goto_goal", PoseDescriptionStamped, queue_size=10)
        self.path_pub = rospy.Publisher("atak_path", Path, queue_size=10)
        rospy.Subscriber("object_location", PoseDescriptionArray, self.objects_location_cb)
        rospy.Subscriber(self.odom_topic, Odometry, self.robot_location_cb)

        rospy.loginfo("===   Attempting to lookup a transform from %s to %s" %('utm', self.baselink_frame))
        self.tf1_listener = tf.TransformListener()
        self.wait_for_transform()
#        self.tf1_listener.waitForTransform('utm', self.baselink_frame, rospy.Time(0), rospy.Duration(35.0))
        rospy.loginfo("===   Transform lookup succeeded")

        rospy.loginfo("Started ATAK Bridge with the following:\n\t\tCallsign: %s\n\t\tUID: %s\n\t\tTeam name: %s"
                    %(self.my_callsign,self.my_uid,self.my_team_name))
        self.takserver = takcot() #TODO add a timeout and exit condition
Beispiel #2
0
def iterate_and_send(points: list, waits: list, tak_server: str, tak_port: int,
                     cot_type: str, callsign: str, uid: str, cot_identity: str,
                     cot_dimension: str, cot_stale: int):
    """
    Iterates through list of coordinate points and wait times and sends them to a TAKServer

    Parameters
    ----------
        points : list
            list of coordinate points
        waits : list
            list of times in seconds to wait between locations
        tak_server : str
            the address of the target TAKServer
        tak_port : int
            the port for the target TAKServer
        cot_type : str
            cot type string e.g a-f-G-U-C
        cot_identity : str
            Cot identity e.g friend
        cot_dimension : str
            Cot dimension e.g land-unit
        cot_stale : int
            Time in minuets for the object to become stale in ATAK
        callsign : str
            the callsign of the object
        uid : str
            the uid for the object
    """
    takserver = takcot()
    takserver.open(tak_server, tak_port)
    locator = 0
    takserver.flush()
    for location in points:
        takserver.send(
            mkcot.mkcot(cot_identity=str(cot_identity),
                        cot_stale=int(cot_stale),
                        cot_dimension=str(cot_dimension),
                        cot_typesuffix=str(cot_type),
                        cot_callsign=str(callsign),
                        cot_id=str(uid),
                        cot_lat=round(location[0], 5),
                        cot_lon=round(location[1], 5)))
        takserver.flush()
        try:
            time.sleep(waits[locator])
        except IndexError:
            break
        locator += 1
    takserver.close()
    def __init__(self):
        self.robot_name = rospy.get_param('~name', "husky")
        self.my_team_name = rospy.get_param(
            '~team_name', 'Cyan')  #Use one from ATAK which are colors
        self.my_team_role = rospy.get_param('~team_role',
                                            'Team Member')  # Use one from ATAK
        self.tak_ip = rospy.get_param('~tak_ip', '127.0.0.1')
        self.tak_port = rospy.get_param('~tak_port', '8088')
        self.baselink_frame = rospy.get_param('~baselink_frame', 'base_link')
        self.global_frame = rospy.get_param('~global_frame', 'utm')
        self.my_callsign = rospy.get_param('~callsign', 'default_callsign')
        self.my_uid = self.set_uid()
        self.zone = '18T'
        self.takmsg_tree = ''
        self.target_list = ["car", "Vehicle"]
        self.tf1_listener = tf.TransformListener()
        self.tf1_listener.waitForTransform(self.global_frame,
                                           self.baselink_frame, rospy.Time(0),
                                           rospy.Duration(35.0))
        self.marker_topic = "/" + self.robot_name + "/atak/goal"
        self.vis_pub = rospy.Publisher(self.marker_topic,
                                       Marker,
                                       queue_size=10)
        #self.goal_topic="/"+self.robot_name+"/nav_goal/2d"
        #self.uav_pub = rospy.Publisher(self.goal_topic, PoseStamped, queue_size=10)
        self.goal_topic = "/" + self.robot_name + "/goto_region/goal"
        self.grnd_pub = rospy.Publisher(self.goal_topic,
                                        GotoRegionActionGoal,
                                        queue_size=10)

        rospy.Subscriber("/husky/worldmodel_rviz/object_markers", MarkerArray,
                         self.grnd_object_cb)
        #rospy.Subscriber("/uav1/detection_localization/detections/out/local", Detection2DArray, self.object_location_cb)
        rospy.loginfo(
            "Started ATAK Bridge with the following:\n\t\tCallsign: %s\n\t\tUID: %s\n\t\tTeam name: %s\n\t\tGlobal Frame: %s"
            % (self.my_callsign, self.my_uid, self.my_team_name,
               self.global_frame))
        self.takserver = takcot()  #TODO add a timeout and exit condition
Beispiel #4
0
    'Server? local is default, "FTS" or "DISCORD" uses those public servers: ')
if server == "FTS":
    TAK_IP = os.getenv('TAK_IP', '204.48.30.216')
    TAK_PORT = int(os.getenv('TAK_PORT', '8087'))
elif server == "DISCORD":
    TAK_IP = os.getenv('TAK_IP', '128.199.70.11')
    TAK_PORT = int(os.getenv('TAK_PORT', '48088'))
else:
    # use the local server for default
    TAK_IP = '172.16.30.30'
    TAK_PORT = 8087

#-----------------------------------------------------------------------------------------

# substantiate the class
takserver = takcot()

# Now open server
print("Opening TAK Server")
testsock = takserver.open(TAK_IP, TAK_PORT)

#print("open return is:")
#print(testsock)

#connect_xml=cot_xml
print()
print("send a connect")
takserver.flush()  # flush the xmls the server sends
#print(takserver.read())  # read all the server CoT's, will send last + the connct

# send the connect string, server does not echo
Beispiel #5
0
    except:
        logger.warning("users json load failed")
        users = []
    finally:
        f.close()
except:
    users = []
    logger.warning("Users file open failed, resetting")

#print()

#-----------------------------------------------------------------------------------------

# substantiate the class
try:
    takserver = takcot(logger=logger)
except:
    logger.error("takcot class failed")
    exit()

# Now open server
logger.debug("Opening TAK Server " + server +
             "----------------------------------------------------")
try:
    testsock = takserver.open(TAK_IP, TAK_PORT)
except:
    logger.error("takserver open failed")
    exit()

logger.debug("send a takserver connect")
try:
Beispiel #6
0
    my_uid = str(socket.getfqdn()) + "-" + str(uuid.uuid1())[-12:] + '_echo'
my_team_name = rospy.get_param('~team_name', 'Default Team')
my_team_role = rospy.get_param('~team_role', 'Default Team Role')
tak_ip = rospy.get_param('~tak_ip', '10.13.0.10')
tak_port = rospy.get_param('~tak_port', '8088')
rospy.loginfo("my_callsign=%s, my_uid =%s, my_team_name =%s, my_uid =%s" %
              (my_callsign, my_uid, my_team_name, my_team_role))

# Start ATAK client
rospy.loginfo(
    "============ Node: %s is connecting to  TAK Server ===============",
    node_name)
rospy.loginfo(
    "==== If the code appears to freeze at this point, then it is likely the server is not reachable  ====="
)
takserver = takcot()  #TODO add a timeout and exit condition
try:
    tasksock = takserver.open(tak_ip, tak_port)
    takserver.flush()
except:
    rospy.logerr("Failed to connect to the TAK Server")
    exit()

# Send a ping and check for answer
connect_xml = (mkcot.mkcot(cot_type="t",
                           cot_how="h-g-i-g-o",
                           cot_callsign=my_callsign,
                           cot_id=my_uid,
                           team_name=my_team_name,
                           team_role=my_team_role)).decode('utf-8')
my_xml = parseString(str(connect_xml.replace("\n", ""))).toprettyxml()