SD540C, Java and FRC
 Hardware Related   Started by John Burnham   2017-02-09 00:32:18 -05:00   Comments: 5    Viewed: 222

  1. John Burnham
    John Burnham Member
    First, to introduce myself, I am the Programming Mentor for FRC Team 2903, the NeoBOTS.  One of our other mentors saw the SD540C motor controllers and thought they would be an improvement over the Talon SRX CAN motor controllers we used last year, in regards to wiring and electronics layout. 

    I can agree with him on that portion. The rest of it has been painful.  

    The configuration tool downloaded never finds any of the motor controllers on our can bus and it crashes when we attempt to refresh.  I discovered a command line utility located on the roboRIO in /usr/local/bin called clcp_sd540c, but soon discovered that, while it could see the controllers on the CAN bus, I didn't have enough information on how to program them.  I looked around for documentation, but without finding any, I used a disassembler and reverse engineered the program to figure out the command line format.

    clcp_sd540c scan
    clcp_sd540c id <id> <new_id>

    are the most important commands, although I also used the name command to rename the devices.  Now that id's of the controllers had been modified so that I could have all 8 of them on the CAN bus, I was able to load some simple teleop code to drive with a joystick.  

    This is where I began to run into problems.  The Talon SRX CAN motor controllers had very good support in the WPI library and could hook into the robot drive subsystem and we could simply use ArcadeDrive or TankDrive after creating the robotdrive object with the 4 motor controllers.  The SD540C controllers, not so much.  We had to get them setup manually and create our own arcade and tank drive methods in order to even drive the robot.  We ran into several problems with the controllers:

    1.  the voltage ramp up is not 0 by default as the documentation says.  I am not sure what it was, but it was not 0.  And even after setting it to 0, the controllers do not immediately apply the power to the motors.  
    2. Setting the Stop mode to brake rather than the default coast, does not always stop the motors immediately, sometimes they continue to run for a second or two.
    3. The motors whine furiously like they are not getting enough voltage.  When they are at full power it's fine.  I can provide a video which I believe has sound if desired.  
    4. Frequently when starting, the motors run at a very high rate for a second or two, or until we press the drive control joystick.  We haven't debugged that one too far yet.
    5.  SetInverse(true), does not reverse the direction of the motor controller

    Needless to say, we are quite disappointed at this point in the season, with only 2 weeks left in build season.  We are already preparing to move back to the Talons as we know they suited our needs and will figure out another way to clean up their wiring.  Unless you are able to help us on by friday to get some of these issues corrected.  The whining we can live with, but the ramp up speed, when we asked for 0 rampup is the biggest issue.  The second one is the not stopping when no power is applied to the controllers.  Having SetInverse() not working, is an annoyance, but we work around it by sending the negative motor power to the controllers on that side of the roboot.

    The electronics lead sent an email last Saturday describing some of our issues and included pictures of the wiring.

    Any other questions, please feel free to ask.

    John


    John Burnham, 2017-02-09 00:32:18 -05:00
  2. John Burnham
    John Burnham Member
    As a quick followup,  one thing that was giving us some difficulty was that the command line tool did not always function the first time,  For example, in order to scan for devices (clcp_sd540c scan), it would frequently return an error before it would return a list of one or two devices, I don't think it ever returned all of the devices on the chain.  The same was for the id or name command, you had to run them multiple times with the frequent error of device not present or, infrequently, device not responding, before giving a successful return code.
    John Burnham, 2017-02-09 09:34:35 -05:00
  3. Mindsensors Support
    Mindsensors Support Member Richmond
    Dear John,

    We are determined to figure out why you are not able to have the same experience we had in the lab. I would love more information about the configuration tool crash so we can fix that, but let's focus on the most pressing issues. We hope you will be able to have the same success we achieved in testing before shipping.

    As long as the driver station is enabled, the set(double speed) method should always set the motor controller to that speed. If the SD540C has a positive voltage ramp value set, it will ramp up to the new speed at whatever rate it is set to. If voltage ramp is not used, it should immidiately be set to that new speed. If you have a SD540C instance named motor, maybe add motor.setVoltageRamp(0); to robotInit(). The motors should always stop when the driver station is disabled.motor.setStopMode(CANSD540.StopMode.Coast); from this example.

    I will contact you now to help resolve these issues.
    Mindsensors Support, 2017-02-10 10:01:04 -05:00
  4. Mindsensors Support
    Mindsensors Support Member Richmond

    Dear John,

    We have been able to reproduce the behavior you have described. It is quite likely that the cause is duplicate CAN IDs.

    We tried many different configurations with 10 SD540Cs on the network. Even with this many and 3 CANSplitters, the GUI and clcp commands succeeded when each device had a unique ID. This also worked with or without many resisters at various points on the networks. However, once we introduced one repeated ID in any configuration we experienced erratic behavior.

    As you have been savvy enough to access the clcp_sd540c command-line tool yourselves, you can use the blink command to help debug this. With two SD540Cs set to ID 12 (and 8 others with unique IDs), calling clcp_sd540c 12 blink will cause both devices with this ID to blink. This method will work as long as no other commands are called on the duplicate ID. If any other commands have been called, a power-cycle is required to clear the collision.

    Thank you for your determination in using out product on your robot. We have added additional detailed error messages to the mindsensors configuration tool and will add a new panel to help resolve CAN ID conflicts. We wish you luck this season and hope you can have greater success with our SD540C motor controllers in future years.

    Mindsensors Support, 2017-02-14 17:37:08 -05:00
  5. John Burnham
    John Burnham Member
    Thank you.  For purposes of assisting others, I have posted your email response to me here:

    ---------------------------------------

    Please update the Library software for Java/C++ and firmware of your SD540C.

    new versions available as follows:
    firmware-version: 1.8
    library-version: 1.11

    Things to do:

    1) Update the Java/C++ libraries

    download the file: http://www.mindsensors.com/largefiles/FIRST/mindsensors.zip

    and follow these instructions to install library:

    Installing the Library:

    Check your home user directory (C:/Users/username) and look for a wpilib folder. The WPILib Eclipse plugins should automatically download and create this folder when you launch Eclipse.

    Inside the wpilib folder you should see a folder named "user". Download the mindsensors FRC library, unzip it, and copy the user folder here to the corresponding folder you found earlier. Your user folder should contain a cpp and java folder. (replace old files with new ones).

    Further details here: http://www.mindsensors.com/blog/how-to/how-to-use-sd540c-and-canlight-with-roborio

    2) Update the mindsensors Configuration Tool

    Please download latest version of tool from following url:

    http://www.mindsensors.com/largefiles/FIRST/mindsensorsConfigurationTool.zip

    unzip it in a known location,

    Disconnect the PDP board from CAN network, and

    Run the tool.

    How to use this tool: http://www.mindsensors.com/blog/how-to/using-the-mindsensors-configuration-tool

    3) Update the SD540C Device firmware

    current version is 1.8 - file name: B_SD540C_V1p8.hex

    Use the  'Firmware update' option from the config tool.

    (Ensure to Disconnect the PDP board from CAN network before running this tool.)

    Run the Firmware update for all your SD540C's.

    -----------------------------------------


    Thank you!
    John Burnham, 2017-02-17 12:35:14 -05:00
  6. (You must log in or sign up to post here)

Log in | Sign up
Tems & Conditions!
Help!