Skip to content

multi_robot connection when connected to multiple networks #105

@MrCampbellDuchess

Description

@MrCampbellDuchess

I am attempting to connect to two robots at the same time using multi_robot. These are EP-model robots.

from robomaster import config

def group_task(robot_group):
    x = 0.3
    y = 0.3
    z = 90

    # 前进 0.3米
    robot_group.chassis.move(-x, 0, 0, 2, 180).wait_for_completed()

    # 后退 0.3米
    robot_group.chassis.move(x, 0, 0, 2, 180).wait_for_completed()

    # 左移 0.3米
    robot_group.chassis.move(0, -y, 0, 2, 180).wait_for_completed()

    # 右移 0.3米
    robot_group.chassis.move(0, y, 0, 2, 180).wait_for_completed()

    # 左转 90度
    robot_group.chassis.move(0, 0, z, 2, 180).wait_for_completed()

    # 右转 90度
    robot_group.chassis.move(0, 0, -z, 2, 180).wait_for_completed()


def group_task1(robot_group):

    # 前进 0.3米
    robot_group.chassis.move(0.3, 0, 0, 2, 180).wait_for_completed()


if __name__ == '__main__':
    #get robot sn by run the exmaples of /15_multi_robot/multi_ep/01_scan_robot_sn.py
    robots_sn_list = ['3JKDH6U001P03L', '3JKDH6U00162BX']
    config.LOCAL_IP_STR="192.168.0.189"
    multi_robots = multi_robot.MultiEP()
    multi_robots.initialize()
    number = multi_robots.number_id_by_sn([0, robots_sn_list[0]], [1, robots_sn_list[1]])
    print("The number of robot is: {0}".format(number))
    robot_group = multi_robots.build_group([0, 1])
    robot_group1 = multi_robots.build_group([0])
    multi_robots.run([robot_group, group_task])
    multi_robots.run([robot_group1, group_task1])
    print("Game over")
    multi_robots.close()

I can connect to each robot individually, but in order to connect I have to define config.ROBOT_IP_STR when I do that.

As you can see from the above code, I have added config.LOCAL_IP_STR to force connection via Ethernet rather than this devices WiFi as I am in an education setting and cannot change wifi networks.

The SN in the code above is the SN of my robots, confirmed by checking using the single robot connection method and get_sn().

Can robots by identified by IP instead of by SN?

Does the scanning procedure to find robots by SN utilize specific ports? My concern is the Windows Firewall is blocking outgoing scanning attempts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions