Client Communication

Example

This example shows how to use the client communication. The code below uses the wrapper to create an instance of a client communication to be able to send messages to the robots.

my_computer = wrapper.get_client(client_id='MyUniqueName', host_ip='http://127.0.0.1:8000')

while(True):
    if(my_computer.has_receive_msg()):
        msg = my_computer.receive_msg()
        print(msg)

Code

class ClientCommunication(client_id)

Client Communication is a ready to go class that let you connect to the host communication of the package.

get_id()

Get the id of the

init_client_communication(host_ip='localhost')

Warning

The host should be created first before calling this method. (ref. Examples/Communication)

get_available_epucks()

Puts a message in queue to other robots

Parameters:

msg – any

stay_alive()

Keeps the host aware that the epuck is alive

send_msg_to(dest_client_id, msg)

Send a message to a specific id client

send_msg(msg)

Puts a message in queue to all the robots except itself :param msg: any

has_receive_msg()
Returns:

True if the robot has pending messages in his queue otherwise False.

receive_msg()

Get next message from the robots queue otherwise returns None.

clean_msg()

Deletes all its pending messages