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-2259, et. al.] Remove RobotConstructor, clean up constraint descriptions #2190

Merged
merged 4 commits into from
Apr 10, 2023
Merged

[RSDK-2259, et. al.] Remove RobotConstructor, clean up constraint descriptions #2190

merged 4 commits into from
Apr 10, 2023

Conversation

spieswl
Copy link

@spieswl spieswl commented Apr 7, 2023

I tested this with a real xArm6, and a fake xArm6 and 7. MoveSingleComponent works equally well in place of a regular arm.MoveToPosition and motion.Move commands, given similar circumstances and equivalent goal construction.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Apr 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!

component function
base IsMoving
board GPIOPinByName
camera Properties
motor IsMoving
sensor Readings
servo Position
arm EndPosition
audio MediaProperties
gantry Lengths
gripper IsMoving
input_controller Controls
movement_sensor LinearAcceleration
pose_tracker Poses
motion GetPose
vision DetectorNames

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 7, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 7, 2023
Copy link
Member

@nfranczak nfranczak left a comment

Choose a reason for hiding this comment

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

overall lgtm.
please ensure examples/simpleserver/cmd.go is not broken
bye bye robo constructor 👋🏻

defaultRobotCollisionConstraintName = "defaultRobotCollisionConstraint"
defaultJointConstraint = "defaultJointSwingConstraint"
// descriptions of constraints.
defaultLinearConstraintDesc = "Constraint to follow linear path"
Copy link
Member

Choose a reason for hiding this comment

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

💯

Copy link
Member

@biotinker biotinker left a comment

Choose a reason for hiding this comment

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

This LGTM

Copy link
Member

@raybjork raybjork left a comment

Choose a reason for hiding this comment

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

Just a couple comments

defaultOrientationConstraintDesc = "Constraint to maintain orientation within bounds"
defaultObstacleConstraintDesc = "Collision between the robot and an obstacle"
defaultSelfCollisionConstraintDesc = "Collision between components that are moving"
defaultRobotCollisionConstraintDesc = "Collision between different pieces of the robot"
Copy link
Member

Choose a reason for hiding this comment

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

Want to further disambiguate these two:
"Collision between two robot components that are moving"
vs
"Collision between a robot component that is moving and one that is stationary"

Copy link
Author

Choose a reason for hiding this comment

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

Yeah this was tough. More context is that I'm trying to avoid "reserved" terms in the Viam lexicon (which is why I didn't use parts, as originally suggested in the discussion thread talking about this).

I like the suggestions, though. Will swap over to those.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah its tricky. I think components is probably the preferred word

defaultRobotCollisionConstraintName: robotConstraint,
defaultObstacleConstraintDesc: obstacleConstraint,
defaultSelfCollisionConstraintDesc: selfCollisionConstraint,
defaultRobotCollisionConstraintDesc: robotConstraint,
Copy link
Member

Choose a reason for hiding this comment

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

potentially dumb question: does caching longer strings affect performance? @biotinker

Copy link
Member

Choose a reason for hiding this comment

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

Broadly yes it can; when storing in a map, a longer string takes longer to run through whatever hash function. Plus larger sizes in bytes mean larger memory copies that take longer, if copies of a map are made.

At the scale of this change, and with the number of iterations of things that we run, we are likely several orders of magnitude away from noticing a difference.

