def pre_procedure(client): """Pre fabrication setup, speed, acceleration, tool, work object and initial pose. Uses ``fab_conf`` set up using :func:`compas_rcf.fab_data.interactive_conf_setup` for fabrication settings. Parameters ---------- client : :class:`compas_rrc.AbbClient` Client connected to controller procedure should be sent to. """ grip_and_release( client, fab_conf["tool"]["io_needles_pin"].get(), fab_conf["tool"]["release_state"].get(), wait_before=fab_conf["tool"]["wait_before_io"].get(), wait_after=fab_conf["tool"]["wait_after_io"].get(), ) client.send(SetTool(fab_conf["tool"]["tool_name"].as_str())) log.debug("Tool {} set.".format(fab_conf["tool"]["tool_name"].get())) client.send(SetWorkObject(fab_conf["wobjs"]["placing_wobj_name"].as_str())) log.debug("Work object {} set.".format( fab_conf["wobjs"]["placing_wobj_name"].get())) # Set Acceleration client.send( SetAcceleration( fab_conf["speed_values"]["accel"].as_number(), fab_conf["speed_values"]["accel_ramp"].as_number(), )) log.debug("Acceleration values set.") # Set Max Speed client.send( SetMaxSpeed( fab_conf["speed_values"]["speed_override"].as_number(), fab_conf["speed_values"]["speed_max_tcp"].as_number(), )) log.debug("Speed set.") # Initial configuration client.send( MoveToJoints( fab_conf["safe_joint_positions"]["start"].get(), EXTERNAL_AXIS_DUMMY, fab_conf["movement"]["speed_travel"].as_number(), fab_conf["movement"]["zone_travel"].get(ZoneDataTemplate()), )) log.debug("Sent move to safe joint position")
def pre_procedure(self): """Pre fabrication setup, speed, acceleration, tool, work object and initial pose. Uses ``fab_conf`` set up using :func:`compas_rcf.fab_data.interactive_conf_setup` for fabrication settings. Parameters ---------- client : :class:`compas_rrc.AbbClient` Client connected to controller procedure should be sent to. """ # for safety self.retract_needles() self.send(SetTool(self.pick_place_tool.name)) log.debug("Tool {} set.".format(self.pick_place_tool.name)) self.send(SetWorkObject(self.wobjs.place)) log.debug("Work object {} set.".format(self.wobjs.place)) # Set Acceleration self.send( SetAcceleration(self.global_speed_accel.accel, self.global_speed_accel.accel_ramp)) log.debug("Acceleration values set.") # Set Max Speed self.send( SetMaxSpeed( self.global_speed_accel.speed_override, self.global_speed_accel.speed_max_tcp, )) log.debug("Speed set.") # Initial configuration self.send( MoveToJoints( self.set_joint_pos.start, self.EXTERNAL_AXIS_DUMMY, self.speed.travel, self.zone.travel, )) log.debug("Sent move to safe joint position")
def go_to_joint_pos(args: argparse.Namespace) -> None: """Send instruction to go to joint position. Parameters ---------- args : :class:`argparse.Namespace` """ selection_instructions = { "Calibration position": CALIBRATION_JOINT_POSITION, "Travel position": TRAVEL_JOINT_POSITION, } compose_up_driver(args.controller) selection = questionary.select( "Select joint position to go to", selection_instructions.keys() ).ask() log.debug(f"{selection} selected.") with AbbRcfClient(ros_port=9090) as client: client.ensure_connection() client.send(SetAcceleration(ACCEL, ACCEL_RAMP)) client.send(SetMaxSpeed(SPEED_OVERRIDE, SPEED_MAX_TCP)) client.confirm_start() log_msg = f"Moving to {selection.lower()}." client.send(PrintText(log_msg)) log.info(log_msg) client.send( MoveToJoints( selection_instructions[selection], client.EXTERNAL_AXES_DUMMY, SPEED, ZONE, ) )
def std_move_to_frame( frame, tool="tool0", wobj="wobj0", motion_type=Motion.LINEAR, speed=200, accel=100, zone=Zone.FINE, timeout=None, ): """Move robot arm to target or targets. Parameters ---------- frame : :class:`compas.geometry.Frame` or :obj:`list` of :class:`compas.geometry.Frame` Target frame or frames. tool : :obj:`str` Name of tool as named in RAPID code on controller to use for TCP data. wobj : :obj:`str` Name of work object as named in RAPID code on controller to use for coordinate system. motion_type : :class:`compas_rrc.Motion` Motion type, either linear (:class:`~compas_rrc.Motion.LINEAR`) or joint (:class:`~compas_rrc.Motion.JOINT`). speed : :obj:`float` TCP speed in mm/s. Limited by hard coded max speed in this function as well as safety systems on controller. accel : :obj:`float` Acceleration in percentage of standard acceleration. zone : :class:`compas_rrc.Zone` Set zone value of movement, (acceptable deviation from target). timeout : :obj:`float` Time to wait for indication of finished movement. If not defined no feedback will be requested. """ # noqa: E501 if not isinstance(frame, Sequence): frames = [frame] else: frames = frame with RosClient() as ros: # Create ABB Client abb = AbbClient(ros) abb.run(timeout=5) abb.send(SetTool(tool)) abb.send(SetWorkObject(wobj)) # Set acceleration data ramp = 100 # % Higher values makes the acceleration ramp longer abb.send(SetAcceleration(accel, ramp)) # Set speed override and max speed speed_override = 100 # % max_tcp_speed = 500 # mm/s abb.send(SetMaxSpeed(speed_override, max_tcp_speed)) # Move to Frame for f in frames: abb.send( PrintText(" Moving to {:.3f}, {:.3f}, {:.3f}.".format( *f.point.data))) abb.send(MoveToFrame(f, speed, zone, motion_type)) if timeout: abb.send_and_wait(Noop(), timeout=timeout)