Solving Coding Conflicts

To manually resolve a conflict, follow these steps:

  1. Review the conflicts. Navigate to the classes that are marked for conflict and scroll to the areas with errors. You will notice code that is split by the following markers: <<<<<<<, =======, and >>>>>>>. The top section (HEAD) before the marker ======= contains the old code that was written before the pull, while the bottom section contains the code that was just pulled. Review the differences and delete one of the two, or merge the code together by manually deleting lines. Don’t forget to delete the markers once done.
  2. Add class changes to index. Once all conflicts have been reviewed and edited in a class, right click on the class and navigate to Team > Add to index. Repeat this process for every class with conflicts in your project.
  3. Commit changes. Once all conflicts have been manually resolved, right click on any class and navigate to Team > Commit.

Example of a merge/pull conflict:

Lines of code that are either unchanged from what was pulled, or were automatically resolved because only one side changed.
<<<<<<< yours
This is where the code that you wrote goes
=======
This is where the conflicting code that was pulled goes
>>>>>>> theirs
More lines of code that were cleanly resolved or unmodified.

For more information, click here.

Manager

import java.io.IOException;

import command.Debugger;

import parser.DefaultParser;
import manager.Manager;

public class ClientTestManager extends Manager{

        DefaultParser parser;
        TestStatus status;
        public ClientTestManager(String key,String i) {
                super(key,i);
                parser = new DefaultParser();
                super.assignInOutStreamsToParser(parser);
                status = (TestStatus)super.statusInitialization(new TestStatus("testStatus"));
                super.setDelay(3000);
        }

        @Override
        public void execute() {
                try{
                        parser.write("Writing to device");
                        
                }catch (IOException e) {
                        System.out.println(super.getManagerName()+"Manager- Device connection lost. Trying to reconnect");
                        super.reportConnectionDown();
                }
                Debugger.traceln("Client "+super.getManagerName()+" = "+status.counter);
                status.counter++;
                status.setStatusUpdated(true);
        }

        @Override
        public char[] getDeviceSignal() {
                char[] temp = new char[1];
                return temp;
        }
        

}

Parser

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class DefaultParser implements SerialParserInterface{

        public InputStream input;
        public OutputStream output;
        @Override
        public void setStream(InputStream input, OutputStream output) {
                this.input  = input;
                this.output = output;
        }
        
        public int read()throws IOException
        {
                        return input.read();
                
        }
        public void write(String arg)throws IOException
        {
                byte[] temp = arg.getBytes();
                write(temp);
        }
        public void write(byte[] arg) throws IOException{
                
                        this.output.write(arg);
                
        }

        
}

Status

import java.io.IOException;

import command.Debugger;

import parser.DefaultParser;
import manager.Manager;

public class ClientTestManager extends Manager{

        DefaultParser parser;
        TestStatus status;
        public ClientTestManager(String key,String i) {
                super(key,i);
                parser = new DefaultParser();
                super.assignInOutStreamsToParser(parser);
                status = (TestStatus)super.statusInitialization(new TestStatus("testStatus"));
                super.setDelay(3000);
        }

        @Override
        public void execute() {
                try{
                        parser.write("Writing to device");
                        
                }catch (IOException e) {
                        System.out.println(super.getManagerName()+"Manager- Device connection lost. Trying to reconnect");
                        super.reportConnectionDown();
                }
                Debugger.traceln("Client "+super.getManagerName()+" = "+status.counter);
                status.counter++;
                status.setStatusUpdated(true);
        }

        @Override
        public char[] getDeviceSignal() {
                char[] temp = new char[1];
                return temp;
        }
        

}

Discovery Lab Rules

Discovery lab rules

Naming rules:

  1. Capitalize the first letter of every word except the first one. Ex: testVariable
  2. Final variables are all upper case and words are separated with an under score. Ex: TEST_FINAL_VAR
  3. For class names capitalize the first letter of every word. Ex: TestClass
  4. To create a manager class put the Manager word and the the end. Ex: TestManager
  5. To create a status class put the Status word at the end. Ex: TestStatus
  6. Use this to reference instances inside your own class. But not for static instances.
  7. Use super to reference upper label instances.
  8. Use descriptive names for variables

Version Control using Eclipse