Theoretically, maps with keys from finite domains (such as ints) are trivially O(1) in space and time, and maps with keys with infinite domains (such as strings) require hashing and the specifics of equality testing to be included in the cost, which makes inserts and lookups best case O(N log N) on average (since the keys have to be at least O(log N) in size on average to construct a hash table with N entries.

From https://stackoverflow.com/questions/29677670/what-is-the-big-o-performance-of-maps-in-golang

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we aren't using this map a lot so I think this is fine, but something to be aware of I think

Copy link
Member

Choose a reason for hiding this comment

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

An example of somewhere this is relevant is our RRT maps. Currently, it is a map of pointers to pointers, which is fast. However, this means that identical underlying node configurations are not only possible but common.

De-duplicating nodes in the RRT tree would involve actually parsing their contents rather than simply using an atomic memory address, and would have significant performance implications on path planning.

Additionally, this is why the CachedTransform function on model frames is not used; the performance penalty is sufficient that it is not consistently faster than simply recalculating forward kinematics.

Copy link
Member

@raybjork raybjork left a comment

Choose a reason for hiding this comment

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

Provided you do the edits to the strings I'm good with this!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 10, 2023
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Delta Health
go.viam.com/rdk/components/arm 64% +0.49%
go.viam.com/rdk/components/arm/fake 30% 0.00%
go.viam.com/rdk/components/arm/universalrobots 40% 0.00%
go.viam.com/rdk/components/arm/wrapper 19% -0.98%
go.viam.com/rdk/components/arm/xarm 6% 0.00%
go.viam.com/rdk/components/arm/yahboom 6% +0.03%
go.viam.com/rdk/components/audioinput 53% 0.00%
go.viam.com/rdk/components/base 61% 0.00%
go.viam.com/rdk/components/base/agilex 62% 0.00%
go.viam.com/rdk/components/base/boat 41% 0.00%
go.viam.com/rdk/components/base/wheeled 76% 0.00%
go.viam.com/rdk/components/board 65% +0.15%
go.viam.com/rdk/components/board/arduino 10% 0.00%
go.viam.com/rdk/components/board/fake 38% 0.00%
go.viam.com/rdk/components/board/genericlinux 22% 0.00%
go.viam.com/rdk/components/board/numato 19% 0.00%
go.viam.com/rdk/components/board/pi 50% 0.00%
go.viam.com/rdk/components/camera 64% +0.25%
go.viam.com/rdk/components/camera/align 64% 0.00%
go.viam.com/rdk/components/camera/fake 71% 0.00%
go.viam.com/rdk/components/camera/ffmpeg 77% +1.43%
go.viam.com/rdk/components/camera/rtsp 44% +0.86%
go.viam.com/rdk/components/camera/transformpipeline 78% 0.00%
go.viam.com/rdk/components/camera/videosource 34% 0.00%
go.viam.com/rdk/components/encoder 15% 0.00%
go.viam.com/rdk/components/encoder/fake 76% 0.00%
go.viam.com/rdk/components/gantry 58% 0.00%
go.viam.com/rdk/components/gantry/multiaxis 85% 0.00%
go.viam.com/rdk/components/gantry/oneaxis 86% 0.00%
go.viam.com/rdk/components/generic 82% 0.00%
go.viam.com/rdk/components/gripper 67% 0.00%
go.viam.com/rdk/components/input 86% 0.00%
go.viam.com/rdk/components/input/fake 86% 0.00%
go.viam.com/rdk/components/input/gpio 84% 0.00%
go.viam.com/rdk/components/motor 76% 0.00%
go.viam.com/rdk/components/motor/dimensionengineering 63% 0.00%
go.viam.com/rdk/components/motor/dmc4000 69% 0.00%
go.viam.com/rdk/components/motor/fake 56% 0.00%
go.viam.com/rdk/components/motor/gpio 66% +0.41%
go.viam.com/rdk/components/motor/gpiostepper 52% 0.00%
go.viam.com/rdk/components/motor/tmcstepper 62% 0.00%
go.viam.com/rdk/components/motor/ulnstepper 52% 0.00%
go.viam.com/rdk/components/movementsensor 74% 0.00%
go.viam.com/rdk/components/movementsensor/adxl345 66% 0.00%
go.viam.com/rdk/components/movementsensor/cameramono 45% 0.00%
go.viam.com/rdk/components/movementsensor/gpsnmea 36% 0.00%
go.viam.com/rdk/components/movementsensor/gpsrtk 29% 0.00%
go.viam.com/rdk/components/movementsensor/mpu6050 83% 0.00%
go.viam.com/rdk/components/posetracker 84% 0.00%
go.viam.com/rdk/components/sensor 66% 0.00%
go.viam.com/rdk/components/sensor/ultrasonic 31% 0.00%
go.viam.com/rdk/components/servo 66% 0.00%
go.viam.com/rdk/components/servo/gpio 71% 0.00%
go.viam.com/rdk/config 78% 0.00%
go.viam.com/rdk/control 57% 0.00%
go.viam.com/rdk/data 77% 0.00%
go.viam.com/rdk/examples/customresources/demos/remoteserver 0% 0.00%
go.viam.com/rdk/grpc 25% 0.00%
go.viam.com/rdk/ml 67% 0.00%
go.viam.com/rdk/ml/inference 70% 0.00%
go.viam.com/rdk/module 67% 0.00%
go.viam.com/rdk/module/modmanager 80% 0.00%
go.viam.com/rdk/motionplan 71% 0.00%
go.viam.com/rdk/operation 82% 0.00%
go.viam.com/rdk/pointcloud 69% 0.00%
go.viam.com/rdk/protoutils 49% 0.00%
go.viam.com/rdk/referenceframe 72% 0.00%
go.viam.com/rdk/registry 83% 0.00%
go.viam.com/rdk/resource 84% 0.00%
go.viam.com/rdk/rimage 78% 0.00%
go.viam.com/rdk/rimage/depthadapter 94% 0.00%
go.viam.com/rdk/rimage/transform 75% 0.00%
go.viam.com/rdk/rimage/transform/cmd/extrinsic_calibration 67% 0.00%
go.viam.com/rdk/robot 86% 0.00%
go.viam.com/rdk/robot/client 82% 0.00%
go.viam.com/rdk/robot/framesystem 65% 0.00%
go.viam.com/rdk/robot/impl 81% -0.19%
go.viam.com/rdk/robot/packages 80% 0.00%
go.viam.com/rdk/robot/server 53% 0.00%
go.viam.com/rdk/robot/web 64% 0.00%
go.viam.com/rdk/robot/web/stream 87% 0.00%
go.viam.com/rdk/services/baseremotecontrol 71% 0.00%
go.viam.com/rdk/services/baseremotecontrol/builtin 78% 0.00%
go.viam.com/rdk/services/datamanager 75% 0.00%
go.viam.com/rdk/services/datamanager/builtin 85% +0.44%
go.viam.com/rdk/services/datamanager/datacapture 73% 0.00%
go.viam.com/rdk/services/datamanager/datasync 0% 0.00%
go.viam.com/rdk/services/mlmodel 83% 0.00%
go.viam.com/rdk/services/motion 53% 0.00%
go.viam.com/rdk/services/motion/builtin 86% 0.00%
go.viam.com/rdk/services/navigation 54% 0.00%
go.viam.com/rdk/services/sensors 74% 0.00%
go.viam.com/rdk/services/sensors/builtin 97% 0.00%
go.viam.com/rdk/services/shell 25% 0.00%
go.viam.com/rdk/services/slam 84% 0.00%
go.viam.com/rdk/services/slam/builtin 74% 0.00%
go.viam.com/rdk/services/slam/fake 90% 0.00%
go.viam.com/rdk/services/slam/slam_copy/config 97% 0.00%
go.viam.com/rdk/services/slam/slam_copy/dataprocess 71% 0.00%
go.viam.com/rdk/services/slam/slam_copy/utils 100% 0.00%
go.viam.com/rdk/services/vision 79% 0.00%
go.viam.com/rdk/services/vision/builtin 74% 0.00%
go.viam.com/rdk/session 97% 0.00%
go.viam.com/rdk/spatialmath 84% 0.00%
go.viam.com/rdk/subtype 92% 0.00%
go.viam.com/rdk/utils 72% -0.18%
go.viam.com/rdk/vision 26% 0.00%
go.viam.com/rdk/vision/chess 80% 0.00%
go.viam.com/rdk/vision/delaunay 87% 0.00%
go.viam.com/rdk/vision/keypoints 92% 0.00%
go.viam.com/rdk/vision/objectdetection 82% 0.00%
go.viam.com/rdk/vision/odometry 60% 0.00%
go.viam.com/rdk/vision/odometry/cmd 0% 0.00%
go.viam.com/rdk/vision/segmentation 49% 0.00%
go.viam.com/rdk/web/server 26% 0.00%
Summary 65% (22904 / 35005) +0.01%

@github-actions
Copy link
Contributor

Availability

Scene # viamrobotics:main spieswl:world-mplan-cleanup Percent Improvement Health
1 100% 100% 0%
2 100% 100% 0%
3 100% 100% 0%
4 100% 100% 0%
5 50% 80% 60%
6 10% 80% 700%
7 40% 40% 0%
8 100% 100% 0%
9 100% 90% -10%
10 100% 100% 0%
11 100% 100% 0%
12 100% 100% 0%

Quality

Scene # viamrobotics:main spieswl:world-mplan-cleanup Percent Improvement Probability of Improvement Health
1 1.31±0.00 1.31±0.00 0% 56%
2 0.90±0.00 0.90±0.00 0% 64%
3 3.09±0.43 3.11±0.58 -1% 49%
4 5.04±1.77 5.05±1.62 -0% 50%
5 21.55±5.32 23.34±5.04 -8% 40%
6 19.23±0.00 26.95±7.48 -40% 15%
7 9.36±5.69 8.04±3.73 14% 58%
8 5.76±1.15 5.49±1.10 5% 57%
9 4.60±0.19 4.58±0.20 0% 53%
10 4.28±0.35 4.28±0.35 -0% 50%
11 5.07±0.65 5.07±0.65 -0% 50%
12 4.42±1.13 4.19±1.21 5% 56%

Performance

Scene # viamrobotics:main spieswl:world-mplan-cleanup Percent Improvement Probability of Improvement Health
1 5.50±2.87 5.50±2.87 -0% 50%
2 5.50±2.87 5.50±2.87 -0% 50%
3 5.50±2.87 5.50±2.87 -0% 50%
4 5.50±2.87 5.50±2.87 -0% 50%
5 5.20±2.32 5.25±2.63 -1% 49%
6 2.00±0.00 4.88±2.85 -144% 16%
7 6.00±2.74 5.75±2.59 4% 53%
8 5.50±2.87 5.50±2.87 -0% 50%
9 5.50±2.87 5.78±2.90 -5% 47%
10 5.50±2.87 5.50±2.87 -0% 50%
11 5.50±2.87 5.50±2.87 -0% 50%
12 5.50±2.87 5.50±2.87 -0% 50%

The above data was generated by running scenes defined in the motion-testing repository
The SHA1 for viamrobotics:main is: 33d3e4103e843aa592740ad2c25ede36b55b7c04
The SHA1 for spieswl:world-mplan-cleanup is: 33d3e4103e843aa592740ad2c25ede36b55b7c04

  • 10 samples were taken for each scene
  • A timeout of 5.0 seconds was imposed for each trial

@spieswl spieswl merged commit a7c0e3d into viamrobotics:main Apr 10, 2023
@spieswl spieswl deleted the world-mplan-cleanup branch April 10, 2023 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants