GithubHelp home page GithubHelp logo

pileproject / drive Goto Github PK

View Code? Open in Web Editor NEW
5.0 8.0 4.0 2.91 MB

The drive project

License: Other

Java 74.12% HTML 23.31% CSS 2.57%
lego ev3 nxt mindstorms android bluetooth control teaching education learning programming visual-programming

drive's Introduction

Drive

Build Status

Drive provides children a gate to learn programming with visual programming and a real robot.

Available robots

We currently support 1 robot and plan to support more robots. We are going to implement them as product flavors: nxt, ev3 and pile.

Released:

Developing:

Screen Shoots

The title page of NxtDrive:

title

In the programming page, users can choose commands from the block list and put them to make a program:

block-list

programming

In the setting page, users can make some configurations:

setting

Development setup

Please fork this repository, make a new branch, modify it and send Pull Request.

Build

Linux & OS X:

./gradlew build

Windows:

./gradlew.bat build

Run Test and Generate Javadoc

Linux & OS X:

./gradlew check
./gradlew connectedCheck # do this after launching an emulator
./gradlew generateNxtReleaseJavadoc

Windows:

./gradlew.bat check
./gradlew.bat connectedCheck # do this after launching an emulator
./gradlew.bat generateNxtReleaseJavadoc

Test reports will be generated in build/reports/tests (See index.html). Javadocs will be generated in build/docs/javadoc (See index.html).

checkLicenses

This repository uses a plugin to maintain the copyright notice and it does checkLicenses task automatically in CI. If you add a new plugin and get an error in the process, please follow the instruction of the plugin, and add a new license.html in your Pull Request.

Release History

  • 1.0.0
    • First: Release NxtDrive.

Meta

PILE Project@pileproject - [email protected]

Let's discuss anything on our Mailing List!

Distributed under the Apache License, Version 2.0. See LICENSE for more information.

drive's People

Contributors

mandaiy avatar myusak avatar tiwanari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drive's Issues

WiFiCommunicator for NXT and EV3

Summary

NXT and EV3 have wifi communication function.
But this app does not support WiFi connecting function.

There seem to be some demand for wifi communication between this app and robots.
So in this issue I leave some notes for implementing the function.

What we should consider

We have to consider how the machine to be connected is specified by this app.
One possible and apparently easiest way is to input the machine's IP address directly by a user.
We have to survey whether it is possible to scan machines.

What we should implement

We have to implement WiFiCommunicator, a concrete class of ICommunicator and the counterpart of BluetoothCommunicator.
Also WiFiMachineSelectFragment and its related classes are needed to be implemented.

Where we should modify

We have to modify some bluetooth-dependent code in

  • ExecutionActivity
  • ProgrammingActivity

The other classes seem not to have to be modified.

Add Copyright Notice

The drive application does not have a copyright notice.

I will gather notices from external libraries and show them in SettingActivity.

Javadocs geneation with Gradle

Problem

Drive has some Javadocs but we don't have a good way to generate them.

Proposal

Do Javadocs generation as a task of Gradle. It should be something like this;

./gradlew generateNxtJavadocs

Initial value for NumberTextHolder

This came from a discussion on #51 .

Problem

Our apps have NumberTextHolder and we set the initial value of it as 0 for time in the default strings.xml. However, it seems to be surprising for users because the value becomes, for example, 0.000 (i.e., it has more precisions) after changing its value.

In the current implementation, we should stick to 0 not 0.000 because there is a locale problem (e.g., in French, 0.000 should be 0,000) and this causes a conversion exception.

What we should do

As @Myusak suggested in the discussion, we can fix it by setting initial values in NumberTextHolders' constructor according to the Preference of their precision (this is a new feature). So, let's make such preference!

Images in help instructions are outdated

Problem

I found the images of help instructions are outdated like this:
screenshot_1489301352

and the current block design is like this;
block

Proposal

Of course, the proposal is to fix it but the implementation was not flexible. Actually, the above image is real image not a view.

Discussion

Should we change the implementation from images to views (xml)? What do you think?

NxtControllerBuilder の必要性と実装

あってもよいが,特別必要ではない
現在の ControllerBuilder では,接続されていないものは null が入っているが,
値を取得しようとすると null pointer exception で落ちるので何かしらの対処が必要
(Userの問題ではないので例外終了はおかしい).

Missing comments/javadocs

