当前位置: 首页>>代码示例>>Python>>正文


Python Packet.make_packet方法代码示例

本文整理汇总了Python中Packet.Packet.make_packet方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.make_packet方法的具体用法?Python Packet.make_packet怎么用?Python Packet.make_packet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet.Packet的用法示例。


在下文中一共展示了Packet.make_packet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: user_state

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import make_packet [as 别名]
    def user_state(self, leg, shoulder, elbow, foot):
        user_packet = Packet()
        if leg == 1:
            self.leg_1.set_angles(shoulder, elbow, foot)
        elif leg == 2:
            self.leg_2.set_angles(shoulder, elbow, foot)
        elif leg == 3:
            self.leg_3.set_angles(shoulder, elbow, foot)
        elif leg == 4:
            self.leg_4.set_angles(shoulder, elbow, foot)
        elif leg == 5:
            self.leg_5.set_angles(shoulder, elbow, foot)
        elif leg == 6:
            self.leg_6.set_angles(shoulder, elbow, foot)

        user_packet.set_leg(1, self.leg_1)
        user_packet.set_leg(2, self.leg_2)
        user_packet.set_leg(3, self.leg_3)
        user_packet.set_leg(4, self.leg_4)
        user_packet.set_leg(5, self.leg_5)
        user_packet.set_leg(6, self.leg_6)

        user_packet.make_packet()
        packet_list = [user_packet]
        return packet_list
开发者ID:littlebrat,项目名称:Hexapod,代码行数:27,代码来源:state.py

示例2: storage

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import make_packet [as 别名]
    def storage(self):
        storage_packet = Packet()

        self.leg_1.set_angles(60, 15, 20)
        self.leg_2.set_angles(60, 15, 20)
        self.leg_3.set_angles(60, 15, 20)
        self.leg_4.set_angles(60, 15, 20)
        self.leg_5.set_angles(60, 15, 20)
        self.leg_6.set_angles(60, 15, 20)

        storage_packet.set_leg(1, self.leg_1)
        storage_packet.set_leg(2, self.leg_2)
        storage_packet.set_leg(3, self.leg_3)
        storage_packet.set_leg(4, self.leg_4)
        storage_packet.set_leg(5, self.leg_5)
        storage_packet.set_leg(6, self.leg_6)

        storage_packet.make_packet()
        packet_list = [storage_packet]
        return packet_list
开发者ID:littlebrat,项目名称:Hexapod,代码行数:22,代码来源:state.py

示例3: home

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import make_packet [as 别名]
    def home(self):
        home_packet = Packet()

        self.leg_1.set_angles(90, 100, 120)
        self.leg_2.set_angles(90, 100, 120)
        self.leg_3.set_angles(90, 100, 120)
        self.leg_4.set_angles(90, 100, 120)
        self.leg_5.set_angles(90, 100, 120)
        self.leg_6.set_angles(90, 100, 120)

        home_packet.set_leg(1, self.leg_1)
        home_packet.set_leg(2, self.leg_2)
        home_packet.set_leg(3, self.leg_3)
        home_packet.set_leg(4, self.leg_4)
        home_packet.set_leg(5, self.leg_5)
        home_packet.set_leg(6, self.leg_6)

        home_packet.make_packet()
        packet_list = [home_packet]
        return packet_list
开发者ID:littlebrat,项目名称:Hexapod,代码行数:22,代码来源:state.py

