Advance development

Catalogue
  1. 1. Python Development Mode
    1. 1.0.1. UPDATE RECORD
    2. 1.0.2. XGO Class
    3. 1.0.3. Part of movement
    4. 1.0.4. Part of read XGO2 battery,servo angle,value of imu
  • 2. ROS Development Mode
  • Python Development Mode

    XGo2 robot can be developed using the Python language.The motion,pose,coordinates,gripper and servo of the XGO2 can be controlled via Python. Download the XGO2.lib via the link XGO.lib Download.The detailed instructions for use of the library are as follows.

    UPDATE RECORD

    2023.2.1 creat

    XGO Class

    All functions are implemented by the methods owned by XGO. When instantiating an XGO class object, three parameters need to be passed in. The first one is the physical interface for serial communication between the host computer and the robot dog. It needs to be modified according to the actual situation. The second parameter is the baud rate of 115200, and the third parameter is 'xgomini' or 'xgolite' according to the model. Assuming that the serial communication interface is COM4, the instantiation code is as follows.

    1
    2
    3
    4
    5
    6
    7
    from xgolib import XGO
    Debian
    dog = XGO('/dev/ttyAMA0','xgomini')
    dog = XGO('/dev/ttyAMA0','xgolite')
    Windows
    dog = XGO('COM4',115200,'xgomini')
    dog = XGO('COM4',115200,'xgolite')
    The following is XGO Class instructions.

    XGO2 coordinate definition

    Part of movement

    action(action_id)

    Parameter Name Value Description
    action_id [] The ID and the action is shown in the table below
    ID action ID action ID action
    1 Lie down 2 Stand up 3 Crawl
    4 Trun around 6 Squat 7 Trun roll
    8 Turn pitch 9 Turn yaw 10 3 axis motion
    11 Take a pee 12 Sit down 13 Wave hand
    14 Cive a stretch 15 Wave body 16 Wave side
    17 Pray 18 Looking for food 19 Handshake
    20 Chicken head 21 Push up 22 Seek
    23 Dance 128 Grab UP 129 Grab Mid
    23 Grab down

    move(direction, step)

    Parameter Name Value Description
    direction 'x'、'X'、'y'、'Y' 'x'or'X'move forward or back,'y'or'Y'move left or right
    step x:[-25,25]
    y:[-18,18]
    Step is stride,positive represents forward or left shift, negative represents backward or right shift.

    turn(step)

    Parameter Name Value Description
    step [-150,150] Step represents rotational speed in ° / s, positive is left and negative is right.

    translation(direction,data)

    Parameter Name Value Description
    direction 'x','y','z' 'x','y','z' are three directions of coordinate system
    data mini2,'x':[-35,35]'y':[-18,18]'z':[75,115]
    lite2,'x':[-25,25]'y':[-18,18]'z':[60,110]
    Translation value range

    attitude(direction, data)

    Parameter Name Value Description
    direction 'x','y','z' 'x','y','z'represent roll pitch yaw
    data mini2,'x':[-20,+20]'y':[-15,+15]'z'[-11,+11]
    lite2,'x':[-20,+20]'y':[-10,+10]'z'[-12,+12]
    attitude value range

    leg(leg_id, data)

    Parameter Name Value Description
    leg_id 1,2,3,4 'left front','right front','right rear','left rear'
    data mini2,'x':[-35,35]'y':[-18,18]'z':[75,115]
    lite2,'x':[-25,25]'y':[-18,18]'z':[60,110]
    toes position value range

    motor(motor_id, data)

    Parameter Name Value Description
    motor_id 11,12,13
    21,22,23
    31,32,33
    41,42,41
    51,52,53
    'left front lower','left front middle','left front upper'
    'right front lower','right front middle','right front upper'
    'right rear lower','right rear middle','right rear upper'
    'left rear lower','left rear middle','left rear upper'
    'top of arm','middle of arm','lower of arm'
    data mini2,11:[-73,+57]12:[-66,93]13:[-31,31]
    mini2,21:[-73,+57]22:[-66,93]23:[-31,31]
    mini2,31:[-73,+57]32:[-66,93]33:[-31,31]
    mini2,41:[-73,+57]42:[-66,93]43:[-31,31]
    mini2,51:[-75,+90]52:[-85,50]53:[-65,65]
    lite2,11:[-70,+50]12:[-70,90]13:[-30,30]
    lite2,21:[-70,+50]22:[-70,90]23:[-30,30]
    lite2,31:[-70,+50]32:[-70,90]33:[-30,30]
    lite2,41:[-70,+50]42:[-70,90]43:[-30,30]
    lite2,51:[-92,+105]52:[-70,60]53:[-30,30]
    servo value range
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    #action 
    dog.action(1)

    #move
    dog.move('x',15)
    dog.move('x',-15)
    dog.move('y',15)
    dog.move('y',-15)

    #turn
    dog.turn(100)

    #translation
    '''xgo_mini2'''
    dog.translation('x',35)
    dog.translation('y',-18)
    dog.translation('z',115)
    '''xgo_lite2'''
    dog.translation('x',25)
    dog.translation('y',-18)
    dog.translation('z',60)

    #attitude
    '''xgo_mini2'''
    dog.attitude('r',20)
    dog.attitude('p',-15)
    dog.attitude('y',11)
    '''xgo_lite2'''
    dog.attitude('r',20)
    dog.attitude('p',-10)
    dog.attitude('y',12)

    #leg
    '''xgo_mini2'''
    dog.leg(1,[35,-18,115])
    '''xgo_lite22'''
    dog.leg(1,[25,-15,110])

    #motor
    '''xgo_mini2'''
    dog.motor(11,57)
    dog.motor(22,-66)
    dog.motor(33,31)
    dog.motor(41,-57)
    dog.motor(51,90)
    '''xgo_lite2'''
    dog.motor(11,50)
    dog.motor(22,-70)
    dog.motor(33,30)
    dog.motor(41,-70)
    dog.motor(51,105)

    Part of read XGO2 battery,servo angle,value of imu

    leg(leg_id, data)

    Parameter Name Value Description
    leg_id 1,2,3,4 'left front','right front','right rear','left rear'
    data mini2,'x':[-35,35]'y':[-18,18]'z':[75,115]
    lite2,'x':[-25,25]'y':[-18,18]'z':[60,110]
    toes position value range

    ROS Development Mode

    DownLoad.