first commit
This commit is contained in:
13
Assets/dobot/Sc/Frame.cs
Normal file
13
Assets/dobot/Sc/Frame.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Frame
|
||||
{
|
||||
public Vector3 Position;
|
||||
public Quaternion Rotation;
|
||||
|
||||
public Frame(Vector3 p, Quaternion r)
|
||||
{
|
||||
Position = p;
|
||||
Rotation = r;
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/Frame.cs.meta
Normal file
2
Assets/dobot/Sc/Frame.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f7d94ca20c2ce04e86338988f5d8668
|
||||
34
Assets/dobot/Sc/MotionPlanner.cs
Normal file
34
Assets/dobot/Sc/MotionPlanner.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MotionPlanner
|
||||
{
|
||||
public Frame[] GeneratePath(Frame start, Frame end, int steps)
|
||||
{
|
||||
var list = new List<Frame>();
|
||||
if (steps <= 0)
|
||||
{
|
||||
list.Add(new Frame(end.Position, end.Rotation));
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
for (int i = 0; i <= steps; i++)
|
||||
{
|
||||
float t = i / (float)steps;
|
||||
Vector3 pos = Vector3.Lerp(start.Position, end.Position, t);
|
||||
Quaternion rot = Quaternion.Slerp(start.Rotation, end.Rotation, t);
|
||||
list.Add(new Frame(pos, rot));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
|
||||
// Utility: create N repeated frames (hold)
|
||||
public Frame[] RepeatFrame(Frame f, int count)
|
||||
{
|
||||
if (count <= 0) return new Frame[0];
|
||||
Frame[] arr = new Frame[count];
|
||||
for (int i = 0; i < count; i++) arr[i] = new Frame(f.Position, f.Rotation);
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/MotionPlanner.cs.meta
Normal file
2
Assets/dobot/Sc/MotionPlanner.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e04dc4a0c65cf84f8b5e35021278aff
|
||||
77
Assets/dobot/Sc/PickDropHandler.cs
Normal file
77
Assets/dobot/Sc/PickDropHandler.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class RobotController
|
||||
{
|
||||
public class PickDropHandler
|
||||
{
|
||||
private Animator animator;
|
||||
private AnimationClip animationUClip;
|
||||
private AnimationClip animationDClip;
|
||||
|
||||
public void Init(Animator animator)
|
||||
{
|
||||
this.animator = animator;
|
||||
animator.SetBool("p", false);
|
||||
animator.SetBool("d", false);
|
||||
|
||||
InitializeAnimationClips();
|
||||
}
|
||||
|
||||
private void InitializeAnimationClips()
|
||||
{
|
||||
if (animator == null || animator.runtimeAnimatorController == null)
|
||||
{
|
||||
Debug.LogError("Animator hoặc AnimatorController không được gán!");
|
||||
return;
|
||||
}
|
||||
|
||||
var clips = animator.runtimeAnimatorController.animationClips;
|
||||
foreach (var clip in clips)
|
||||
{
|
||||
if (clip.name.ToLower().Contains("pick"))
|
||||
animationUClip = clip;
|
||||
else if (clip.name.ToLower().Contains("drop"))
|
||||
animationDClip = clip;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator PlayPick(MonoBehaviour runner)
|
||||
{
|
||||
if (runner == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runner));
|
||||
}
|
||||
|
||||
animator.SetBool("p", true);
|
||||
animator.SetBool("d", false);
|
||||
yield return new WaitForSeconds(animationUClip != null ? animationUClip.length : 0f);
|
||||
}
|
||||
|
||||
public IEnumerator PlayDrop(MonoBehaviour runner)
|
||||
{
|
||||
if (runner == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runner));
|
||||
}
|
||||
|
||||
animator.SetBool("p", false);
|
||||
animator.SetBool("d", true);
|
||||
yield return new WaitForSeconds(animationDClip != null ? animationDClip.length : 0f);
|
||||
}
|
||||
|
||||
public void AttachObjToAmr(Transform endEffector, Transform obj)
|
||||
{
|
||||
if (obj == null) return;
|
||||
obj.SetParent(endEffector);
|
||||
obj.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||
}
|
||||
|
||||
public void DetachObj(Transform obj)
|
||||
{
|
||||
if (obj != null)
|
||||
obj.SetParent(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/PickDropHandler.cs.meta
Normal file
2
Assets/dobot/Sc/PickDropHandler.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e92a39b818e889f459c8c282fff6db3f
|
||||
524
Assets/dobot/Sc/Robot2Controller.cs
Normal file
524
Assets/dobot/Sc/Robot2Controller.cs
Normal file
@@ -0,0 +1,524 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using static RobotController;
|
||||
|
||||
public partial class Robot2Controller : MonoBehaviour
|
||||
{
|
||||
// ===== Enums =====
|
||||
public enum StepType { Move, Pick, Drop, AttachA, AttachB, DetachA, DetachB, Detach, CustomAction, Delay, LinearMove, MoveJoints, Parallel }
|
||||
public enum GraspMode { Top, Right, Left, Font }
|
||||
public enum EffectorType { A, B } // NEW
|
||||
|
||||
// ===== Nested Classes =====
|
||||
[System.Serializable]
|
||||
public class Step
|
||||
{
|
||||
public StepType Type;
|
||||
public Frame[] Path;
|
||||
public System.Action Action;
|
||||
public float DelayTime;
|
||||
public float[] JointAngles;
|
||||
public float MoveDuration;
|
||||
public List<IEnumerator> ParallelCoroutines;
|
||||
public EffectorType Effector; // NEW
|
||||
|
||||
public Step(StepType type, EffectorType effector = EffectorType.A)
|
||||
{
|
||||
Type = type;
|
||||
Effector = effector;
|
||||
}
|
||||
}
|
||||
|
||||
public class HomeData
|
||||
{
|
||||
public float[] Angles;
|
||||
public Frame FrameAtZero;
|
||||
public Frame FrameAtAngles;
|
||||
|
||||
public HomeData(float[] angles, Frame frameAtZero, Frame frameAtAngles)
|
||||
{
|
||||
Angles = angles;
|
||||
FrameAtZero = frameAtZero;
|
||||
FrameAtAngles = frameAtAngles;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Public Fields =====
|
||||
[Header("Joints Setup")]
|
||||
public RobotJoint[] Joints;
|
||||
|
||||
[Header("Phoi từ ABB (đang xử lý)")]
|
||||
public Transform currentPhoiFromAbbA;
|
||||
public Transform currentPhoiFromAbbB;
|
||||
|
||||
[Header("Targets")]
|
||||
public Transform target3;
|
||||
public Transform target4;
|
||||
public Transform target42;
|
||||
public Transform linearTarget4;
|
||||
public Transform target51;
|
||||
public Transform target52;
|
||||
public Transform target7;
|
||||
public Transform target8;
|
||||
public float LinearSpeed = 1f;
|
||||
public Transform LinearBase;
|
||||
public Transform LinearHome;
|
||||
|
||||
[Header("Motion Settings")]
|
||||
public int Steps = 80;
|
||||
public float StepDelay = 0.02f;
|
||||
public float LiftHeight = 0.2f;
|
||||
public int HoldFrames1 = 30;
|
||||
[Range(0f, 1f)] public float ApplyAlpha = 0.35f;
|
||||
|
||||
[Header("Animation Handler")]
|
||||
public Animator armAnimator;
|
||||
|
||||
[Header("References")]
|
||||
public RobotController robot1;
|
||||
|
||||
[Header("Phoi Settings (clones)")]
|
||||
public Transform PhoiForBPrefab; // prefab gốc
|
||||
public Transform PhoiForBInstance; // instance của mỗi vòng
|
||||
|
||||
|
||||
[Header("Phoi từ ABB (đang xử lý)")]
|
||||
public Transform currentPhoiFromAbb;
|
||||
|
||||
[Header("End Effectors")]
|
||||
public Transform EndEffectorA;
|
||||
public Transform EndEffectorB;
|
||||
|
||||
// ===== Private Fields =====
|
||||
private SolverCCD solverA;
|
||||
private SolverCCD solverB;
|
||||
private MotionPlanner planner;
|
||||
private List<Step> steps;
|
||||
private int currentStepIndex;
|
||||
private float[] lastAppliedAngles;
|
||||
private PickDropHandler pickDropHandler;
|
||||
|
||||
private readonly Queue<Transform> phoiQueue = new();
|
||||
private readonly Queue<Transform> abbPhoiQueue = new();
|
||||
|
||||
public bool IsPart2Done { get; private set; } = true;
|
||||
|
||||
// ===== Unity Lifecycle =====
|
||||
void Start()
|
||||
{
|
||||
if (Joints.Length == 0 || EndEffectorA == null || EndEffectorB == null || armAnimator == null)
|
||||
{
|
||||
Debug.LogError("Thiếu cấu hình Robot2Controller!");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var j in Joints) j.Init();
|
||||
|
||||
solverA = new SolverCCD(Joints, EndEffectorA);
|
||||
solverB = new SolverCCD(Joints, EndEffectorB);
|
||||
planner = new MotionPlanner();
|
||||
|
||||
lastAppliedAngles = ReadCurrentAngles();
|
||||
|
||||
pickDropHandler = new PickDropHandler();
|
||||
pickDropHandler.Init(armAnimator);
|
||||
|
||||
//InitPhoiStack();
|
||||
}
|
||||
|
||||
// ===== Public API =====
|
||||
public IEnumerator RunStepsExternal()
|
||||
{
|
||||
// spawn one phoi B at transfer location for this cycle (so AttachB has something)
|
||||
if (PhoiForBPrefab != null && target4 != null)
|
||||
{
|
||||
Quaternion zRot = Quaternion.Euler(0, 0, 90);
|
||||
currentPhoiFromAbbB = Instantiate(PhoiForBPrefab, target4.position, target4.rotation * zRot);
|
||||
currentPhoiFromAbbB.name = $"PhoiForB_{Time.frameCount}";
|
||||
Debug.Log($"[RunStepsExternal] Spawned {currentPhoiFromAbbB.name}");
|
||||
}
|
||||
|
||||
BuildSteps();
|
||||
currentStepIndex = 0;
|
||||
|
||||
while (currentStepIndex < steps.Count)
|
||||
{
|
||||
Step step = steps[currentStepIndex];
|
||||
|
||||
switch (step.Type)
|
||||
{
|
||||
case StepType.Move:
|
||||
yield return StartCoroutine(DoMove(step.Path, step.Effector));
|
||||
break;
|
||||
case StepType.MoveJoints:
|
||||
yield return StartCoroutine(DoMoveToJoints(step.JointAngles, step.MoveDuration));
|
||||
break;
|
||||
case StepType.Pick:
|
||||
yield return StartCoroutine(pickDropHandler.PlayPick(this));
|
||||
break;
|
||||
case StepType.Drop:
|
||||
yield return StartCoroutine(pickDropHandler.PlayDrop(this));
|
||||
break;
|
||||
case StepType.AttachA:
|
||||
HandleAttachA();
|
||||
break;
|
||||
case StepType.DetachA:
|
||||
HandleDetachA();
|
||||
break;
|
||||
case StepType.AttachB:
|
||||
HandleAttachB();
|
||||
break;
|
||||
case StepType.DetachB:
|
||||
HandleDetachB();
|
||||
break;
|
||||
case StepType.Detach:
|
||||
DA();
|
||||
DB();
|
||||
break;
|
||||
case StepType.CustomAction:
|
||||
step.Action?.Invoke();
|
||||
break;
|
||||
case StepType.Delay:
|
||||
yield return new WaitForSeconds(step.DelayTime);
|
||||
break;
|
||||
case StepType.LinearMove:
|
||||
if (step.Path != null && step.Path.Length > 0)
|
||||
yield return StartCoroutine(DoLinearMove(step.Path[0], step.DelayTime));
|
||||
break;
|
||||
case StepType.Parallel:
|
||||
if (step.ParallelCoroutines != null && step.ParallelCoroutines.Count > 0)
|
||||
yield return StartCoroutine(RunParallel(step.ParallelCoroutines));
|
||||
break;
|
||||
}
|
||||
|
||||
currentStepIndex++;
|
||||
}
|
||||
|
||||
// ✅ Sau khi kết thúc 1 vòng → xóa phôi của A
|
||||
if (currentPhoiFromAbbA != null) { Destroy(currentPhoiFromAbbA.gameObject); currentPhoiFromAbbA = null; }
|
||||
}
|
||||
|
||||
public bool HasPhoiAtTarget3() => abbPhoiQueue.Count > 0;
|
||||
|
||||
public void EnqueuePhoi(Transform phoi)
|
||||
{
|
||||
if (phoi == null)
|
||||
{
|
||||
Debug.LogWarning("EnqueuePhoi nhận null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Snap về target3
|
||||
phoi.SetPositionAndRotation(target3.position, target3.rotation);
|
||||
phoi.SetParent(null);
|
||||
|
||||
abbPhoiQueue.Enqueue(phoi);
|
||||
}
|
||||
|
||||
// ===== Attach / Detach =====
|
||||
void HandleAttachA()
|
||||
{
|
||||
if (abbPhoiQueue.Count == 0) return;
|
||||
|
||||
currentPhoiFromAbbA = abbPhoiQueue.Dequeue();
|
||||
if (currentPhoiFromAbbA == null) return;
|
||||
|
||||
pickDropHandler.AttachObjToAmr(EndEffectorA, currentPhoiFromAbbA);
|
||||
Debug.Log($"[AttachA] {currentPhoiFromAbbA.name} gắn vào EndEffectorA");
|
||||
}
|
||||
|
||||
void HandleDetachA()
|
||||
{
|
||||
if (currentPhoiFromAbbA != null)
|
||||
{
|
||||
pickDropHandler.DetachObj(currentPhoiFromAbbA);
|
||||
Debug.Log($"[DetachA] Tháo {currentPhoiFromAbbA.name} khỏi EndEffectorA");
|
||||
}
|
||||
}
|
||||
void DA()
|
||||
{
|
||||
Destroy(currentPhoiFromAbbA.gameObject); // ❌ Xóa luôn phôi
|
||||
currentPhoiFromAbbA = null;
|
||||
}
|
||||
|
||||
void HandleAttachB()
|
||||
{
|
||||
if (currentPhoiFromAbbB == null)
|
||||
{
|
||||
Debug.LogWarning("[AttachB] currentPhoiFromAbbB NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
pickDropHandler.AttachObjToAmr(EndEffectorB, currentPhoiFromAbbB);
|
||||
Debug.Log($"[AttachB] {currentPhoiFromAbbB.name} gắn vào EndEffectorB");
|
||||
}
|
||||
|
||||
void HandleDetachB()
|
||||
{
|
||||
if (currentPhoiFromAbbB != null)
|
||||
{
|
||||
pickDropHandler.DetachObj(currentPhoiFromAbbB);
|
||||
Debug.Log($"[DetachB] Tháo và Destroy {currentPhoiFromAbbB.name}");
|
||||
}
|
||||
}
|
||||
void DB()
|
||||
{
|
||||
Destroy(currentPhoiFromAbbB.gameObject); // ❌ Xóa luôn phôi
|
||||
currentPhoiFromAbbB = null;
|
||||
}
|
||||
IEnumerator RunParallel(List<IEnumerator> coroutines)
|
||||
{
|
||||
var running = coroutines.Select(StartCoroutine).ToList();
|
||||
foreach (var r in running) yield return r;
|
||||
}
|
||||
|
||||
void BuildSteps()
|
||||
{
|
||||
steps = new List<Step>();
|
||||
|
||||
HomeData homeAtLinearHome = GetHomeAtLinear(LinearHome);
|
||||
HomeData homeAtTarget4 = GetHomeAtLinear(linearTarget4, homeAtLinearHome.Angles);
|
||||
|
||||
Frame t1 = CreateFrameFromTransform(target3, GraspMode.Top);
|
||||
Frame k1 = CreateLiftFrame(t1, LiftHeight, GraspMode.Top);
|
||||
|
||||
Quaternion yOffset = Quaternion.Euler(0, -90, 0);
|
||||
Quaternion yOffsetv = Quaternion.Euler(0, 90, 0);
|
||||
|
||||
Frame t2 = CreateFrameFromTransform(target4, GraspMode.Right, yOffset);
|
||||
Frame t2v = CreateFrameFromTransform(target42, GraspMode.Right, yOffsetv);
|
||||
|
||||
Frame t3 = CreateFrameFromTransform(target7);
|
||||
Frame t4 = CreateFrameFromTransform(target8);
|
||||
Frame k4 = CreateLiftFrame(t4, LiftHeight, GraspMode.Top);
|
||||
|
||||
Frame k2 = CreateLiftFrame(t2, LiftHeight, GraspMode.Right);
|
||||
Frame k2v = CreateLiftFrame(t2v, LiftHeight, GraspMode.Right);
|
||||
|
||||
|
||||
// Về home
|
||||
steps.Add(new Step(StepType.MoveJoints)
|
||||
{
|
||||
JointAngles = CloneAngles(homeAtLinearHome.Angles),
|
||||
MoveDuration = 1f
|
||||
});
|
||||
|
||||
// Pick object
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(new Frame(EndEffectorA.position, EndEffectorA.rotation), k1, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(k1, t1, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.RepeatFrame(t1, HoldFrames1) });
|
||||
steps.Add(new Step(StepType.AttachA));
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(t1, k1, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.MoveJoints){JointAngles = CloneAngles(homeAtLinearHome.Angles),MoveDuration = 1f});
|
||||
steps.Add(new Step(StepType.LinearMove){Path = new[] { CreateFrameFromTransform(linearTarget4) },DelayTime = 3f});
|
||||
steps.Add(new Step(StepType.Move, EffectorType.B) { Path = planner.GeneratePath(homeAtTarget4.FrameAtZero, k2, Steps).ToArray() });
|
||||
|
||||
steps.Add(new Step(StepType.Move, EffectorType.B) { Path = planner.GeneratePath(k2, t2, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move, EffectorType.B) { Path = planner.RepeatFrame(t2, HoldFrames1) });
|
||||
steps.Add(new Step(StepType.AttachB));
|
||||
steps.Add(new Step(StepType.Move, EffectorType.B) { Path = planner.GeneratePath(t2, k2, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move, EffectorType.B) { Path = planner.GeneratePath(k2, homeAtTarget4.FrameAtAngles, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(homeAtTarget4.FrameAtAngles, k2v, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(k2v, t2v, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.RepeatFrame(t2v, HoldFrames1) });
|
||||
steps.Add(new Step(StepType.DetachA));
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(t2v,k2v, Steps).ToArray() });
|
||||
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(k2v, homeAtTarget4.FrameAtAngles, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(homeAtTarget4.FrameAtAngles, t3, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(t3,k4, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(k4,t4, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.RepeatFrame(t4, HoldFrames1) });
|
||||
steps.Add(new Step(StepType.DetachB));
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(t4,k4, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(k4,t3, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Move) { Path = planner.GeneratePath(t3,homeAtTarget4.FrameAtAngles, Steps).ToArray() });
|
||||
steps.Add(new Step(StepType.Detach));
|
||||
|
||||
// Snap lại home
|
||||
steps.Add(new Step(StepType.MoveJoints){ JointAngles = CloneAngles(homeAtLinearHome.Angles), MoveDuration = 1f});
|
||||
|
||||
// Parallel: Linear về + Part1 + Part2
|
||||
steps.Add(new Step(StepType.Parallel)
|
||||
{
|
||||
ParallelCoroutines = new List<IEnumerator> {
|
||||
DoLinearMove(new Frame(LinearHome.position, LinearHome.rotation), 3f),
|
||||
|
||||
Part2Routine()
|
||||
}
|
||||
});
|
||||
|
||||
steps.Add(new Step(StepType.Delay) { DelayTime = 1f });
|
||||
}
|
||||
|
||||
IEnumerator Part1Routine()
|
||||
{
|
||||
if (currentPhoiFromAbb == null) yield break;
|
||||
|
||||
yield return MoveObject(currentPhoiFromAbb, target4, target4, 0f, true);
|
||||
currentPhoiFromAbb = null;
|
||||
}
|
||||
|
||||
IEnumerator Part2Routine()
|
||||
{
|
||||
StartCoroutine(Part1Routine());
|
||||
Task.Delay(1000);
|
||||
IsPart2Done = false;
|
||||
if (phoiQueue.Count == 0) yield break;
|
||||
|
||||
Transform currentPhoi = phoiQueue.Dequeue();
|
||||
currentPhoi.gameObject.SetActive(true);
|
||||
|
||||
yield return MoveObject(currentPhoi, target51, target52, 3f, true);
|
||||
IsPart2Done = true;
|
||||
}
|
||||
|
||||
// ===== Motion Helpers =====
|
||||
public IEnumerator MoveObject(Transform obj, Transform from, Transform to, float duration, bool destroyOnFinish = false)
|
||||
{
|
||||
if (obj == null) yield break;
|
||||
|
||||
from.GetPositionAndRotation(out Vector3 startPos, out Quaternion startRot);
|
||||
float elapsed = 0f;
|
||||
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
obj.SetPositionAndRotation(
|
||||
Vector3.Lerp(startPos, to.position, t),
|
||||
Quaternion.Slerp(startRot, to.rotation, t)
|
||||
);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (destroyOnFinish)
|
||||
{
|
||||
Destroy(obj.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator DoMove(Frame[] path, EffectorType effector)
|
||||
{
|
||||
SolverCCD solver = (effector == EffectorType.A) ? solverA : solverB;
|
||||
foreach (var frame in path)
|
||||
{
|
||||
float[] jointValues = solver.SolveIK(frame);
|
||||
for (int j = 0; j < Joints.Length && j < jointValues.Length; j++)
|
||||
{
|
||||
float applied = Mathf.Lerp(lastAppliedAngles[j], jointValues[j], ApplyAlpha);
|
||||
lastAppliedAngles[j] = applied;
|
||||
Joints[j].SetValue(applied);
|
||||
}
|
||||
yield return new WaitForSeconds(StepDelay);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator DoMoveToJoints(float[] targetAngles, float duration = 0.75f)
|
||||
{
|
||||
if (targetAngles == null) yield break;
|
||||
|
||||
int frames = Steps;
|
||||
if (duration > 0f) StepDelay = duration / frames;
|
||||
|
||||
float[] startAngles = ReadCurrentAngles();
|
||||
|
||||
for (int f = 0; f < frames; f++)
|
||||
{
|
||||
float t = (float)f / (frames - 1);
|
||||
for (int j = 0; j < Joints.Length; j++)
|
||||
{
|
||||
float angle = Mathf.Lerp(startAngles[j], targetAngles[j], t);
|
||||
Joints[j].SetValue(angle);
|
||||
lastAppliedAngles[j] = angle;
|
||||
}
|
||||
yield return new WaitForSeconds(StepDelay);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator DoLinearMove(Frame target, float duration)
|
||||
{
|
||||
if (LinearBase == null) yield break;
|
||||
|
||||
LinearBase.GetPositionAndRotation(out Vector3 startPos, out Quaternion startRot);
|
||||
float elapsed = 0f;
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
LinearBase.SetPositionAndRotation(
|
||||
Vector3.Lerp(startPos, target.Position, t),
|
||||
Quaternion.Slerp(startRot, target.Rotation, t)
|
||||
);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Utility Helpers =====
|
||||
HomeData GetHomeAtLinear(Transform linearPose, float[] referenceAngles = null)
|
||||
{
|
||||
if (linearPose == null) return null;
|
||||
|
||||
LinearBase.GetPositionAndRotation(out Vector3 oldPos, out Quaternion oldRot);
|
||||
float[] backupAngles = ReadCurrentAngles();
|
||||
|
||||
LinearBase.SetPositionAndRotation(linearPose.position, linearPose.rotation);
|
||||
|
||||
float[] refAngles = referenceAngles != null ? CloneAngles(referenceAngles) : ReadCurrentAngles();
|
||||
|
||||
for (int i = 0; i < Joints.Length; i++) Joints[i].SetValue(0f);
|
||||
Frame frameAtZero = new(EndEffectorA.position, EndEffectorA.rotation);
|
||||
|
||||
for (int i = 0; i < Joints.Length; i++) Joints[i].SetValue(refAngles[i]);
|
||||
Frame frameAtAngles = new(EndEffectorA.position, EndEffectorA.rotation);
|
||||
|
||||
for (int i = 0; i < Joints.Length; i++) Joints[i].SetValue(backupAngles[i]);
|
||||
LinearBase.SetPositionAndRotation(oldPos, oldRot);
|
||||
|
||||
return new HomeData(refAngles, frameAtZero, frameAtAngles);
|
||||
}
|
||||
|
||||
float[] ReadCurrentAngles()
|
||||
{
|
||||
float[] a = new float[Joints.Length];
|
||||
for (int i = 0; i < Joints.Length; i++) a[i] = Joints[i].GetValue();
|
||||
return a;
|
||||
}
|
||||
|
||||
float[] CloneAngles(float[] src)
|
||||
{
|
||||
if (src == null) return null;
|
||||
var dst = new float[src.Length];
|
||||
System.Array.Copy(src, dst, src.Length);
|
||||
return dst;
|
||||
}
|
||||
|
||||
private Frame CreateLiftFrame(Frame target, float lift, GraspMode _) =>
|
||||
new(target.Position + Vector3.up * lift, target.Rotation);
|
||||
|
||||
Frame CreateFrameFromTransform(Transform t, GraspMode mode, Quaternion extraRotation) =>
|
||||
new(t.position, GetGraspRotation(mode) * extraRotation);
|
||||
|
||||
Frame CreateFrameFromTransform(Transform t, GraspMode mode) =>
|
||||
new(t.position, GetGraspRotation(mode));
|
||||
|
||||
|
||||
Frame CreateFrameFromTransform(Transform t) =>
|
||||
new(t.position, t.rotation);
|
||||
|
||||
|
||||
Quaternion GetGraspRotation(GraspMode mode)
|
||||
{
|
||||
return mode switch
|
||||
{
|
||||
GraspMode.Right => Quaternion.LookRotation(Vector3.up, Vector3.left),
|
||||
GraspMode.Top => Quaternion.LookRotation(Vector3.right, Vector3.up),
|
||||
GraspMode.Left => Quaternion.LookRotation(Vector3.left),
|
||||
_ => Quaternion.identity,
|
||||
};
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/Robot2Controller.cs.meta
Normal file
2
Assets/dobot/Sc/Robot2Controller.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e65dfdf8ad7bb34889658e82d54bf64
|
||||
316
Assets/dobot/Sc/RobotController.cs
Normal file
316
Assets/dobot/Sc/RobotController.cs
Normal file
@@ -0,0 +1,316 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class RobotController : MonoBehaviour
|
||||
{
|
||||
public enum StepType { Move, MoveJoints, Pick, Drop, Attach, Detach, Action, Delay, CustomAction }
|
||||
|
||||
[System.Serializable]
|
||||
public class Step
|
||||
{
|
||||
public StepType Type;
|
||||
public Frame[] Path;
|
||||
public System.Action Action;
|
||||
public float Delay;
|
||||
public float[] JointAngles;
|
||||
public float MoveDuration;
|
||||
|
||||
public Step(StepType type, Frame[] path = null, System.Action action = null, float delay = 0f, float[] jointAngles = null, float moveDuration = 0)
|
||||
{
|
||||
Type = type;
|
||||
Path = path;
|
||||
Action = action;
|
||||
Delay = delay;
|
||||
JointAngles = jointAngles;
|
||||
MoveDuration = moveDuration;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Joints Setup")]
|
||||
public RobotJoint[] joints;
|
||||
|
||||
[Header("End Effector")]
|
||||
public Transform endEffector;
|
||||
|
||||
[Header("Targets")]
|
||||
public Transform target1;
|
||||
public Transform target2;
|
||||
public Transform target3;
|
||||
public int HoldFrames = 30;
|
||||
|
||||
[Header("Settings")]
|
||||
public int stepsPerMove = 80;
|
||||
public float stepDelay = 0.02f;
|
||||
public float liftHeight = 0.2f;
|
||||
[Range(0f, 1f)] public float applyAlpha = 0.35f;
|
||||
|
||||
[Header("Animation")]
|
||||
public Animator armAnimator;
|
||||
|
||||
[Header("Objects")]
|
||||
public Transform objectPrefab;
|
||||
public Transform currentObject;
|
||||
|
||||
[Header("Stack Settings")]
|
||||
public Transform objectStacktran;
|
||||
public int stackCount = 12;
|
||||
public float stackSpacingY = 0.1f;
|
||||
public float shiftDelay = 3f;
|
||||
public float shiftDuration = 0.5f;
|
||||
|
||||
SolverCCD solver;
|
||||
MotionPlanner planner;
|
||||
PickDropHandler pickDrop;
|
||||
List<Step> steps;
|
||||
float[] lastAngles;
|
||||
|
||||
private readonly List<Transform> objectStack = new();
|
||||
private Transform nextTop;
|
||||
|
||||
public Transform LastStackObject { get; set; } // đối tượng ABB vừa đặt ở target3
|
||||
public System.Action OnCompleted;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (joints == null || joints.Length == 0 || endEffector == null)
|
||||
{
|
||||
Debug.LogError("RobotController: Thiếu joints hoặc endEffector!");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var j in joints) j.Init();
|
||||
solver = new SolverCCD(joints, endEffector);
|
||||
planner = new MotionPlanner();
|
||||
pickDrop = new PickDropHandler();
|
||||
pickDrop.Init(armAnimator);
|
||||
|
||||
lastAngles = new float[joints.Length];
|
||||
for (int i = 0; i < joints.Length; i++) lastAngles[i] = joints[i].GetValue();
|
||||
|
||||
InitObjectStack();
|
||||
}
|
||||
|
||||
// ========== STACK ==========
|
||||
void InitObjectStack()
|
||||
{
|
||||
if (objectPrefab == null || objectStacktran == null) return;
|
||||
|
||||
objectStack.Clear();
|
||||
objectStacktran.GetPositionAndRotation(out Vector3 basePos, out Quaternion baseRot);
|
||||
for (int i = 0; i < stackCount; i++)
|
||||
{
|
||||
Vector3 pos = basePos + Vector3.up * (stackSpacingY * i);
|
||||
Transform obj = Instantiate(objectPrefab, pos, baseRot, objectStacktran);
|
||||
obj.name = $"StackObject_{i}";
|
||||
objectStack.Add(obj);
|
||||
}
|
||||
nextTop = null;
|
||||
}
|
||||
|
||||
Transform PeekTop() => objectStack.Count > 0 ? objectStack.Last() : null;
|
||||
Transform PopTop()
|
||||
{
|
||||
if (objectStack.Count == 0) return null;
|
||||
var t = objectStack.Last();
|
||||
objectStack.RemoveAt(objectStack.Count - 1);
|
||||
return t;
|
||||
}
|
||||
|
||||
IEnumerator ShiftStackUpAfterDelay()
|
||||
{
|
||||
yield return new WaitForSeconds(shiftDelay);
|
||||
foreach (var obj in objectStack)
|
||||
{
|
||||
Vector3 targetPos = obj.position + Vector3.up * stackSpacingY;
|
||||
StartCoroutine(MoveToPosition(obj, targetPos, shiftDuration));
|
||||
}
|
||||
yield return new WaitForSeconds(shiftDuration);
|
||||
|
||||
if (currentObject == null) currentObject = PeekTop();
|
||||
else nextTop = PeekTop();
|
||||
}
|
||||
|
||||
IEnumerator MoveToPosition(Transform obj, Vector3 target, float duration)
|
||||
{
|
||||
if (obj == null) yield break;
|
||||
Vector3 start = obj.position;
|
||||
float elapsed = 0f;
|
||||
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
obj.position = Vector3.Lerp(start, target, t);
|
||||
yield return null;
|
||||
}
|
||||
obj.position = target;
|
||||
}
|
||||
|
||||
// ========== MAIN FLOW ==========
|
||||
public IEnumerator RunStepsExternal()
|
||||
{
|
||||
BuildSteps();
|
||||
|
||||
foreach (var step in steps)
|
||||
{
|
||||
switch (step.Type)
|
||||
{
|
||||
case StepType.Move:
|
||||
if (step.Path != null) yield return DoMove(step.Path);
|
||||
break;
|
||||
|
||||
case StepType.MoveJoints:
|
||||
yield return StartCoroutine(DoMoveToJoints(step.JointAngles, step.MoveDuration));
|
||||
break;
|
||||
|
||||
case StepType.Pick:
|
||||
yield return pickDrop.PlayPick(this);
|
||||
break;
|
||||
|
||||
case StepType.Drop:
|
||||
yield return pickDrop.PlayDrop(this);
|
||||
break;
|
||||
|
||||
case StepType.Attach:
|
||||
if (currentObject == null)
|
||||
{
|
||||
currentObject = PopTop();
|
||||
if (currentObject == null) break;
|
||||
}
|
||||
pickDrop.AttachObjToAmr(endEffector, currentObject);
|
||||
if (objectStack.Count > 0) StartCoroutine(ShiftStackUpAfterDelay());
|
||||
break;
|
||||
|
||||
case StepType.Detach:
|
||||
pickDrop.DetachObj(currentObject);
|
||||
if (currentObject != null) currentObject.rotation = Quaternion.identity;
|
||||
break;
|
||||
|
||||
case StepType.Action:
|
||||
case StepType.CustomAction:
|
||||
step.Action?.Invoke();
|
||||
break;
|
||||
|
||||
case StepType.Delay:
|
||||
yield return new WaitForSeconds(step.Delay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
OnCompleted?.Invoke();
|
||||
}
|
||||
|
||||
void BuildSteps()
|
||||
{
|
||||
steps = new List<Step>();
|
||||
|
||||
float[] homeAngles = GetHomeJointAngles();
|
||||
|
||||
Frame t1 = new(target1.position, target1.rotation);
|
||||
Frame t2 = new(target2.position, target2.rotation);
|
||||
Frame lift1 = LiftFrame(t1, liftHeight);
|
||||
Frame lift2 = LiftFrame(t2, liftHeight);
|
||||
|
||||
// Về home = dùng MoveJoints
|
||||
steps.Add(new Step(StepType.MoveJoints, jointAngles: homeAngles));
|
||||
|
||||
// Pick từ target1
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(new Frame(endEffector.position, endEffector.rotation), lift1, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(lift1, t1, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.Attach));
|
||||
steps.Add(new Step(StepType.Move, planner.RepeatFrame(t1, HoldFrames)));
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(t1, lift1, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.MoveJoints, jointAngles: homeAngles) { MoveDuration = 1f });
|
||||
|
||||
// Place tại target2
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(new Frame(endEffector.position, endEffector.rotation), lift2, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(lift2, t2, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.Detach));
|
||||
steps.Add(new Step(StepType.Move, planner.RepeatFrame(t2, HoldFrames)));
|
||||
|
||||
// Animate rơi tự do (rơi xuống target3)
|
||||
steps.Add(new Step(StepType.CustomAction, action: () => { StartCoroutine(MoveObject(target2, target3, 0.2f)); }) { MoveDuration = 0.75f });
|
||||
|
||||
// Quay về home
|
||||
steps.Add(new Step(StepType.Move, planner.GeneratePath(t2, lift2, stepsPerMove).ToArray()));
|
||||
steps.Add(new Step(StepType.MoveJoints, jointAngles: homeAngles) { MoveDuration = 1f });
|
||||
}
|
||||
|
||||
// ========== MOTION ==========
|
||||
IEnumerator DoMove(Frame[] path)
|
||||
{
|
||||
foreach (var f in path)
|
||||
{
|
||||
float[] solved = solver.SolveIK(f);
|
||||
for (int i = 0; i < joints.Length && i < solved.Length; i++)
|
||||
{
|
||||
float a = Mathf.Lerp(lastAngles[i], solved[i], applyAlpha);
|
||||
lastAngles[i] = a;
|
||||
joints[i].SetValue(a);
|
||||
}
|
||||
yield return new WaitForSeconds(stepDelay);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator DoMoveToJoints(float[] targetAngles, float duration = 0.75f)
|
||||
{
|
||||
if (targetAngles == null) yield break;
|
||||
|
||||
int frames = stepsPerMove;
|
||||
if (duration > 0f) // nếu truyền duration, thì tính lại StepDelay
|
||||
stepDelay = duration / frames;
|
||||
|
||||
float[] startAngles = new float[joints.Length];
|
||||
for (int i = 0; i < joints.Length; i++) startAngles[i] = joints[i].GetValue();
|
||||
|
||||
for (int f = 0; f < frames; f++)
|
||||
{
|
||||
float t = (float)f / (frames - 1);
|
||||
for (int j = 0; j < joints.Length; j++)
|
||||
{
|
||||
float angle = Mathf.Lerp(startAngles[j], targetAngles[j], t);
|
||||
joints[j].SetValue(angle);
|
||||
lastAngles[j] = angle;
|
||||
}
|
||||
yield return new WaitForSeconds(stepDelay);
|
||||
}
|
||||
}
|
||||
float[] GetHomeJointAngles()
|
||||
{
|
||||
float[] home = new float[joints.Length];
|
||||
for (int i = 0; i < joints.Length; i++) home[i] = joints[i].GetValue();
|
||||
return home;
|
||||
}
|
||||
|
||||
Frame LiftFrame(Frame f, float lift)
|
||||
{
|
||||
return new Frame(new Vector3(f.Position.x, f.Position.y + lift, f.Position.z), f.Rotation);
|
||||
}
|
||||
|
||||
// ========== DROP ANIMATION ==========
|
||||
public IEnumerator MoveObject(Transform from, Transform to, float duration)
|
||||
{
|
||||
if (currentObject == null) yield break;
|
||||
|
||||
from.GetPositionAndRotation(out Vector3 startPos, out Quaternion startRot);
|
||||
float elapsed = 0f;
|
||||
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
currentObject.SetPositionAndRotation(
|
||||
Vector3.Lerp(startPos, to.position, t),
|
||||
Quaternion.Slerp(startRot, to.rotation, t)
|
||||
);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Sau khi thả xong tại target3
|
||||
LastStackObject = currentObject;
|
||||
// thông tin góc lastStackObject Rotation = Quaternion.identity;
|
||||
currentObject = null;
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/RobotController.cs.meta
Normal file
2
Assets/dobot/Sc/RobotController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41375b751e0596646809ddac3f41adac
|
||||
49
Assets/dobot/Sc/RobotJoint.cs
Normal file
49
Assets/dobot/Sc/RobotJoint.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class RobotJoint
|
||||
{
|
||||
public Transform JointTransform;
|
||||
|
||||
public enum RotationAxis { X, Y, Z }
|
||||
public RotationAxis Axis = RotationAxis.Y;
|
||||
|
||||
public float MinLimit = -180f;
|
||||
public float MaxLimit = 180f;
|
||||
|
||||
[HideInInspector] public float CurrentValue = 0f; // degrees
|
||||
|
||||
// Lưu offset ban đầu
|
||||
private Quaternion baseRotation;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (JointTransform != null)
|
||||
baseRotation = JointTransform.localRotation;
|
||||
else
|
||||
Debug.LogWarning("JointTransform is not assigned in RobotJoint!");
|
||||
}
|
||||
|
||||
public void SetValue(float angleDeg)
|
||||
{
|
||||
if (JointTransform == null) return;
|
||||
|
||||
CurrentValue = Mathf.Clamp(angleDeg, MinLimit, MaxLimit);
|
||||
|
||||
Vector3 axisVector = Vector3.zero;
|
||||
switch (Axis)
|
||||
{
|
||||
case RotationAxis.X: axisVector = Vector3.right; break;
|
||||
case RotationAxis.Y: axisVector = Vector3.up; break;
|
||||
case RotationAxis.Z: axisVector = Vector3.forward; break;
|
||||
}
|
||||
|
||||
// rotation = baseRotation * xoay quanh trục
|
||||
JointTransform.localRotation = baseRotation * Quaternion.AngleAxis(CurrentValue, axisVector);
|
||||
}
|
||||
|
||||
public float GetValue()
|
||||
{
|
||||
return CurrentValue;
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/RobotJoint.cs.meta
Normal file
2
Assets/dobot/Sc/RobotJoint.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2181db2848d184baf7a6958cf097ff
|
||||
44
Assets/dobot/Sc/RobotManager.cs
Normal file
44
Assets/dobot/Sc/RobotManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class RobotManager : MonoBehaviour
|
||||
{
|
||||
public RobotController abb;
|
||||
public Robot2Controller yas;
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(AbbLoop());
|
||||
StartCoroutine(YasLoop());
|
||||
}
|
||||
bool IsAtTarget3()
|
||||
{
|
||||
return yas.HasPhoiAtTarget3();
|
||||
}
|
||||
IEnumerator AbbLoop()
|
||||
{
|
||||
|
||||
for (int i = 0; i < abb.stackCount; i++)
|
||||
{
|
||||
yield return new WaitUntil(() => !IsAtTarget3());
|
||||
yield return StartCoroutine(abb.RunStepsExternal());
|
||||
|
||||
// ✅ Sau khi ABB đặt phôi, đưa phôi vào queue của YAS
|
||||
yas.EnqueuePhoi(abb.LastStackObject);
|
||||
}
|
||||
Debug.Log("ABB hoàn thành tất cả vòng");
|
||||
}
|
||||
|
||||
IEnumerator YasLoop()
|
||||
{
|
||||
|
||||
for (int i = 0; i < abb.stackCount; i++)
|
||||
{
|
||||
// Đợi tới khi có phôi ở target3
|
||||
yield return new WaitUntil(() => IsAtTarget3());
|
||||
yield return StartCoroutine(yas.RunStepsExternal());
|
||||
}
|
||||
|
||||
Debug.Log("YAS hoàn thành tất cả vòng");
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/RobotManager.cs.meta
Normal file
2
Assets/dobot/Sc/RobotManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aab6c4444590a34aac534f274340fd0
|
||||
125
Assets/dobot/Sc/SolverCCD.cs
Normal file
125
Assets/dobot/Sc/SolverCCD.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SolverCCD
|
||||
{
|
||||
public RobotJoint[] Joints;
|
||||
public Transform EndEffector;
|
||||
|
||||
public int MaxIterations = 40;
|
||||
public float PositionTolerance = 0.001f;
|
||||
public float OrientationToleranceDeg = 3f;
|
||||
|
||||
public float MaxStepDegrees = 2f;
|
||||
public float WristMaxStepDegrees = 1f;
|
||||
[Range(0f, 1f)]
|
||||
public float SmoothFactor = 0.5f;
|
||||
public float ProjectionEpsilon = 1e-6f;
|
||||
|
||||
public SolverCCD(RobotJoint[] joints, Transform endEffector)
|
||||
{
|
||||
Joints = joints;
|
||||
EndEffector = endEffector;
|
||||
}
|
||||
|
||||
public float[] SolveIK(Frame target)
|
||||
{
|
||||
int n = Joints != null ? Joints.Length : 0;
|
||||
float[] result = new float[n];
|
||||
|
||||
if (Joints == null || n == 0 || EndEffector == null)
|
||||
return result;
|
||||
|
||||
for (int iter = 0; iter < MaxIterations; iter++)
|
||||
{
|
||||
float posErr = Vector3.Distance(EndEffector.position, target.Position);
|
||||
if (posErr <= PositionTolerance) break;
|
||||
|
||||
for (int i = n - 1; i >= 0; i--)
|
||||
{
|
||||
Transform jointT = Joints[i].JointTransform;
|
||||
Vector3 toEnd = EndEffector.position - jointT.position;
|
||||
Vector3 toTarget = target.Position - jointT.position;
|
||||
|
||||
if (toEnd.sqrMagnitude < 1e-12f || toTarget.sqrMagnitude < 1e-12f) continue;
|
||||
|
||||
Vector3 axisWorld = GetJointAxisWorld(Joints[i], jointT);
|
||||
float angle = SignedAngleBetweenVectorsProjected(toEnd, toTarget, axisWorld, ProjectionEpsilon);
|
||||
|
||||
float maxStep = (i >= n - 3) ? WristMaxStepDegrees : MaxStepDegrees;
|
||||
float delta = Mathf.Clamp(angle, -maxStep, maxStep);
|
||||
|
||||
float current = Joints[i].GetValue();
|
||||
float intended = current + delta;
|
||||
float newAngle = Mathf.Lerp(current, intended, SmoothFactor);
|
||||
newAngle = Mathf.Clamp(newAngle, Joints[i].MinLimit, Joints[i].MaxLimit);
|
||||
|
||||
Joints[i].SetValue(newAngle);
|
||||
}
|
||||
}
|
||||
|
||||
AlignOrientation(target);
|
||||
|
||||
for (int i = 0; i < n; i++) result[i] = Joints[i].GetValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
void AlignOrientation(Frame target)
|
||||
{
|
||||
int n = Joints.Length;
|
||||
if (n == 0) return;
|
||||
|
||||
float angError = Quaternion.Angle(EndEffector.rotation, target.Rotation);
|
||||
if (angError <= OrientationToleranceDeg) return;
|
||||
|
||||
int start = Mathf.Max(0, n - 3);
|
||||
|
||||
for (int iter = 0; iter < 12; iter++)
|
||||
{
|
||||
for (int i = n - 1; i >= start; i--)
|
||||
{
|
||||
Transform jointT = Joints[i].JointTransform;
|
||||
Vector3 axisWorld = GetJointAxisWorld(Joints[i], jointT);
|
||||
|
||||
Quaternion fromTo = target.Rotation * Quaternion.Inverse(EndEffector.rotation);
|
||||
fromTo.ToAngleAxis(out float angleDeg, out Vector3 axis);
|
||||
if (angleDeg > 180f) angleDeg -= 360f;
|
||||
if (float.IsNaN(angleDeg) || Mathf.Abs(angleDeg) < 1e-4f) continue;
|
||||
|
||||
float sign = Mathf.Sign(Vector3.Dot(axis, axisWorld));
|
||||
float step = Mathf.Clamp(angleDeg * sign, -5f, 5f);
|
||||
|
||||
float maxStep = WristMaxStepDegrees;
|
||||
float delta = Mathf.Clamp(step, -maxStep, maxStep);
|
||||
|
||||
float current = Joints[i].GetValue();
|
||||
float intended = current + delta;
|
||||
float newAngle = Mathf.Lerp(current, intended, SmoothFactor);
|
||||
newAngle = Mathf.Clamp(newAngle, Joints[i].MinLimit, Joints[i].MaxLimit);
|
||||
|
||||
Joints[i].SetValue(newAngle);
|
||||
}
|
||||
|
||||
if (Quaternion.Angle(EndEffector.rotation, target.Rotation) <= OrientationToleranceDeg) break;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 GetJointAxisWorld(RobotJoint joint, Transform jointT)
|
||||
{
|
||||
switch (joint.Axis)
|
||||
{
|
||||
case RobotJoint.RotationAxis.X: return jointT.right;
|
||||
case RobotJoint.RotationAxis.Y: return jointT.up;
|
||||
case RobotJoint.RotationAxis.Z: return jointT.forward;
|
||||
}
|
||||
return jointT.up;
|
||||
}
|
||||
|
||||
static float SignedAngleBetweenVectorsProjected(Vector3 v1, Vector3 v2, Vector3 axis, float eps)
|
||||
{
|
||||
Vector3 p1 = Vector3.ProjectOnPlane(v1, axis);
|
||||
Vector3 p2 = Vector3.ProjectOnPlane(v2, axis);
|
||||
|
||||
if (p1.sqrMagnitude < eps || p2.sqrMagnitude < eps) return 0f;
|
||||
return Vector3.SignedAngle(p1, p2, axis.normalized);
|
||||
}
|
||||
}
|
||||
2
Assets/dobot/Sc/SolverCCD.cs.meta
Normal file
2
Assets/dobot/Sc/SolverCCD.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bbde1abab7e62644ad2b4c0f95a99e9
|
||||
301
Assets/dobot/Sc/drop.anim
Normal file
301
Assets/dobot/Sc/drop.anim
Normal file
@@ -0,0 +1,301 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: drop
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: 0.04, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: 0.009, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: -0.04, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: -0.009, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 3281244475
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3029655981
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.04
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0.009
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -0.04
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: -0.009
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
8
Assets/dobot/Sc/drop.anim.meta
Normal file
8
Assets/dobot/Sc/drop.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a35e6cfa23f79c4894b41d37f35cdf8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
301
Assets/dobot/Sc/idle.anim
Normal file
301
Assets/dobot/Sc/idle.anim
Normal file
@@ -0,0 +1,301 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: idle
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: -0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: -0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 3281244475
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3029655981
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: -0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
8
Assets/dobot/Sc/idle.anim.meta
Normal file
8
Assets/dobot/Sc/idle.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eec961b06cceb814b82b52d23dc30085
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
301
Assets/dobot/Sc/pick.anim
Normal file
301
Assets/dobot/Sc/pick.anim
Normal file
@@ -0,0 +1,301 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pick
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: 0.04, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: -0, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: -0.04, y: 0, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 3281244475
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3029655981
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0.04
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_2
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: -0.04
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path: DOBOT/BASE0-1/J1T-1/J2T-1/J3T-1/JT4-1/J5T-1/J6T-1/Body_3
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
8
Assets/dobot/Sc/pick.anim.meta
Normal file
8
Assets/dobot/Sc/pick.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81aad894e91c1b54ca1b7d552a23800c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
310
Assets/dobot/Sc/robot (1).controller
Normal file
310
Assets/dobot/Sc/robot (1).controller
Normal file
@@ -0,0 +1,310 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1102 &-7403949162130582183
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: drop
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -159495434727281131}
|
||||
- {fileID: -6413652830785398485}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 5a35e6cfa23f79c4894b41d37f35cdf8, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &-7350804755631324734
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: p
|
||||
m_EventTreshold: 0
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: d
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -7403949162130582183}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1102 &-7245976642087767186
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: idle
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -281679098795121271}
|
||||
- {fileID: -7350804755631324734}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: eec961b06cceb814b82b52d23dc30085, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &-6413652830785398485
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: p
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 2112674445024107420}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &-281679098795121271
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: p
|
||||
m_EventTreshold: 0
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: d
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 2112674445024107420}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &-159495434727281131
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: p
|
||||
m_EventTreshold: 0
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: d
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -7245976642087767186}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: robot (1)
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters:
|
||||
- m_Name: p
|
||||
m_Type: 4
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: d
|
||||
m_Type: 4
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 1307084869815193850}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1107 &1307084869815193850
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 2112674445024107420}
|
||||
m_Position: {x: 510, y: 190, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -7403949162130582183}
|
||||
m_Position: {x: 510, y: 20, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -7245976642087767186}
|
||||
m_Position: {x: 260, y: 120, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: -7245976642087767186}
|
||||
--- !u!1102 &2112674445024107420
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pick
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 8437144257983325854}
|
||||
- {fileID: 4411300189933690983}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 81aad894e91c1b54ca1b7d552a23800c, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &4411300189933690983
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: p
|
||||
m_EventTreshold: 0
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: d
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -7245976642087767186}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &8437144257983325854
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: d
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -7403949162130582183}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
8
Assets/dobot/Sc/robot (1).controller.meta
Normal file
8
Assets/dobot/Sc/robot (1).controller.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7a16cca70fe4734d91328f376488b0f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user