public async static Task WsgHoming( [InputPin(PropertyMode = PropertyMode.Default, DefaultValue = DEFAULT_WSG_NAME)] string gripperName, CancellationToken cancel = default(CancellationToken)) { var actionName = $"{DEFAULT_WSG_BASE_NAME}/{gripperName}/{DEFAULT_WSG_ACTION_NAME}"; var result = await MotionService.WsgGripperCommand(actionName, WsgCommand.Homing, 0, 0, 0, true, cancel); }
public async static Task MovePoseLinearSupervised( [InputPin(PropertyMode = PropertyMode.Default, Editor = "Pose")] PoseProperty target, [InputPin(PropertyMode = PropertyMode.Default)] string endEffectorName = null, [InputPin(PropertyMode = PropertyMode.Default)] bool collisionChecking = false, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default)] double ikJumpThreshold = 1.6, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (target == null) { throw new ArgumentNullException(nameof(target), "Required property 'target' of MovePoseLinear module was not specified."); } var targetPose = await ResolveProperty(target); var endEffector = MotionService.QueryAvailableEndEffectors().FirstOrDefault(x => x.Name == endEffectorName); if (endEffector == null) { throw new Exception($"EndEffector '{endEffectorName}' not available."); } using (var group = MotionService.CreateMoveGroup(endEffector.MoveGroupName, endEffector.Name)) { group.SampleResolution = sampleResolution; group.IkJumpThreshold = ikJumpThreshold; using (var client = group.GetEndEffector(endEffector.Name).MovePoseLinearSupervisedAsync(targetPose, velocityScaling, collisionChecking, null, cancel)) { await HandleStepwiseMotions(client, group); } } }
public async static Task MoveJWaypointsSupervised( [InputPin(PropertyMode = PropertyMode.Never)] IEnumerable <JointValues> waypoints = null, [InputPin(PropertyMode = PropertyMode.Default)] bool collisionChecking = true, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default)] double maxDeviation = 0.0, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = false, CancellationToken cancel = default(CancellationToken) ) { if (waypoints == null) { throw new ArgumentNullException("Required property 'waypoints' for MoveJWaypoints module was not specified.", nameof(waypoints)); } if (waypoints.ToList().Count == 0) { throw new ArgumentException("Required property 'waypoints' is empty.", nameof(waypoints)); } JointPath path = new JointPath(waypoints.First().JointSet, waypoints); using (var group = MotionService.CreateMoveGroupForJointSet(path.JointSet)) { group.SampleResolution = sampleResolution; using (var client = group.MoveJointPathSupervisedAsync(path, velocityScaling, collisionChecking, maxDeviation, null, cancel)) { await HandleStepwiseMotions(client, group); } } }
public async static Task MoveJointsSupervised( [InputPin(PropertyMode = PropertyMode.Default, Editor = "JointValues")] JointValuesProperty target, [InputPin(PropertyMode = PropertyMode.Default)] bool collisionChecking = true, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (target == null) { throw new ArgumentNullException(nameof(target), "Required property 'target' for MoveJ module was not specified."); } var targetJointValues = await ResolveProperty(target); using (var group = MotionService.CreateMoveGroupForJointSet(targetJointValues.JointSet)) { group.SampleResolution = sampleResolution; using (var client = group.MoveJointsSupervisedAsync(targetJointValues, velocityScaling, collisionChecking, null, cancel)) { await HandleStepwiseMotions(client, group); } } }
public async static Task <MoveGripperResult> MoveGripper( [InputPin(PropertyMode = PropertyMode.Default, DefaultValue = DEFAULT_ROBOTIQ_ACTION_NAME)] string actionName, [InputPin(PropertyMode = PropertyMode.Default)] double position, [InputPin(PropertyMode = PropertyMode.Default, DefaultValue = "50.0")] double maxEffort, CancellationToken cancel = default(CancellationToken)) { return(await MotionService.MoveGripper(actionName, position, maxEffort, cancel)); }
private void InitializeMotionService() { _motionService = new MotionService(); if (_gpioController != null) { _motionService.Initialize(_gpioController); _motionService.MotionEventHandler += HandleMotionEvent; } }
public async static Task <Tuple <double, double, bool, bool, string> > WsgRelease( [InputPin(PropertyMode = PropertyMode.Default, DefaultValue = DEFAULT_WSG_NAME)] string gripperName, [InputPin(PropertyMode = PropertyMode.Default, DefaultValue = "0.05")] double openWidth, [InputPin(PropertyMode = PropertyMode.Default)] double speed = 0.15, CancellationToken cancel = default(CancellationToken)) { var actionName = $"{DEFAULT_WSG_BASE_NAME}/{gripperName}/{DEFAULT_WSG_ACTION_NAME}"; var result = await MotionService.WsgGripperCommand(actionName, WsgCommand.Release, openWidth, speed, 0, true, cancel); var stalled = result.State == (int)WsgState.Error; var reachedGoal = result.State == (int)WsgState.Idle; return(Tuple.Create(result.Width, result.Force, stalled, reachedGoal, result.Status)); }
public async static Task MovePoseWaypointsSupervised( [InputPin(PropertyMode = PropertyMode.Never)] IEnumerable <Pose> waypoints = null, [InputPin(PropertyMode = PropertyMode.Default)] string endEffectorName = null, [InputPin(PropertyMode = PropertyMode.Default)] bool collisionChecking = false, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default, Editor = "JointValues")] JointValuesProperty seed = null, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (waypoints == null) { throw new ArgumentNullException("Required property 'waypoints' for MovePoseLinearWaypointsSupervised module was not specified.", nameof(waypoints)); } if (waypoints.ToList().Count == 0) { throw new ArgumentException("Required property 'waypoints' is empty.", nameof(waypoints)); } var seedValues = await ResolveProperty(seed); var endEffector = MotionService.QueryAvailableEndEffectors().FirstOrDefault(x => x.Name == endEffectorName); if (endEffector == null) { throw new Exception($"EndEffector '{endEffectorName}' not available."); } CartesianPath path = new CartesianPath(waypoints); using (var group = MotionService.CreateMoveGroup(endEffector.MoveGroupName, endEffector.Name)) { if (seed == null) { seedValues = group.CurrentJointPositions; } group.SampleResolution = sampleResolution; group.CollisionCheck = collisionChecking; group.VelocityScaling = velocityScaling; using (var client = group.GetEndEffector(endEffectorName).MoveCartesianPathSupervisedAsync(path, seedValues, cancel)) { await HandleStepwiseMotions(client, group); } } }
public async static Task MoveLWaypoints( [InputPin(PropertyMode = PropertyMode.Never)] IEnumerable <Pose> waypoints = null, [InputPin(PropertyMode = PropertyMode.Default)] string endEffectorName = null, [InputPin(PropertyMode = PropertyMode.Default)] bool collisionChecking = false, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default)] double ikJumpThreshold = 1.6, [InputPin(PropertyMode = PropertyMode.Default)] double maxDeviation = 0.0, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (waypoints == null) { throw new ArgumentNullException("Required property 'waypoints' for MoveLWayPoints module was not specified.", nameof(waypoints)); } if (waypoints.ToList().Count == 0) { throw new ArgumentException("Required property 'waypoints' is empty.", nameof(waypoints)); } var endEffector = MotionService.QueryAvailableEndEffectors().FirstOrDefault(x => x.Name == endEffectorName); if (endEffector == null) { throw new Exception($"EndEffector '{endEffectorName}' not available."); } CartesianPath path = new CartesianPath(waypoints); using (var group = MotionService.CreateMoveGroup(endEffector.MoveGroupName, endEffector.Name)) { group.SampleResolution = sampleResolution; group.IkJumpThreshold = ikJumpThreshold; var planParameters = group.BuildTaskSpacePlanParameters(velocityScaling, collisionChecking, maxDeviation, null, endEffector.Name); var(trajectory, parameters) = group.GetEndEffector(endEffector.Name).PlanMovePoseLinearWaypoints(path, planParameters); await MotionService.ExecuteJointTrajectory(trajectory, parameters.CollisionCheck, cancel); } }
public async static Task MoveJointsCollisionFree( [InputPin(PropertyMode = PropertyMode.Default, Editor = "JointValues")] JointValuesProperty target, [InputPin(PropertyMode = PropertyMode.Default)] string moveGroupName = null, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (target == null) { throw new ArgumentNullException(nameof(target), "Required property 'target' for MoveJointsCollisionFree module was not specified."); } var targetJointValues = await ResolveProperty(target); using (var group = MotionService.CreateMoveGroup(moveGroupName)) { await group.MoveJointsCollisionFreeAsync(targetJointValues, velocityScaling, sampleResolution, cancel); } }
public async static Task MovePoseCollisionFreeSupervised( [InputPin(PropertyMode = PropertyMode.Default, Editor = "Pose")] PoseProperty target, [InputPin(PropertyMode = PropertyMode.Default)] string endEffectorName = null, [InputPin(PropertyMode = PropertyMode.Default)] double velocityScaling = 1, [InputPin(PropertyMode = PropertyMode.Default)] double sampleResolution = 0.05, [InputPin(PropertyMode = PropertyMode.Default, Editor = "JointValues")] JointValuesProperty seed = null, [InputPin(PropertyMode = PropertyMode.Default)] bool cacheResult = true, CancellationToken cancel = default(CancellationToken) ) { if (target == null) { throw new ArgumentNullException(nameof(target), "Required property 'target' for MovePoseCollisionFreeSupervised module was not specified."); } var endEffector = MotionService.QueryAvailableEndEffectors().FirstOrDefault(x => x.Name == endEffectorName); if (endEffector == null) { throw new Exception($"EndEffector '{endEffectorName}' not available."); } var targetPose = await ResolveProperty(target); var seedValues = await ResolveProperty(seed); using (var group = MotionService.CreateMoveGroup(endEffector.MoveGroupName, endEffector.Name)) { if (seed == null) { seedValues = group.CurrentJointPositions; } group.SampleResolution = sampleResolution; using (var client = group.GetEndEffector(endEffector.Name).MovePoseCollisionFreeSupervisedAsync(targetPose, seedValues, cancel)) { await HandleStepwiseMotions(client, group); } } }
public void AddTraineeeMotion(int id, string login, int persent, [FromBody] string file) { MotionService service = new MotionService(services); service.AddTraineeMotion(id, login, file, persent); }
public void AddProfessionalMotion(int id, [FromBody] string file) { MotionService service = new MotionService(services); service.AddProfessionalMotion(id, file); }
public List <string> GetProfesionalMotions(int id) { MotionService service = new MotionService(services); return(service.GetProfessionalMotion(id)); }