Please add comments/javadocs and then check files.

  • ./androidTest/java/com/pileproject/drive/ApplicationTest.java
  • ./main/java/com/pileproject/drive/app/DriveApplication.java
  • ./main/java/com/pileproject/drive/comm/BluetoothCommunicator.java
  • ./main/java/com/pileproject/drive/database/DriveDatabase.java
  • ./main/java/com/pileproject/drive/database/ProgramDataManager.java
  • ./main/java/com/pileproject/drive/database/ProgramDataSpec.java
  • ./main/java/com/pileproject/drive/database/ProgramSpec.java
  • ./main/java/com/pileproject/drive/execution/ExecutionActivityBase.java
  • ./main/java/com/pileproject/drive/execution/ExecutionCondition.java
  • ./main/java/com/pileproject/drive/execution/ExecutionThread.java
  • ./main/java/com/pileproject/drive/execution/MachineController.java
  • ./main/java/com/pileproject/drive/preferences/CommonPreferencesSchema.java
  • ./main/java/com/pileproject/drive/programming/visual/activity/BlockIconAdapter.java
  • ./main/java/com/pileproject/drive/programming/visual/activity/BlockListActivityBase.java
  • ./main/java/com/pileproject/drive/programming/visual/activity/BlockPositionComparator.java
  • ./main/java/com/pileproject/drive/programming/visual/activity/ProgramListFragment.java
  • ./main/java/com/pileproject/drive/programming/visual/activity/ProgrammingActivityBase.java
  • ./main/java/com/pileproject/drive/programming/visual/block/BlockBase.java
  • ./main/java/com/pileproject/drive/programming/visual/block/BlockFactory.java
  • ./main/java/com/pileproject/drive/programming/visual/block/NumTextHolder.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/RepetitionBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/RepetitionBreakBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/RepetitionEndBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/RepetitionHasNumText.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/WhileForeverBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/repetition/WhileNumBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/selection/SelectionBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/selection/SelectionEndBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/selection/SelectionHasNumText.java
  • ./main/java/com/pileproject/drive/programming/visual/block/sequence/SequenceBlock.java
  • ./main/java/com/pileproject/drive/programming/visual/block/sequence/SequenceBlockHasNumText.java
  • ./main/java/com/pileproject/drive/programming/visual/layout/BlockSpaceLayout.java
  • ./main/java/com/pileproject/drive/programming/visual/layout/BlockSpaceManager.java
  • ./main/java/com/pileproject/drive/programming/visual/layout/ProgrammingSpaceManager.java
  • ./main/java/com/pileproject/drive/programming/visual/layout/ProgressSpaceManager.java
  • ./main/java/com/pileproject/drive/setting/AppCompatPreferenceActivity.java
  • ./main/java/com/pileproject/drive/setting/SettingActivity.java
  • ./main/java/com/pileproject/drive/setting/app/ProgramData.java
  • ./main/java/com/pileproject/drive/setting/app/ProgramDataAdapter.java
  • ./main/java/com/pileproject/drive/setting/app/ProgramListFragment.java
  • ./main/java/com/pileproject/drive/setting/app/SupervisorModeFragment.java
  • ./main/java/com/pileproject/drive/setting/machine/DeviceListAdapter.java
  • ./main/java/com/pileproject/drive/setting/machine/DeviceListItemView.java
  • ./main/java/com/pileproject/drive/setting/machine/DeviceSelectFragment.java
  • ./main/java/com/pileproject/drive/title/TitleActivityBase.java
  • ./main/java/com/pileproject/drive/util/DeployUtils.java
  • ./main/java/com/pileproject/drive/util/MeasurementUnit.java
  • ./main/java/com/pileproject/drive/util/Range.java
  • ./main/java/com/pileproject/drive/util/Unit.java
  • ./main/java/com/pileproject/drive/view/FrameView.java
  • ./main/java/com/pileproject/drive/view/NumberSelectSeekBarView.java
  • ./main/java/com/pileproject/drive/view/NumberSelectView.java
  • ./main/java/com/pileproject/drive/view/NumberSelectWheelScrollerView.java
  • ./main/java/com/pileproject/drive/view/PortTextView.java
  • ./nxt/java/com/pileproject/drive/execution/NxtController.java
  • ./nxt/java/com/pileproject/drive/execution/NxtExecutionActivity.java
  • ./nxt/java/com/pileproject/drive/preferences/BlockPreferencesSchema.java
  • ./nxt/java/com/pileproject/drive/preferences/MachinePreferencesSchema.java
  • ./nxt/java/com/pileproject/drive/programming/visual/activity/NxtBlockListActivity.java
  • ./nxt/java/com/pileproject/drive/programming/visual/activity/NxtProgrammingActivity.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/selection/IfNxtIsOutOfLineBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/selection/IfNxtWasTouchedBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/selection/IfThereWasALargeSoundBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/BackwardSecBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/ForwardSecBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/SetLeftMotorSpeedBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/SetRightMotorSpeedBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/StopSecBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/TurnLeftSecBlock.java
  • ./nxt/java/com/pileproject/drive/programming/visual/block/sequence/TurnRightSecBlock.java
  • ./nxt/java/com/pileproject/drive/setting/NxtSettingActivity.java
  • ./nxt/java/com/pileproject/drive/setting/machine/NxtPortConnectionFragment.java
  • ./nxt/java/com/pileproject/drive/setting/machine/NxtThresholdFragment.java
  • ./nxt/java/com/pileproject/drive/title/NxtTitleActivity.java
  • ./nxt/java/com/pileproject/drive/view/NxtMotorPortTextView.java
  • ./nxt/java/com/pileproject/drive/view/NxtSensorPortTextView.java

