Пример #1
0
def main():
    bot = InterbotixHexapodXS('pxmark4')
    bot.hex.modify_stance(-0.02)
    bot.hex.move_in_world(x_stride=0.06, num_cycles=2, gait_type="tripod")
    bot.hex.move_in_world(y_stride=0.06, num_cycles=2, gait_type="ripple")
    bot.hex.move_in_world(x_stride=-0.06, num_cycles=2, gait_type="wave")
    bot.hex.move_in_world(y_stride=-0.06, num_cycles=2, gait_type="wave")
    bot.hex.reset_hexapod('sleep')
Пример #2
0
def main():
    bot = InterbotixHexapodXS('pxmark4')
    bot.hex.move_in_place(z=0.08)
    for step in range(500):
        z = 0.08 + 0.05 * math.sin(math.pi * step / 25.0)
        bot.hex.move_in_place(z=z, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    bot.hex.reset_hexapod('sleep')
Пример #3
0
def main():
    bot = InterbotixHexapodXS('pxmark4')
    bot.hex.move_in_place(z=0.08, pitch=0.2)
    for step in range(500):
        roll = 0.2 * math.sin(math.pi * step/25.0)
        pitch = 0.2 * math.cos(math.pi * step/25.0)
        bot.hex.move_in_place(roll=roll, pitch=pitch, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    bot.hex.reset_hexapod('sleep')
Пример #4
0
def main():

    bot = InterbotixHexapodXS('wxmark4')
    bot.hex.move_in_place(z=0.1)
    bot.hex.modify_stance(-0.02)

    # translate in X
    for step in range(51):
        x = 0.05 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(x=x, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    # translate in Y
    for step in range(51):
        y = 0.05 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(y=y, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    # translate in Z
    for step in range(51):
        z = 0.1 + 0.05 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(z=z, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    # roll around X
    for step in range(51):
        roll = 0.3 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(roll=roll, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    # pitch around Y
    for step in range(51):
        pitch = 0.3 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(pitch=pitch, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    # yaw around Z
    for step in range(51):
        yaw = 0.3 * math.sin(2 * math.pi * step / 50.0)
        bot.hex.move_in_place(yaw=yaw, moving_time=0.15, blocking=False)
        time.sleep(0.04)
    time.sleep(0.2)

    bot.hex.reset_hexapod('sleep')
def main():
    bot = InterbotixHexapodXS('pxmark4')
    bot.hex.move_in_place(x=-0.05, z=0.08, pitch=-0.1)
    bot.hex.move_leg("right_front", [0, 0.05, 0.08])
    bot.hex.move_leg("left_front", [0, -0.05, 0.08])
    z_prev = 0
    for step in range(500):
        z = 0.03 * math.sin(math.pi * step / 25.0)
        bot.hex.move_leg("right_front", [0, 0, z - z_prev],
                         moving_time=0.150,
                         accel_time=0.075,
                         blocking=False)
        bot.hex.move_leg("left_front", [0, 0, z_prev - z],
                         moving_time=0.150,
                         accel_time=0.075,
                         blocking=False)
        z_prev = z
        time.sleep(0.04)
    bot.hex.reset_hexapod('sleep')
Пример #6
0
def main():
    # Instantiate an instance of the hexapod (goes to the default Home Pose when done)
    bot = InterbotixHexapodXS('pxmark4')

    # The stance the robot is currently in is the default Home Pose. Whenever you call
    # the 'reset_hexapod("home") function or the code gets stuck (perhaps due to a joint limt
    # being reached or failing to find an IK solution), this is the pose it will go to.
    # However, you can change the default Home Pose to be something else that's more convenient.
    # Do it by first setting a new height (physically, this is the distance from the 'base_link'
    # frame to the ground)...
    bot.hex.move_in_place(z=0.1)

    # ...assuming the new height looks good, set it to be the new Home Pose height
    bot.hex.set_home_height(0.1)

    # ...then modify the stance if you want. By default, the hexapod's stance is a bit wide which can
    # cause slipping. So make it two centimeters tighter by typing the following command. This essentially
    # takes each foot point and brings it two centimeters closer to its coxa joint
    bot.hex.modify_stance(-0.02)

    # Now get the new foot points...
    foot_points = bot.hex.get_foot_points()

    # Set them to be the new 'Home Pose' foot points...
    bot.hex.set_home_foot_points(foot_points)

    # And confirm that when you execute the following command, the hexapod doesn't move...
    bot.hex.reset_hexapod("home")

    # Now make the hexapod walk forward using the ripple gait. Every gait cycle, it should
    # walk 8 cm for a total of 40 cm.
    bot.hex.move_in_world(x_stride=0.08, gait_type="ripple", num_cycles=5)

    # Now make the hexapod walk backwards using the wave gait the same distance.
    bot.hex.move_in_world(x_stride=-0.08, gait_type="wave", num_cyles=5)

    # Set the LEDs to both be gold for no good reason, just cuz...
    bot.pixels.set_color(color=GOLD, set_all_leds=True)

    # Go to sleep :)
    bot.hex.reset_hexapod("sleep")
Пример #7
0
def main():
    bot = InterbotixHexapodXS('wxmark4')
    # move hexapod legs up/down to get rid of any stress the motors might be experiencing from picking the hexapod body up
    bot.hex.move_in_world()
    # move the hexapod body up to allow for more foot clearance
    bot.hex.move_in_place(z=0.12)
    # begin uneven gait - moving forward
    # reset foot points to defaults every two cycles - this prevents drift building up
    for cntr in range(10):
        bot.hex.move_in_world_rough(x_stride=0.06,
                                    reset_foot_points=True,
                                    reset_height=0.12,
                                    max_foot_height=0.05,
                                    num_cycles=2)
    # begin uneven gait - moving backward
    # reset foot points to defaults every two cycles - this prevents drift building up
    for cntr in range(10):
        bot.hex.move_in_world_rough(x_stride=-0.06,
                                    reset_foot_points=True,
                                    reset_height=0.12,
                                    max_foot_height=0.05,
                                    num_cycles=2)
    bot.hex.reset_hexapod(pose_type="sleep")