Пример #1
0
 def __init__(self):
     landmarks = {
         cube1: Pose(55, 160, 0, angle_z=degrees(90)),
         cube2: Pose(160, 55, 0, angle_z=degrees(0)),
         cube3: Pose(160, -55, 0, angle_z=degrees(0))
     }
     pf = ParticleFilter(robot,
                         landmarks=landmarks,
                         sensor_model=CubeSensorModel(robot))
     super().__init__(particle_filter=pf, particle_viewer=True)
Пример #2
0
 def __init__(self):
     landmarks = {
         0 : Pose(-55, 160, 0, angle_z=degrees(90)),
         1 : Pose( 55, 160, 0, angle_z=degrees(90)),
         2 : Pose(160,  55, 0, angle_z=degrees( 0)),
         3 : Pose(160, -55, 0, angle_z=degrees( 0))
     }
     pf = ParticleFilter(robot,
                         landmarks = landmarks,
                         sensor_model = ArucoCombinedSensorModel(robot))
     super().__init__(particle_filter=pf, particle_viewer=True)
Пример #3
0
def main():
    args = anki_vector.util.parse_command_args()

    with anki_vector.Robot(args.serial) as robot:

        #drive off charger
        robot.behavior.drive_off_charger()

        robot.world.connect_cube()

        #pick up cube object
        if robot.world.connected_light_cube:
            robot.behavior.pickup_object(robot.world.connected_light_cube)

        #get current position of robot
        current_robot_pose = robot.pose.position
        print(current_robot_pose)

        #got to desired position with cube
        pose = Pose(x=10, y=10, z=0, angle_z=Angle(degrees=0))
        robot.behavior.go_to_pose(pose)
        print(robot.pose.position)

        #drop off the cube object
        time.sleep(3.0)
        pose_future.cancel()
        robot.behavior.place_object_on_ground_here()
Пример #4
0
 def start(self, event=None):
     x = self.parent.obj.x
     y = self.parent.obj.y
     theta = self.parent.obj.theta
     self.target_pose = Pose(x + 250*cos(theta), y+250*sin(theta), self.robot.pose.position.z,
                             angle_z=Angle(radians = wrap_angle(theta+pi)))
     print('Traveling to',self.target_pose)
     super().start(event)
Пример #5
0
        def start(self, event=None):
            wall = self.parent.object
            print('Selected wall',self.parent.wobj)
            (x, y, theta) = self.parent.pick_side(150)

            self.target_pose = Pose(x, y, self.robot.pose.position.z,
                                    angle_z=Angle(radians = wrap_angle(theta)))
            print('Traveling to',self.target_pose)
            super().start(event)
Пример #6
0
def main():
    args = anki_vector.util.parse_command_args()
    with anki_vector.Robot(args.serial,
                           show_3d_viewer=True,
                           enable_nav_map_feed=True) as robot:
        robot.behavior.drive_off_charger()

        fixed_object = robot.world.create_custom_fixed_object(
            Pose(100, 0, 0, angle_z=degrees(0)),
            10,
            100,
            100,
            relative_to_robot=True)
        if fixed_object:
            print("fixed custom object created successfully")

        robot.behavior.go_to_pose(Pose(200, 0, 0, angle_z=degrees(0)),
                                  relative_to_robot=True)
        robot.world.delete_custom_objects()
Пример #7
0
import anki_vector
import time
from anki_vector.util import degrees, distance_mm, speed_mmps, Pose
from anki_vector.events import Events

import functools
import threading
import sys

cube_pose = Pose(x=0, y=0, z=0, angle_z=degrees(0))
observed_event = threading.Event()
moved_event = threading.Event()


def on_oo(event_type, event):
    if (event.object_family == 3):
        observed_event.set()


def on_om(event_type, event):
    moved_event.set()


def main():
    with anki_vector.Robot(requires_behavior_control=True) as robot:

        try:
            while True:
                robot.behavior.set_eye_color(0.0, 1.0)
                robot.anim.play_animation('anim_eyepose_furious')
Пример #8
0
 def __init__(self, x, y, angle, abort_on_stop=True, **action_kwargs):
     self.pose = Pose(x=x, y=y, z=0, angle_z=Angle(degrees=angle))
     self.action_kwargs = action_kwargs
     super().__init__(abort_on_stop)