Using OFF to allow ...
 
Notifications
Clear all

Using OFF to allow for backdrivability

5 Posts
1 Users
0 Likes
4,894 Views
(@tsands)
Posts: 2
New Member Guest
Topic starter
 

Hello,

First off, if this is in the wrong forum, please move this post. I have a SM23165D that I'm working with, my use case demands that when the shaft is not in motion the torque brakes on the motor should not be engaged and the user should be backdrive the load attached to the motor. That is, MTB should not be engaged by default. If my understanding is correct, following G TWAIT with OFF should allow the shaft to be backdriven, but I find that is not the case in testing.

I've begun development on a C++ library that wraps some of the commands available through SMI. Below is a sample method in the SmartMotor class that moves the shaft to a position using position mode (MP.) Note that backdrive_ is set to true by default and the writeOut method writes the command to the motor via RS-232. I've confirmed that when the brk_str is left off from the cmd_str, the shaft will rotate and then stop, but the drive status indicator (LED0) will remain lit (solid green, AKA drive on) and the shaft will be locked in position. When brk_str is left on the cmd_str and brk_str=="OFF", motion never begins and thus the shaft remains unlocked, but the Trajectory Status Indicator (LED1) flashes on briefly.

Any suggestions would be greatly appreciated! I feel like I'm missing something painfully obvious.

Best,
Trevor

void SmartMotor::moveToPos (int pos, int acc, int vel, bool dir)
  {
    std::string dir_str;
    std::string brk_str;
    std::string acc_str = "ADT=" + std::to_string(acc);
    std::string vel_str = "VT=" + std::to_string(vel);
    std::string pos_str = "PT=" + std::to_string(pos);

    // Set direction of shaft rotation
    if(dir == true) {dir_str = "MINV(0)";}  // Clockwise
    else            {dir_str = "MINV(1)";}  // Counter-Clockwise

    // Enable or disable torque brake based on backdrive_ member flag
    if(backdrive_ == true)  {brk_str = "OFF";}
    else                    {brk_str = "MTB";}

    std::string cmd_str = dir_str + " " + acc_str + " " + vel_str + " " + pos_str + " G TWAIT " + brk_str;

    // Try to write out on an open comms channel
    try
    {
      setMode(OpMode::POSITION);
      writeOut(CMD + cmd_str + RTN);
    }
    catch(communication::CommsException &e)
    {
      std::cerr << "ERROR: " << e.what() << std::endl;
    }
  }
 
Posted : 21/04/2016 2:27 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

To get the motor to free wheel, you have to get MTB to turn off. Issuing the OFF command by itself will take the shaft out of servo lock, but MTB will still be active (as you have experienced).
To get the motor to truly free wheel without resistance, you must issue BRKRLS (even though you may not have a brake on the system) before issuing the OFF command. This will allow MTB to turn off allowing the motor shaft to rotate without resistance.

 
Posted : 21/04/2016 3:12 pm
(@tsands)
Posts: 0
New Member Guest
 

Thank you for your prompt reply!

I've amended my code as below; though I'm still finding that the motion will not get executed as expected. That is: LED1 flashes solid green momentarily but the shaft does not rotate. If I remove the writeOut(CMD + brk_str + RTN); line following writeOut(GO);, the shaft spins as expected and (also as expected) the torque brakes engage. Do you have any notion as to why this might be? It seems to me that the TWAIT command is being ignored and the motor is immediately being issued BRKRLS OFF after G.

void SmartMotor::moveToPos (int pos, int acc, int vel, bool dir)
  {
    std::string dir_str;
    std::string brk_str;
    std::string acc_str = "ADT=" + std::to_string(acc);
    std::string vel_str = "VT=" + std::to_string(vel);
    std::string pos_str = "PT=" + std::to_string(pos);

    // Set direction of shaft rotation
    if(dir == true) {dir_str = "MINV(0)";}  // Clockwise
    else            {dir_str = "MINV(1)";}  // Counter-Clockwise

    // Enable or disable torque brake based on backdrive_ member flag
    if(backdrive_ == true)  {brk_str = "BRKRLS OFF";}
    else                    {brk_str = "MTB";}

    std::string cmd_str = dir_str + " " + acc_str + " " + vel_str + " " + pos_str;

    // Try to write out on an open comms channel
    try
    {
      setMode(OpMode::POSITION);
      writeOut(CMD + cmd_str + RTN);
      writeOut(GO); // Equivalent to writeOut(CMD + "G TWAIT" + RTN);
      writeOut(CMD + brk_str + RTN);
    }
    catch(communication::CommsException &e)
    {
      std::cerr << "ERROR: " << e.what() << std::endl;
    }
  }
 
Posted : 21/04/2016 4:21 pm
(@csearcy)
Posts: 0
New Member Guest
 

The TWAIT command only works when it is in a program that is downloaded to the motor. It will not work coming in as a serial command on the RS232 or RS485. The preferred workaround is to write a subroutine in the motor that you can pass values to from your host program and then call the subroutine with the GOSUB command (thus allowing the TWAIT command to operate in the motor).
If the shaft is still not free wheeling, try swapping the order of the OFF and BRKRLS commands.

 
Posted : 21/04/2016 5:37 pm
(@tsands)
Posts: 2
New Member Guest
Topic starter
 

The TWAIT command only works when it is in a program that is downloaded to the motor.

Ah-ha! That was what was getting me hung up. I've since implemented subroutines to handle calls to execute motor motion with TWAIT and followed them up with brake commands. Everything's working as intended now.

Thanks!

 
Posted : 22/04/2016 5:05 pm
Share: