Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSDK-456 change DH config files to use degrees instead of radians #1470

Merged
merged 24 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c11cebf
update sample code
raybjork Aug 10, 2022
c88d44a
Merge branch 'main' into main
raybjork Aug 10, 2022
000aa58
Merge branch 'main' of http://github.com/viamrobotics/rdk
raybjork Aug 10, 2022
718142d
Merge branch 'main' into main
raybjork Aug 15, 2022
e003dbe
Merge branch 'main' into main
raybjork Aug 15, 2022
bf9d187
Merge branch 'main' into main
raybjork Aug 15, 2022
83950f3
Merge branch 'main' of github.com:raybjork/rdk
raybjork Aug 16, 2022
df2d7e7
Merge branch 'main' of http://github.com/viamrobotics/rdk
raybjork Aug 16, 2022
86eb756
lint
raybjork Aug 16, 2022
a7c9bdf
Merge branch 'main' into main
raybjork Aug 16, 2022
177f700
Merge branch 'main' of http://github.com/viamrobotics/rdk
raybjork Sep 8, 2022
8489df2
Merge branch 'main' of github.com:raybjork/rdk
raybjork Sep 8, 2022
3175034
Merge branch 'main' of http://github.com/viamrobotics/rdk
raybjork Sep 14, 2022
c8ded88
Merge branch 'main' of http://github.com/viamrobotics/rdk
raybjork Sep 19, 2022
a18af73
Merge branch 'main' of github.com:raybjork/rdk
raybjork Sep 20, 2022
cee8fa9
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Sep 21, 2022
42e15d4
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Sep 26, 2022
1ed78c8
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Sep 27, 2022
14130d6
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Oct 3, 2022
525cfb2
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Oct 10, 2022
d620c97
Merge branch 'main' of ssh://github.com/viamrobotics/rdk
raybjork Oct 10, 2022
bc9bbfc
change DH convention to use degreees for joint angles
raybjork Oct 10, 2022
dfe31da
whoops
raybjork Oct 10, 2022
e3499b7
change dofbot dh json
raybjork Oct 10, 2022
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
6 changes: 3 additions & 3 deletions components/arm/universalrobots/ur5e_DH.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"parent": "world",
"a": 0,
"d": 162.5,
"alpha": 1.57079632679,
"alpha": 90,
"max": 360,
"min": -360
},
Expand All @@ -34,7 +34,7 @@
"parent": "elbow",
"a": 0,
"d": 133.3,
"alpha": 1.57079632679,
"alpha": 90,
"max": 360,
"min": -360
},
Expand All @@ -43,7 +43,7 @@
"parent": "wrist_1",
"a": 0,
"d": 99.7,
"alpha": -1.57079632679,
"alpha": -90,
"max": 360,
"min": -360
},
Expand Down
4 changes: 2 additions & 2 deletions components/arm/yahboom/dofbot.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"parent": "world",
"a": 0,
"d": 115,
"alpha": -1.57079632679,
"alpha": -90,
"max": 180,
"min": -180,
"geometry": {
Expand Down Expand Up @@ -83,7 +83,7 @@
"parent": "j4",
"a": 0,
"d": 0,
"alpha": 1.57079632679,
"alpha": 90,
"max": 180,
"min": -180
}
Expand Down
2 changes: 1 addition & 1 deletion motionplan/constraint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func TestIKTolerances(t *testing.T) {
logger := golog.NewTestLogger(t)

m, err := frame.ParseModelJSONFile(utils.ResolveFile("motionplan/testjson/varm.json"), "")
m, err := frame.ParseModelJSONFile(utils.ResolveFile("referenceframe/testjson/varm.json"), "")
test.That(t, err, test.ShouldBeNil)
mp, err := NewCBiRRTMotionPlanner(m, nCPU, logger)
test.That(t, err, test.ShouldBeNil)
Expand Down
9 changes: 5 additions & 4 deletions referenceframe/model_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package referenceframe

import (
"encoding/json"
"math"
"os"

"github.com/golang/geo/r3"
"github.com/pkg/errors"

spatial "go.viam.com/rdk/spatialmath"
"go.viam.com/rdk/utils"
)

// ModelConfig represents all supported fields in a kinematics JSON file.
Expand Down Expand Up @@ -93,7 +93,7 @@ func (config *ModelConfig) ParseConfig(modelName string) (Model, error) {
switch joint.Type {
case "revolute":
transforms[joint.ID], err = NewRotationalFrame(joint.ID, joint.Axis.ParseConfig(),
Limit{Min: joint.Min * math.Pi / 180, Max: joint.Max * math.Pi / 180})
Limit{Min: utils.DegToRad(joint.Min), Max: utils.DegToRad(joint.Max)})
case "prismatic":
transforms[joint.ID], err = NewTranslationalFrame(joint.ID, r3.Vector(joint.Axis),
Limit{Min: joint.Min, Max: joint.Max})
Expand All @@ -104,20 +104,21 @@ func (config *ModelConfig) ParseConfig(modelName string) (Model, error) {
return nil, err
}
}

case "DH":
for _, dh := range config.DHParams {
// Joint part of DH param
jointID := dh.ID + "_j"
parentMap[jointID] = dh.Parent
transforms[jointID], err = NewRotationalFrame(jointID, spatial.R4AA{RX: 0, RY: 0, RZ: 1},
Limit{Min: dh.Min * math.Pi / 180, Max: dh.Max * math.Pi / 180})
Limit{Min: utils.DegToRad(dh.Min), Max: utils.DegToRad(dh.Max)})
if err != nil {
return nil, err
}

// Link part of DH param
linkID := dh.ID
pose := spatial.NewPoseFromDH(dh.A, dh.D, dh.Alpha)
pose := spatial.NewPoseFromDH(dh.A, dh.D, utils.DegToRad(dh.Alpha))
parentMap[linkID] = jointID
geometryCreator, err := dh.Geometry.ParseConfig()
if err == nil {
Expand Down
10 changes: 5 additions & 5 deletions referenceframe/model_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ func TestParseJSONFile(t *testing.T) {
"components/arm/trossen/trossen_wx250s_kinematics.json",
"components/arm/trossen/trossen_wx250s_test.json",
"components/arm/universalrobots/ur5e_DH.json",
"motionplan/testjson/varm.json",
"referenceframe/testjson/varm.json",
}

badFiles := []string{
"kinematics/testjson/kinematicsloop.json",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well these have been broken for forever. Good catch.

"kinematics/testjson/worldjoint.json",
"kinematics/testjson/worldlink.json",
"kinematics/testjson/worldDH.json",
"referenceframe/testjson/kinematicsloop.json",
"referenceframe/testjson/worldjoint.json",
"referenceframe/testjson/worldlink.json",
"referenceframe/testjson/worldDH.json",
}

for _, f := range goodFiles {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"parent": "world",
"a": 0,
"d": 162.5,
"alpha": 1.57079632679,
"alpha": 90,
"max": 360,
"min": -360
},
Expand All @@ -34,7 +34,7 @@
"parent": "elbow",
"a": 0,
"d": 133.3,
"alpha": 1.57079632679,
"alpha": 90,
"max": 360,
"min": -360
},
Expand All @@ -43,7 +43,7 @@
"parent": "wrist_1",
"a": 0,
"d": 99.7,
"alpha": -1.57079632679,
"alpha": -90,
"max": 360,
"min": -360
},
Expand Down