示例4: forward

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import make_packet [as 别名]
    def forward(self):
        packet_list = []

        #pos 1 - centered
        forward_packet_1 = Packet()

        self.leg_1.set_angles(90, 110, 60)
        self.leg_2.set_angles(90, 70, 20)
        self.leg_3.set_angles(100, 70, 20)
        self.leg_4.set_angles(90, 110, 60)
        self.leg_5.set_angles(90, 110, 40)
        self.leg_6.set_angles(100, 70, 20)

        forward_packet_1.set_leg(1, self.leg_1)
        forward_packet_1.set_leg(2, self.leg_2)
        forward_packet_1.set_leg(3, self.leg_3)
        forward_packet_1.set_leg(4, self.leg_4)
        forward_packet_1.set_leg(5, self.leg_5)
        forward_packet_1.set_leg(6, self.leg_6)

        forward_packet_1.make_packet()
        packet_list.append(forward_packet_1)

        #pos 2 - front (right side legs)
        forward_packet_2 = Packet()

        self.leg_1.set_angles(120, 110, 40)
        self.leg_2.set_angles(100, 70, 20)
        self.leg_3.set_angles(110, 70, 20)
        self.leg_4.set_angles(120, 110, 40)
        self.leg_5.set_angles(110, 110, 55)
        self.leg_6.set_angles(110, 70, 20)

        forward_packet_2.set_leg(1, self.leg_1)
        forward_packet_2.set_leg(2, self.leg_2)
        forward_packet_2.set_leg(3, self.leg_3)
        forward_packet_2.set_leg(4, self.leg_4)
        forward_packet_2.set_leg(5, self.leg_5)
        forward_packet_2.set_leg(6, self.leg_6)

        forward_packet_2.make_packet()
        packet_list.append(forward_packet_2)

        #pos 3 - up front
        forward_packet_3 = Packet()

        self.leg_1.set_angles(110, 70, 20)
        self.leg_2.set_angles(110, 110, 55)
        self.leg_3.set_angles(120, 110, 40)
        self.leg_4.set_angles(110, 70, 20)
        self.leg_5.set_angles(100, 70, 20)
        self.leg_6.set_angles(120, 110, 40)

        forward_packet_3.set_leg(1, self.leg_1)
        forward_packet_3.set_leg(2, self.leg_2)
        forward_packet_3.set_leg(3, self.leg_3)
        forward_packet_3.set_leg(4, self.leg_4)
        forward_packet_3.set_leg(5, self.leg_5)
        forward_packet_3.set_leg(6, self.leg_6)

        forward_packet_3.make_packet()
        packet_list.append(forward_packet_3)

        #pos 4 - up centered
        forward_packet_4 = Packet()

        self.leg_1.set_angles(100, 70, 20)
        self.leg_2.set_angles(90, 110, 40)
        self.leg_3.set_angles(90, 110, 60)
        self.leg_4.set_angles(100, 70, 20)
        self.leg_5.set_angles(90, 70, 20)
        self.leg_6.set_angles(90, 110, 60)

        forward_packet_4.set_leg(1, self.leg_1)
        forward_packet_4.set_leg(2, self.leg_2)
        forward_packet_4.set_leg(3, self.leg_3)
        forward_packet_4.set_leg(4, self.leg_4)
        forward_packet_4.set_leg(5, self.leg_5)
        forward_packet_4.set_leg(6, self.leg_6)

        forward_packet_4.make_packet()
        packet_list.append(forward_packet_4)

        #pos 5 - up back
        forward_packet_5 = Packet()

        self.leg_1.set_angles(90, 70, 20)
        self.leg_2.set_angles(60, 110, 55)
        self.leg_3.set_angles(80, 110, 90)
        self.leg_4.set_angles(90, 70, 20)
        self.leg_5.set_angles(70, 70, 20)
        self.leg_6.set_angles(80, 110, 90)

        forward_packet_5.set_leg(1, self.leg_1)
        forward_packet_5.set_leg(2, self.leg_2)
        forward_packet_5.set_leg(3, self.leg_3)
        forward_packet_5.set_leg(4, self.leg_4)
        forward_packet_5.set_leg(5, self.leg_5)
        forward_packet_5.set_leg(6, self.leg_6)

#.........这里部分代码省略.........
开发者ID:littlebrat,项目名称:Hexapod,代码行数:103,代码来源:state.py


注:本文中的Packet.Packet.make_packet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。