pioneers / dawn-v0

(archived; now in PiECentral) Dawn is a cross-platform frontend for the Pioneers in Engineering robotics control system.
https://pioneers.berkeley.edu
4 stars 33 forks source link

Robot Enable/Autonomous #248

Closed kevinmasd closed 8 years ago

kevinmasd commented 8 years ago

Buttons are currently next to the change theme dropdown. May need to change icons to something more intuitive.

kevinmasd commented 8 years ago

setState has some kind of delay that causes issues with json correctness.

Default set back to false, given I can't guarantee robot can be sent a json file on connect.

139 #141 #184 #211 have been implemented

222 has been partially implemented

AllanYangZhou commented 8 years ago

@kevinmasd The problem is that the program will reach the Ansible.sendMessage line before this.setState has had time to take effect. You need to do the message sending part in a function passed to this.setState. For example:

this.setState({gameEnable: !this.state.gameEnable}, ()=>{
  Ansible.sendMessage('game', {
    enabled: this.state.gameEnable,
    autonomous: this.state.gameAuto
  });
});

In general, you can do:

this.setState(data, function);
kevinmasd commented 8 years ago

Done.

kevinmasd commented 8 years ago

Is there a persistent variable I can store this data, or would I have to create an indicator file?

AllanYangZhou commented 8 years ago

Ah, I recommend just removing this change for now so I can just merge this in, since #211 is not a priority right now. Then you can make the necessary changes in a different PR.

You would use the electron-json-storage to store this data permanently, which you can import like so: https://github.com/pioneers/daemon/blob/develop/dawn/js/components/Editor.js#L32.

You can see the actual documentation here: https://github.com/jviotti/electron-json-storage

kevinmasd commented 8 years ago

Tour now is based on first run. I'm not going to rebase given that the last time I tried to do so, I had more commits than when I began.