File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
lib/widgets/resources/arm_widgets Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -11,21 +11,26 @@ class JointPositionsWidget extends StatefulWidget {
1111 State <JointPositionsWidget > createState () => _JointPositionsWidgetState ();
1212}
1313
14+ bool _isLive = false ;
15+
1416class _JointPositionsWidgetState extends State <JointPositionsWidget > {
1517 List <double > _jointValues = [];
16- bool _isLive = false ;
1718
1819 @override
1920 void initState () {
2021 super .initState ();
21- _getJointInfo ();
22+ _getJointPositions ();
2223 }
2324
24- Future <void > _getJointInfo () async {
25+ Future <void > _getJointPositions () async {
2526 _jointValues = await widget.arm.jointPositions ();
2627 setState (() {});
2728 }
2829
30+ Future <void > _setJointPositions () async {
31+ await widget.arm.moveToJointPositions (_jointValues);
32+ }
33+
2934 @override
3035 Widget build (BuildContext context) {
3136 return Column (
@@ -78,7 +83,7 @@ class _JointPositionsWidgetState extends State<JointPositionsWidget> {
7883 shape: RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (4 )))),
7984 ),
8085 child: OutlinedButton .icon (
81- onPressed: _isLive ? null : () {} ,
86+ onPressed: _isLive ? null : _setJointPositions ,
8287 label: Text ("Execute" ),
8388 icon: Icon (Icons .play_arrow),
8489 ),
@@ -139,6 +144,10 @@ class _BuildJointControlRowState extends State<_BuildJointControlRow> {
139144 );
140145 }
141146 });
147+
148+ if (_isLive) {
149+ widget.arm.moveToJointPositions (_jointValues);
150+ }
142151 }
143152
144153 @override
You can’t perform that action at this time.
0 commit comments