Use larger programming spaces by scrolling the page

This is a note to improve drive.

Problem

I heard that some people want to use more blocks while making programs but the screen is not large enough to do so.

Proposal

I propose to implement a function that allows users to scroll the page and add more blocks.

Note

The position of the trash box is somewhat debatable because we should take care not to move the trash box while scrolling.

Proposal of Introducing DI

This is a proposal issue for introducing DI container (Dependency Injection)
For diverse opinions, please feel free to leave any comment, @amiq11.

TL;DR

  • I hate the current structure of ...ActivityBase and Flavor...Activity
  • I want to restructure them by splitting ...ActivityBase into common logic and flavor-specific logic
  • I want to introduce Dagger2

Background

Currently we are going to implement product flavors.
There are two main features of product flavors: determining java files and merging xml.

(You can skip below 2 sections if you know product flavors)

determining java files

With product flavors, you can change files (or classes) by placing corresponding directories;
suppose you define 2 flavors (flavor1, flavor2) and have flavor1/java/com/example/Test.java, and flavor2/java/com/example/Test.java,
and the code in main/java/com/example/Main.java refers to Test class,
then the Test class is referred with accordance of the product flavor in build-time.

merging xml

You can define AndroidManifest.xml files for each product flavor and one main.
main does not belong to flavors, but it defines common resources (xml, java, images).
If you have AndroidManifest.xml in main and flavor1, Android Studio merges the two xml files in build-time.
Why this is useful is that you can change resources according to the flavor.
A launch activity is defined in the manifest xml file. So you can choose the launch activity
by defining the manifest xml in the flavor.

Why we use it and How we used it

Why this feature is needed for us is because:

  • we have to support multiple types of robots, each of which needs slightly different code (e.g., types of block, types of communication methods)
  • but code-duplication has to be minimized

That's why we are going to use productFlavors.
We have nxt, ev3, and pile robots so we'll have 3 product flavors.

In our current code, we we define TitleActivity for each flavor and specify launch activities in manifest xml files for each flavor.
With the xml files, the launch activity of each app can start properly.
And for programming (block-manipulation) and execution (communication with robots) activities,
we define ProgrammingActivityBase and ExecutionActivityBase respectively,
and then in each flavor these classes are inherited according to the flavor (e.g., for nxt, NxtProgrammingActivity and NxtExecutioinActivity).

The code of ProgrammingActivityBase is like below:

public abstract class ProgrammingActivityBase extends Activity {

    /* these methods are implemented in concrete classes */
    protected abstract Intent getIntentForBlockList();

    protected abstract Intent getIntentForExecution();

    /* the rest is common for all flavors */
    private void goToExecution() {
        Intent intent = getIntetnForExecution();
        ...
    }
    ...
};

Then in NxtProgrammingActivity is like below:

public class NxtProgrammingActivity extends ProgrammingActivityBase {

    @Override
    protected Intent getIntentForBlockList() {
        return new NxtBlockIntent();
    }

    @Override
    protected Intent getIntentForExecution() {
        return new NxtExecutionIntent();
    }
}

Problem Statement

What I am concering is that the structure seems awkward and the base classes are too huge for abstract class.
In my opinion, the straightforward way for this situation is that defining interface for flavor-specific logic (intent-provider for programming)
and injecting flavor-specific-implementation into the interface.

So what I want to suggest is like below:

public class ProgrammingActivity extends Activity {
    private IntentProvider intentProvider;

    private void goToExecution() {
        Intent intent = intentProvider.forExecution();
        ...
    }
}

public interface IntentProvider {
    Intent forExecution();
}

public class NxtIntentProvider {
    @Override
    public Intent forExecution() {
        return ...
    }
}

By splitting code like above, the code gets

  • better organized
  • easier to be mocked
  • easier for new-comers to understand what is needed to be implemented for other flavors.

And this proposal also solves #31.

Coping with dependency by DI container

If you feel my proposal sounds good, you might wonder how the interfaces are injected.
That kind of problems are called Dependency Injection.
There are a number of pages describing this problem, so please google it.

For Android projects, there is a cool DI container called Dagger2.
So I want to use this for our android project.

I tested the feasibility of my proposal in here

By using Dagger2, the code would be like below:

public class ProgrammingActivity extends Activity {

    @Inject
    IntentProvider intentProvider;

    /* same as above */
}

How cool, isn't it?
Thank you for reading this too long issue.

Application class not found with AndroidStudio

I don't know why but apps won't work with AndroidStudio 2.1 (Run -> Run 'app') in my environment. If you also meet the situation, please try this command to install apps (this is for NxtDrive);

./gradlew clean assembleNxtDebug installNxtDebug

This came to occur after updating a library but the cause may be something related to my development environment.
rejasupotaro/kvs-schema#20

Testing should be considered more seriously

I know I am a careless man who makes many bugs but #46 has too many bugs I expected and what made the matter worse, they hadn't been checked for a long time. So, I propose that we think about testing more seriously. Even if old codes somehow work, I think they also need tests to add changes to them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.