Announcement

Collapse
No announcement yet.

Fork of FTCDriverStation App with embedded code for simple simulator of legacy module

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HagertyRobotics
    replied
    Originally posted by pbrier View Post
    I had no problem cloning your repo and compiling it.

    Regarding using the NXT as I2C legacy interface: I cannot make it appear on the USB bus as an FTDI serial interface. The NXT has its own USB interface with its own Vendor and Product ID.

    I see in your code that you took some short cuts in the protocol decoding (you base your response on the length of the message as opposed to actual addresses and lengths) but hey: it works!
    Sorry, I forgot about the dependency on the FTDI chip that the NXT doesn't have. We have been using a FTDI to Serial converter cable on our LaunchPad.

    Yes, we took some shortcuts on the protocol since those packets were the only ones they were sending currently. That needs to be cleaned up, especially if packets could be lost.

    Thanks for trying it!

    Leave a comment:


  • pbrier
    replied
    Originally posted by HagertyRobotics View Post
    Did anyone get a chance to try compiling the app and running a demo OpMode? NxtEncoderOp should work if you name your motors and controller the same as in the OpMode. We are just curious since this is the first time creating a GitHub project and one of the other students tried downloading it on his computer but there was some problem with Gradle. It seems to work fine on the computer we use for development (not sure what changes we might have made to Android Studio).

    To try it, you would just need two phones. No other hardware is needed.

    Thanks for your help
    I had no problem cloning your repo and compiling it.

    Regarding using the NXT as I2C legacy interface: I cannot make it appear on the USB bus as an FTDI serial interface. The NXT has its own USB interface with its own Vendor and Product ID. This is no problem, as there is a complete communication framework available in Java (using LeJos) and I have it working inside the FTC Robot controller app. So all I have to do is forward the I2C read and write commands to the NXT via this channel. Ideally it would replace the ModernRoboticsUsbLegacyModule class in the SDK, but your approach (replacing the FTDI device driver) is a great route, and more isolated.

    I see in your code that you took some short cuts in the protocol decoding (you base your response on the length of the message as opposed to actual addresses and lengths) but hey: it works!

    Leave a comment:


  • HagertyRobotics
    replied
    Did anyone get a chance to try compiling the app and running a demo OpMode? NxtEncoderOp should work if you name your motors and controller the same as in the OpMode. We are just curious since this is the first time creating a GitHub project and one of the other students tried downloading it on his computer but there was some problem with Gradle. It seems to work fine on the computer we use for development (not sure what changes we might have made to Android Studio).

    To try it, you would just need two phones. No other hardware is needed.

    Thanks for your help

    Leave a comment:


  • skatefriday
    replied
    Originally posted by HagertyRobotics View Post
    There is also a change to one of the build.gradle scrips to remove the FTDI class.
    Clever

    Code:
    dependencies {
        compile files('libs/android-support-v4.jar')
     //   compile (name:'d2xx', ext:'jar')
        compile (name:'RobotCore-release', ext:'aar')
        compile (name:'ModernRobotics-release', ext:'aar')
        compile (name:'FtcCommon-release', ext:'aar')
        compile (name:'WirelessP2p-release', ext:'aar')
        compile (name:'Analytics-release', ext:'aar')
    }
    And replacing it with...

    Code:
    package com.ftdi.j2xx;
    
    import android.os.SystemClock;
    import android.util.Log;
    
    import com.qualcomm.robotcore.util.TypeConversion;
    
    import java.util.Queue;
    import java.util.concurrent.ConcurrentLinkedQueue;
    
    public class FT_Device
    {
        <snip>
    }

    Leave a comment:


  • HagertyRobotics
    replied
    Originally posted by pbrier View Post
    Great work! Don't be too shy in releasing the launchpad code! We can also help in cleaning it up.

    Replacing the FTDI driver should also work in combination with the NXT application that I have worked on. We could just forward the I2C read/writes to the NXT that sends them to the motor controllers.
    This would allow everyone to use their existing hardware with the new SDK. I'll have a look into that.
    For your NXT solution, would you even need to replace the FTDI drivers as we did? Knowing the protocol, couldn't you program the NXT to accept the protocol? The NXT plugs in as a OTG device, correct? I might have missed something in our description.

    The launch pad code is essentially the same as the replaced FTDI code. The FTDI code is acting as a simple Legacy Module. It should also work as a USB Motor Driver also with some small changes. The launch pad code was written in assembly and we are converting it to C. One of the students likes to write in assembly, crazy.

    Please let us know how we can help.

    Leave a comment:


  • pbrier
    replied
    Great work! Don't be too shy in releasing the launchpad code! We can also help in cleaning it up.

    Replacing the FTDI driver should also work in combination with the NXT application that I have worked on. We could just forward the I2C read/writes to the NXT that sends them to the motor controllers.
    This would allow everyone to use their existing hardware with the new SDK. I'll have a look into that.

    Leave a comment:


  • Fork of FTCDriverStation App with embedded code for simple simulator of legacy module

    A number of people asked if we could release the code for our legacy module that runs on the Ti LaunchPad. We are still trying to get everything
    cleaned up and organized and will do so soon.

    We wanted to release a link to a fork of the FTC Driver Station App that we have been using to test things. It has a simple simulator built in and doesn't require a OTG connection. You can use it to make a connection to a simulated legacy module and enable a couple of motors on it. OpMode programs can be written that use the motors and the encoders of the simulated module.

    http://github.com/HagertyRobotics/ftc_app

    All four motor modes are included:
    RUN_USING_ENCODERS - Simple PID loop
    RUN_WITHOUT_ENCODERS - Motor power directly related to encoder ticks
    RUN_TO_POSITION - PID loop tries to reach target with PI controller. Trapezoid ramp not included.
    RESET_ENCODERS - Resets encoders

    Please see the two added files in java/com/ftdi.j2xx. These are just simple files that take the place of the original FDTI serial drivers. They intercept the calls to the Legacy Module and simulate the two motors attached. There is also a change to one of the build.gradle scrips to remove the FTDI class. The SDK OpModes shouldn't be able to tell that they are talking to a simulated controller.

    The OpMode "NxtEncoderOp" should work with this setup. It will go forward until the first encoder goal is reached and then reverse to the second goal. It takes a little while for the PID to stabilize, could use some tuning. Before using, you will need to do a scan for the controller and add the motor names and controller name to match the OpMode code (eg. motor_2, wheels)

    We are sorry we don't have much documentation yet but there are some comments in the code.

    We hope this will help someone that wants to experiment with the code. Note: some writes to the devices may have to be done twice because of a bug in the Beta SDK that was discussed in our previous posting. There are outputs in Logcat that should help with understanding the protocol.

    Please feel free to fix and bugs or add features. This is our first experience with GitHub so please bear with us.

    We are also working on another simulator using ROS that we will release soon.
Working...
X