-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disabled task_space_pose as it's not working properly (robot moves wh…
…erever) Not happy with the looks of robot info yet, button disabled Added much simpler task_space_position block (no rotations, also not working yet)
- Loading branch information
Showing
5 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as Blockly from "blockly"; | ||
|
||
import ClickableTargetMutator from '../mutators/clickable_target_mutator' | ||
import Simulation from '../../simulator/simulation' | ||
|
||
const fieldKeys = ['X', 'Y', 'Z']; | ||
|
||
Blockly.Blocks["task_space_position"] = { | ||
init: function () { | ||
let i = 0; | ||
this.jsonInit({ | ||
type: "task_space_position", | ||
message0: "x %1 y %2 z %3", | ||
args0: [ | ||
{ | ||
"type": "field_number", | ||
"name": fieldKeys[i++], | ||
"value": 0, | ||
"precision": 0.1 | ||
}, | ||
{ | ||
"type": "field_number", | ||
"name": fieldKeys[i++], | ||
"value": 0, | ||
"precision": 0.1 | ||
}, | ||
{ | ||
"type": "field_number", | ||
"name": fieldKeys[i++], | ||
"value": 0, | ||
"precision": 0.1 | ||
}, | ||
], | ||
inputsInline: true, | ||
output: "Array", | ||
colour: "%{BKY_MOVEMENT_HEX}", | ||
tooltip: | ||
"Eine Position im Arbeitsraum (definiert über die Position des Endeffektors)", | ||
helpUrl: "", | ||
}); | ||
this.setMutator(new ClickableTargetMutator()); | ||
}, | ||
onClick: function (e) { | ||
Simulation.getInstance(sim => { | ||
const pose = sim.getTaskSpacePose(); | ||
for (let j = 0; j < 3; j++) { | ||
this.setFieldValue(pose[j].toFixed(1), fieldKeys[j]); | ||
} | ||
}); | ||
}, | ||
}; | ||
|
||
|
||
Blockly.JavaScript["task_space_position"] = function (block) { | ||
let ret = '["task_space", '; | ||
for (const key of fieldKeys) { | ||
ret += block.getFieldValue(key) + ', '; | ||
} | ||
ret = ret.slice(0, -1) + ']' | ||
|
||
return [ret, Blockly.JavaScript.ORDER_ATOMIC]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters