def __init__(self):
        print("Creating the playground")

        self.reachy = Reachy(right_arm=parts.RightArm(
            io=io_setting,
            hand="force_gripper",
        ))

        self.pawn_played = 0
Beispiel #2
0
 def setUp(self):
     self.left_arm = parts.LeftArm(
         luos_port='',
         hand=None,
     )
     self.left_arm_with_gripper = parts.LeftArm(
         luos_port='',
         hand='force_gripper',
     )
     self.right_arm = parts.RightArm(
         luos_port='',
         hand=None,
     )
     self.right_arm_with_gripper = parts.RightArm(
         luos_port='',
         hand='force_gripper',
     )
     self.right_arm_with_wrist = parts.RightArm(
         luos_port='',
         hand='orbita_wrist',
     )
Beispiel #3
0
    def __init__(self,
                 node_name="speechsynthesis",
                 host="127.0.0.1",
                 port=1883,
                 username=None,
                 password=None,
                 subscribe_dict={},
                 run_sleep=0.1,
                 env="dev"):
        super().__init__(node_name, host, port, username, password,
                         subscribe_dict, run_sleep)

        curr_platform = get_platform()
        if env == "dev":
            self.io = "ws"
        elif env == "reachy":
            self.io = '/dev/ttyUSB*'
            parts.Head = patch_head(parts.Head)
            parts.RightArm = patch_right_arm(parts.RightArm)
            parts.arm.RightForceGripper = patch_force_gripper(
                parts.arm.RightForceGripper)
        else:
            raise Exception("Invalid env: {}".format(env))

        self.reachy = Reachy(
            head=parts.Head(io=self.io),
            right_arm=parts.RightArm(io=self.io, hand='force_gripper'),
        )

        self.running = True

        command_input = input("press enter after connecting to Reachy>")

        self.initialize()

        self.add_subscribe('+/body/init', self.handle_initialize)
        self.add_subscribe('+/body/shutdown', self.handle_shutdown)
        self.add_subscribe('+/body/stop', self.handle_force_stop)
        self.add_subscribe('+/body/right_arm/wave', self.handle_wave_arm)
        self.add_subscribe('+/body/head/antenna/wiggle',
                           self.handle_wiggle_antennas)
        self.add_subscribe('+/body/head/antenna/zero',
                           self.move_antennas_to_zero)
        self.add_subscribe('+/body/right_arm/zero',
                           self.handle_wiggle_antennas)
try:
    from . import (assistant_helpers, audio_helpers, browser_helpers,
                   device_helpers)
except (SystemError, ImportError):
    import assistant_helpers
    import audio_helpers
    import browser_helpers
    import device_helpers

from azure.cognitiveservices.speech import AudioDataStream, SpeechConfig, SpeechSynthesizer, SpeechSynthesisOutputFormat
from azure.cognitiveservices.speech.audio import AudioOutputConfig

from reachy import parts, Reachy

robot = Reachy(
    right_arm=parts.RightArm(io='ws', hand='force_gripper'),
    left_arm=parts.LeftArm(io='ws', hand='force_gripper'),
)

engine = pyttsx3.init()

robot.left_arm.shoulder_roll.goal_position = 0
robot.left_arm.arm_yaw.goal_position = 0
robot.left_arm.elbow_pitch.goal_position = 0
robot.left_arm.hand.forearm_yaw.goal_position = 0

speech_config = SpeechConfig(subscription="subscriptionkey",
                             region="westeurope")
audio_config = AudioOutputConfig(use_default_speaker=True)
synthesizer = SpeechSynthesizer(speech_config=speech_config,
                                audio_config=audio_config)
    "right_arm.hand.wrist_pitch": -60,
    "right_arm.hand.wrist_roll": 0,
}

base_pos = {
    "right_arm.shoulder_pitch": 60,
    "right_arm.shoulder_roll": -15,
    "right_arm.arm_yaw": 0,
    "right_arm.elbow_pitch": -95,
    "right_arm.hand.forearm_yaw": -15,
    "right_arm.hand.wrist_pitch": -50,
    "right_arm.hand.wrist_roll": 0,
    "right_arm.hand.gripper": -45,
}

reachy = Reachy(right_arm=parts.RightArm(io="ws", hand="force_gripper"))
input("Connect the Unity simulator, then press Enter to continue.")

while True:
    selection = input("Name a move: ")
    
    '''
    if selection == 'rest_pos':
        reachy.goto(
            goal_positions=rest_pos,
            duration=1,
            wait=True,
            interpolation_mode="minjerk",
            starting_point="goal_position",
        )
    elif selection == 'base_pos':
Beispiel #6
0
    return forceGripper


parts.arm.RightForceGripper = patch_force_gripper(parts.arm.RightForceGripper)

io_setting = None
while not io_setting:
    input_answer = input("Is this a simulated Reachy? y/n? ")
    if input_answer == "y" or input_answer == "Y":
        io_setting = "ws"
    elif input_answer == "n" or input_answer == "N":
        io_setting = "/dev/ttyUSB*"

try:
    reachy = Reachy(right_arm=parts.RightArm(io=io_setting, hand="force_gripper"))
except:
    traceback.print_exc()
    exit("Exception when initializing Reachy")

if io_setting == "ws":
    input("Connect the Unity simulator, then press Enter to continue.")

for m in reachy.right_arm.motors:
    print(f"Motor found: {m.name} - pos:{m.present_position}")
    m.compliant = True


stop_loop = False
while not stop_loop:
    print("Ready to record!")
 def setUp(self):
     self.reachy = Reachy(
         left_arm=parts.LeftArm(io='', hand='force_gripper'),
         right_arm=parts.RightArm(io='', hand='force_gripper'),
     )