How to set up the telebot project on eclipse.

  1. Create a bit bucket account.
  2. Download the git plug in for eclipse:
  3. You should get an invitation to join the telebot repository. Go to your bitbucket inbox to accept it.
  4. Import the telebot project:
    • Go to: File->Import->Git->Projects from git
    • At the ‘Import your project from git window’ copy paste the telebot repository URL from your bitbucket account.
    • Enter your password and click Next.
    • Eclipse will ask you if you want to create a new project: Select New project wizard and click Next.
    • Eclipse should have created a directory with the repository. At the new project wizard window uncheck Use default location and browse to the directory of that repository. Select it as the source code for the new project you are about to create. (Do not use the default location).

Version control rules and procedures.

  1. Before making any changes pull from remote repository:
    • Right click on the project and select: Team->Pull.
    • Resolve any conflicts and commit.
    • To commit right click project and: Team->Commit…, Then write a message and click Commit.
  2. To modify the project create a new branch.
    • Right click project and select. Team->Switch to->New Branch…
    • Give a name, select merge and click Finish.
  3. Make any changes in your own local branch. And commit.
  4. After you have tested your code you can merge your work with the master branch.
    • To merge first switch to master branch.
    • Right click on project and select: Team->Merge…
    • Select your branch and click Merge.
    • Delete your old branch.
  5. After merge you should have only the master branch.
  6. Push the master branch to the remote repository.
    • Right click the project and select: Team->Remote->Push.
    • Select ‘Configured remote repository’ and click Next.
    • At the ‘Source ref:’ select master[branch].
    • At the ‘Destination ref:’ select master[branch].
    • After you have selected the Sourse and Destination click Add Spec.
    • Click Finish.

Working with Telebot project

The telebot software uses Managers to control micro-controllers and Statuses to communicate between operator and robot.

How to create a Manager class

  • Create a new class and extend the Manager abstract class.
  • Implement the execute() method.
  • Implement the getDeviceSignal() method.
  • Click here for manager example.

How to create a Status class

  • Create a new class and extend the Status abstract class.
  • Implement the copy(Status argStatus) method.
  • Implement the printData() method.
  • Click here for status example.

How to create a Serial Parser class

  • To create a serial parser implement the SerialParserInterface.
  • Implement the setStream(InputStream input, OutputStream output) method. This will give you access to communicate to your device.
  • To implement your serial parser inside your Manager use the assignInOutStreamsToParser(SerialParserInterface parser) method. See manager tutorial for how to set up DefaultParser (Included in the Telebot core project).
  • Click here for serial parser example.

CS4HS Google Workshop

From Thursday June 13 to Saturday June 15, the Discovery Lab hosted an event sponsored by Google. The event is Computer Science for High school Students (CS4HS) and it was a complete success.  

The event consisted of several lectures on programming and hardware given by Dr Jong-Hoon Kim and Dr Nagarajan Prabakar, as well as hands on exercises that led to the final project; a remotely controlled robot. There were a total of 24 attendees, each of which was given a kit with all the parts necessary for the project. The attendees not only were taught about the hardware and software needed for the event, but had also the chance to see the Discovery Lab from within.

Although the attendees to the event had many questions and technical problems with the hardware and software, the event went on smoothly thanks to the help of the many volunteers that aided in the process. All the volunteers are members of the Discovery Lab, which allowed the students to have a more personal contact with the lab’s researchers.

Once the event was finished, the attendees were given a certificate of completion as a small memento of the event. Even once the workshop had concluded, many students and teachers wanted to stay and keep working on their projects, proof of their involvement and liking of the event.

Hopefully, more workshops like this one are on their way for the Discovery Lab.

DSC_0297.JPG

  DSC_0060.JPG DSC_0185.JPG          DSC_0174.JPG DSC_0231.JPG       DSC_0076.JPG DSC_0066.JPG       DSC_0112.JPG

Google Event

The Discovery Lab will be hosting an event for High School Students sponsored by Google. The event will be taking place starting on Thursday June 13 and will continue until Saturday June 11. Although it took some time, the participants have already been chosen and the event is completely full by now. The event will teach the students how to work with hardware such as the Raspberry Pi and scripting languages related to the hardware being taught. The Discovery Lab will provide breakfast and lunch for the participants, as well as all the materials needed for the Workshop. The members of the Discovery Lab are looking forward to this event.

 

For more information please visit the website.
http://discoverylab.cis.fiu.edu/cs4hs/

Telebot project video update

The Telebot team has a new video update about the improvements the Discovery Lab has performed on the project. The video talks about the many teams that are arduously working on their sections of the Telebot and their jobs. We also present some of the results achieved in the project. Although there is still a long way to the completion of the project, these advancements are proof that our end goal is closer than ever.

 

https://www.youtube.com/watch?v=VPqS9mGJqbk