Package master_discovery_fkie :: Module master_discovery :: Class Discoverer
[frames] | no frames]

Class Discoverer

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        Discoverer

The class to publish the current state of the ROS master.

Instance Methods
 
__init__(self, mcast_port, mcast_group, monitor_port)
Initialize method for the Discoverer class
source code
 
checkROSMaster_loop(self)
The method test periodically the state of the ROS master.
source code
 
finish(self, *arg)
Callback called on exit of the ros node to publish the empty list of ROSMasters.
source code
 
publish_masterstate(self, master_state)
Publishes the given state to the ROS network.
source code
 
publish_stats(self, stats)
Publishes the link quality states to the ROS network.This method is thread safe.
source code
 
recv_loop(self)
This method handles the received multicast messages.
source code
 
rosservice_list_masters(self, req)
Callback for the ROS service to get the current list of the known ROS masters.
source code
 
run(self)
The run method is used for periodic send small multicast messages.
source code
 
timed_stats_calculation(self)
This method will be called by a timer and has two jobs:
source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
msg2masterState(cls, msg, address)
@return: parses the hearbeat message and return a tuple of version and values corresponding with current version of message.
source code
Class Variables
  HEARTBEAT_FMT = 'cBBiiHii'
  HEARTBEAT_HZ = 2
  MEASUREMENT_INTERVALS = 5
  REMOVE_AFTER = 300
  ROSMASTER_HZ = 1
  TIMEOUT_FACTOR = 1.4
  VERSION = 2
Properties

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details

__init__(self, mcast_port, mcast_group, monitor_port)
(Constructor)

source code 

Initialize method for the Discoverer class

Parameters:
  • mcast_port (int) - The port used to publish and receive the multicast messages.
  • mcast_group (str) - The IPv4 or IPv6 multicast group used for discovering over nodes.
  • monitor_port (int) - The port of the RPC Server, used to get more information about the ROS master.
Overrides: object.__init__

checkROSMaster_loop(self)

source code 

The method test periodically the state of the ROS master. The new state will be published as heartbeat messages.

msg2masterState(cls, msg, address)
Class Method

source code 

@return: parses the hearbeat message and return a tuple of
        version and values corresponding with current version of message.
        @see L{Discoverer.HEARTBEAT_FMT}
@raise Exception on invalid message
@rtype: C{(unsigned char, tuple corresponding to L{Discoverer.HEARTBEAT_FMT})}

publish_masterstate(self, master_state)

source code 

Publishes the given state to the ROS network. This method is thread safe.

Parameters:

publish_stats(self, stats)

source code 

Publishes the link quality states to the ROS network.This method is thread safe.

Parameters:

run(self)

source code 

The run method is used for periodic send small multicast messages. This messages simulates the heartbeat and are used to detect other running nodes associated with ROS master.

Overrides: threading.Thread.run

timed_stats_calculation(self)

source code 

This method will be called by a timer and has two jobs:

  1. set the masters offline, if no heartbeat messages are received a long time
  2. calculate the quality of known links

See Also: float