Skip to content

Commit 03a5ec3

Browse files
authored
Aruco command (#28)
* add aruco marker to scene * new arm structure * add linkage models * add joint rotation * git ignore * update parallel motion for arm * add arm position updating * angles match desmos sim * add implementation for back and front linkage movement * add bottom bracket * cleanup original scene * set default simulator nodes to be invisible * better position calc (short for calculation) and angle limits * basic min and max angle limit switch changing based on distance between beams * the relationship between the max and min angles was in face linear * new arm sim join meshes * finish adaptable linkage arm and set the parameters to the actual measurements given by arm team * fix comments * fix cam location * add aruco visibility toggle command * changes for arm implement branch * fix everything * remove logs
1 parent fe63c24 commit 03a5ec3

File tree

4 files changed

+101
-10
lines changed

4 files changed

+101
-10
lines changed

Assets/Scenes/Simulator.unity

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Transform:
165165
m_LocalScale: {x: 1, y: 1, z: 1}
166166
m_Children: []
167167
m_Father: {fileID: 0}
168-
m_RootOrder: 3
168+
m_RootOrder: 4
169169
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
170170
--- !u!1 &76217086
171171
GameObject:
@@ -907,7 +907,7 @@ Transform:
907907
m_Children:
908908
- {fileID: 963194228}
909909
m_Father: {fileID: 0}
910-
m_RootOrder: 7
910+
m_RootOrder: 8
911911
m_LocalEulerAnglesHint: {x: 20, y: 0, z: 0}
912912
--- !u!114 &494477795
913913
MonoBehaviour:
@@ -1070,7 +1070,7 @@ Transform:
10701070
- {fileID: 144878292}
10711071
- {fileID: 1471516607}
10721072
m_Father: {fileID: 0}
1073-
m_RootOrder: 5
1073+
m_RootOrder: 6
10741074
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
10751075
--- !u!1 &671792643
10761076
GameObject:
@@ -3270,8 +3270,69 @@ Transform:
32703270
m_LocalScale: {x: 1, y: 1, z: 1}
32713271
m_Children: []
32723272
m_Father: {fileID: 0}
3273-
m_RootOrder: 2
3273+
m_RootOrder: 3
32743274
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
3275+
--- !u!1001 &1597500314
3276+
PrefabInstance:
3277+
m_ObjectHideFlags: 0
3278+
serializedVersion: 2
3279+
m_Modification:
3280+
m_TransformParent: {fileID: 0}
3281+
m_Modifications:
3282+
- target: {fileID: 509743861628865031, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3283+
propertyPath: m_Name
3284+
value: ArUco Marker Gate 1
3285+
objectReference: {fileID: 0}
3286+
- target: {fileID: 509743861628865031, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3287+
propertyPath: m_IsActive
3288+
value: 0
3289+
objectReference: {fileID: 0}
3290+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3291+
propertyPath: m_RootOrder
3292+
value: 1
3293+
objectReference: {fileID: 0}
3294+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3295+
propertyPath: m_LocalPosition.x
3296+
value: 0.015981436
3297+
objectReference: {fileID: 0}
3298+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3299+
propertyPath: m_LocalPosition.y
3300+
value: 18.783356
3301+
objectReference: {fileID: 0}
3302+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3303+
propertyPath: m_LocalPosition.z
3304+
value: 6.3690343
3305+
objectReference: {fileID: 0}
3306+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3307+
propertyPath: m_LocalRotation.w
3308+
value: 1
3309+
objectReference: {fileID: 0}
3310+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3311+
propertyPath: m_LocalRotation.x
3312+
value: 0
3313+
objectReference: {fileID: 0}
3314+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3315+
propertyPath: m_LocalRotation.y
3316+
value: 0
3317+
objectReference: {fileID: 0}
3318+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3319+
propertyPath: m_LocalRotation.z
3320+
value: 0
3321+
objectReference: {fileID: 0}
3322+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3323+
propertyPath: m_LocalEulerAnglesHint.x
3324+
value: 0
3325+
objectReference: {fileID: 0}
3326+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3327+
propertyPath: m_LocalEulerAnglesHint.y
3328+
value: 0
3329+
objectReference: {fileID: 0}
3330+
- target: {fileID: 1073218108609730134, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3331+
propertyPath: m_LocalEulerAnglesHint.z
3332+
value: 0
3333+
objectReference: {fileID: 0}
3334+
m_RemovedComponents: []
3335+
m_SourcePrefab: {fileID: 100100000, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
32753336
--- !u!1 &1647191661
32763337
GameObject:
32773338
m_ObjectHideFlags: 0
@@ -3510,7 +3571,7 @@ RectTransform:
35103571
m_Children:
35113572
- {fileID: 2139349607}
35123573
m_Father: {fileID: 0}
3513-
m_RootOrder: 1
3574+
m_RootOrder: 2
35143575
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35153576
m_AnchorMin: {x: 0, y: 0}
35163577
m_AnchorMax: {x: 0, y: 0}
@@ -3547,6 +3608,7 @@ MonoBehaviour:
35473608
m_Name:
35483609
m_EditorClassIdentifier:
35493610
_rover: {fileID: 2516181680764149518}
3611+
arucoMarker: {fileID: 2026221751}
35503612
--- !u!4 &1792607559
35513613
Transform:
35523614
m_ObjectHideFlags: 0
@@ -3559,7 +3621,7 @@ Transform:
35593621
m_LocalScale: {x: 1, y: 1, z: 1}
35603622
m_Children: []
35613623
m_Father: {fileID: 0}
3562-
m_RootOrder: 4
3624+
m_RootOrder: 5
35633625
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35643626
--- !u!1 &1811806424
35653627
GameObject:
@@ -3759,6 +3821,11 @@ Transform:
37593821
m_Father: {fileID: 1144866598}
37603822
m_RootOrder: 0
37613823
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
3824+
--- !u!1 &2026221751 stripped
3825+
GameObject:
3826+
m_CorrespondingSourceObject: {fileID: 509743861628865031, guid: ff3ba6d371804b648bdef0c771a15f6b, type: 3}
3827+
m_PrefabInstance: {fileID: 1597500314}
3828+
m_PrefabAsset: {fileID: 0}
37623829
--- !u!1 &2061131504
37633830
GameObject:
37643831
m_ObjectHideFlags: 0
@@ -4661,7 +4728,7 @@ Transform:
46614728
- {fileID: 97750368}
46624729
- {fileID: 1935106304}
46634730
m_Father: {fileID: 0}
4664-
m_RootOrder: 6
4731+
m_RootOrder: 7
46654732
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
46664733
--- !u!33 &3469287836621100693
46674734
MeshFilter:

Assets/Scripts/CommandRegisterer.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class CommandRegisterer : MonoBehaviour
1010
{
1111
[SerializeField]
1212
private Rover _rover;
13+
[SerializeField]
14+
private GameObject arucoMarker;
1315
private IList<Command> _commands;
1416

1517
private void OnEnable()
@@ -19,7 +21,8 @@ private void OnEnable()
1921
new Command("run", RunMotor),
2022
new Command("waypoint", GetWaypoint),
2123
new Command("waypoints", ListWaypoints),
22-
new Command("help", PrintInstructions)
24+
new Command("help", PrintInstructions),
25+
new Command("toggleAruco", toggleAruco)
2326
};
2427

2528
foreach (Command command in _commands)
@@ -46,6 +49,7 @@ private void PrintInstructions(string[] args)
4649
SimulatorConsole.WriteLine("reset: Reloads the scene");
4750
SimulatorConsole.WriteLine("waypoints: Lists all waypoints");
4851
SimulatorConsole.WriteLine("waypoint <name>: Copies GPS coordinates of waypoint");
52+
SimulatorConsole.WriteLine("toggleAruco: Toggle Aruco marker visibility");
4953
}
5054

5155
/// <summary>
@@ -131,11 +135,31 @@ private void ListWaypoints(string[] args)
131135
{
132136
foreach (Transform child in GameObject.Find("Waypoints").transform)
133137
{
134-
double[] GPS = Utilities.metersToGPS(new double[] {child.transform.position.z, child.transform.position.x});
138+
double[] GPS = Utilities.metersToGPS(new double[] { child.transform.position.z, child.transform.position.x });
135139
string lat = GPS[0].ToString("0." + new string('#', 8));
136140
string lon = GPS[1].ToString("0." + new string('#', 8));
137141
SimulatorConsole.WriteLine(child.name + "->(lat:" + lat + ", lon:" + lon + ")");
138142
}
139143
}
140144
}
145+
146+
// Turns on the visibility for the ArUco Marker Gate 1 object
147+
private void toggleAruco(string[] args)
148+
{
149+
if (arucoMarker != null)
150+
{
151+
if (arucoMarker.activeSelf)
152+
{
153+
arucoMarker.SetActive(false);
154+
}
155+
else
156+
{
157+
arucoMarker.SetActive(true);
158+
}
159+
}
160+
else
161+
{
162+
SimulatorConsole.WriteLine("No ArUco Marker Gate 1 in world!");
163+
}
164+
}
141165
}

Assets/Scripts/PowerDrivenMotor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private void UpdatePower()
5959

6060
private void UpdatePosition()
6161
{
62+
6263
float speed = Mode switch
6364
{
6465
RunMode.RunToPosition => _closedLoopSpeed,

Assets/Scripts/ShoulderMotor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ protected override void Render()
6464
topFrontNode.transform.localPosition = new Vector3(topFrontNode.transform.localPosition.x,
6565
height * Mathf.Cos(elbowMotor.transform.localEulerAngles.x * Mathf.Deg2Rad),
6666
height * Mathf.Sin(elbowMotor.transform.localEulerAngles.x * Mathf.Deg2Rad));
67-
6867
bottomBackNode.transform.localPosition = new Vector3(bottomBackNode.transform.localPosition.x,
6968
bottomFrontNode.transform.localPosition.y + (width * Mathf.Sin(transform.localEulerAngles.x * Mathf.Deg2Rad)),
7069
bottomFrontNode.transform.localPosition.z - (width * Mathf.Cos(transform.localEulerAngles.x * Mathf.Deg2Rad)));

0 commit comments

Comments
 (0)