Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add other frame types to test + fixes
  • Loading branch information
gvaradarajan authored and nicksanford committed Aug 6, 2025
commit 25aec871adede80bb29c0987d01136488258910c
3 changes: 2 additions & 1 deletion referenceframe/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ func (rf *rotationalFrame) UnmarshalJSON(data []byte) error {
return err
}

rf.baseFrame = &baseFrame{name: rf.Name(), limits: []Limit{{Min: cfg.Min, Max: cfg.Max}}}
rf.baseFrame = &baseFrame{name: cfg.ID, limits: []Limit{
{Min: utils.DegToRad(cfg.Min), Max: utils.DegToRad(cfg.Max)}}}
rotAxis := cfg.Axis.ParseConfig()
rf.rotAxis = r3.Vector{X: rotAxis.RX, Y: rotAxis.RY, Z: rotAxis.RZ}
return nil
Expand Down
14 changes: 14 additions & 0 deletions referenceframe/frame_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,20 @@ func TestSerialization(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
fs.AddFrame(blockFrame, model)

// Revolute joint around X axis
joint, err := NewRotationalFrame("rot", spatial.R4AA{RX: 1, RY: 0, RZ: 0}, Limit{Min: -math.Pi * 2, Max: math.Pi * 2})
test.That(t, err, test.ShouldBeNil)
fs.AddFrame(joint, fs.World())

// Translational frame
bc, err := spatial.NewBox(spatial.NewZeroPose(), r3.Vector{X: 1, Y: 1, Z: 1}, "")
test.That(t, err, test.ShouldBeNil)

// test creating a new translational frame with a geometry
prismatic, err := NewTranslationalFrameWithGeometry("pr", r3.Vector{X: 0, Y: 1, Z: 0}, Limit{Min: -30, Max: 30}, bc)
test.That(t, err, test.ShouldBeNil)
fs.AddFrame(prismatic, fs.World())

jsonData, err = json.Marshal(fs)
test.That(t, err, test.ShouldBeNil)

Expand Down