Add priority settings to geometry
This commit is contained in:
@@ -30,6 +30,9 @@ namespace Mujoco {
|
|||||||
[Tooltip("Joint movement, in rad/sec. Read-only at play time.")]
|
[Tooltip("Joint movement, in rad/sec. Read-only at play time.")]
|
||||||
public float Velocity;
|
public float Velocity;
|
||||||
|
|
||||||
|
[Tooltip("The current joint angle without normalization, in radians. Read-only.")]
|
||||||
|
public double RawConfiguration;
|
||||||
|
|
||||||
[Tooltip("Joint settings.")]
|
[Tooltip("Joint settings.")]
|
||||||
public MjJointSettings Settings = MjJointSettings.Default;
|
public MjJointSettings Settings = MjJointSettings.Default;
|
||||||
|
|
||||||
@@ -42,7 +45,8 @@ namespace Mujoco {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override unsafe void OnSyncState(MujocoLib.mjData_* data) {
|
public override unsafe void OnSyncState(MujocoLib.mjData_* data) {
|
||||||
var qpos = (float)data->qpos[QposAddress];
|
RawConfiguration = data->qpos[QposAddress];
|
||||||
|
var qpos = (float)RawConfiguration;
|
||||||
Configuration = (qpos % (2 * Mathf.PI)) * Mathf.Rad2Deg;
|
Configuration = (qpos % (2 * Mathf.PI)) * Mathf.Rad2Deg;
|
||||||
Velocity = (float)data->qvel[DofAddress];
|
Velocity = (float)data->qvel[DofAddress];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ namespace Mujoco {
|
|||||||
// Advanced settings of MjGeom component.
|
// Advanced settings of MjGeom component.
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MjGeomSettings {
|
public struct MjGeomSettings {
|
||||||
|
|
||||||
|
|
||||||
|
[Tooltip("Priority")]
|
||||||
|
public int Priority;
|
||||||
|
|
||||||
[Tooltip("Solver accuracy settings.")]
|
[Tooltip("Solver accuracy settings.")]
|
||||||
public GeomSolver Solver;
|
public GeomSolver Solver;
|
||||||
|
|
||||||
@@ -38,6 +43,9 @@ public struct MjGeomSettings {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void FromMjcf(XmlElement mjcf) {
|
public void FromMjcf(XmlElement mjcf) {
|
||||||
|
|
||||||
|
Priority = (int) mjcf.GetFloatAttribute("priority", 0);
|
||||||
|
|
||||||
// Contact filtering settings.
|
// Contact filtering settings.
|
||||||
Filtering.Contype = (int)mjcf.GetFloatAttribute("contype", CollisionFiltering.Default.Contype);
|
Filtering.Contype = (int)mjcf.GetFloatAttribute("contype", CollisionFiltering.Default.Contype);
|
||||||
Filtering.Conaffinity = (int)mjcf.GetFloatAttribute(
|
Filtering.Conaffinity = (int)mjcf.GetFloatAttribute(
|
||||||
@@ -71,6 +79,8 @@ public struct MjGeomSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ToMjcf(XmlElement mjcf) {
|
public void ToMjcf(XmlElement mjcf) {
|
||||||
|
mjcf.SetAttribute("priority", $"{Priority}");
|
||||||
|
|
||||||
// Contact filtering settings.
|
// Contact filtering settings.
|
||||||
mjcf.SetAttribute("contype", $"{Filtering.Contype}");
|
mjcf.SetAttribute("contype", $"{Filtering.Contype}");
|
||||||
mjcf.SetAttribute("conaffinity", $"{Filtering.Conaffinity}");
|
mjcf.SetAttribute("conaffinity", $"{Filtering.Conaffinity}");
|
||||||
|
|||||||
Reference in New Issue
Block a user