Coder Social home page Coder Social logo

Comments (3)

youtalk avatar youtalk commented on August 25, 2024

Thank you for using the dynamixel_control. I haven't used it with wheeled robot but I hope you can do it without any modification. Please show me the log.

from dynamixel_hardware.

robofoundry avatar robofoundry commented on August 25, 2024

I was able to troubleshoot the issue and it actually works with some minor changes:

  1. Main issue was ros2_control diff_drive_controller continuously sends linear and angular velocities of 0 when the cmd_vel timeout is detected when you let go of joystick. So when you are moving the robot around, it works fine but it never stops the robot due to the if statement in line 286, of write method, which only goes into that logic if velocity != 0. So I had to comment that if statement so the robot will stop when 0 velocities are sent by the diff_drive_controller.
// commented if statement to allow robot to receive 0 velocity from diff_drive_controller
286 //if (std::any_of(
//        joints_.cbegin(), joints_.cend(), [](auto j) { return j.command.velocity != 0.0; })) {
    // Velocity control
   // line below is also not necessary to call every time if the robot is only used in velocity control mode and it is set during configure method
    set_control_mode(ControlMode::Velocity); 
    for (uint i = 0; i < ids.size(); i++) {
      commands[i] = dynamixel_workbench_.convertVelocity2Value(
        ids[i], static_cast<float>(joints_[i].command.velocity));
    }
    if (!dynamixel_workbench_.syncWrite(
          kGoalVelocityIndex, ids.data(), ids.size(), commands.data(), 1, &log)) {
      RCLCPP_ERROR(rclcpp::get_logger(kDynamixelHardware), "%s", log);
    }
    return return_type::OK;
 // }
  1. Optional change 1 - since I'm using the robot in wheel mode/velocity mode, I commented out position control code in write method as it is not being used. This change is not required for the fix.
  2. Optional change 2 - in header file I set the default control mode to velocity mode instead of position control. This change is also not required for the fix.
    ControlMode control_mode_{ControlMode::Velocity};

Alternatively, you can set the default mode velocity control in line 93 of on_init method:

  enable_torque(false);
93  set_control_mode(ControlMode::Velocity, true);
  enable_torque(true);

I also ran into issues related to dynamixel speed not working correctly but those issues were fixed by tuning the diff_drive_controller config file parameters and had nothing to do with hardware interface code.

Thanks again for such a quick response and hope this helps someone else.

from dynamixel_hardware.

youtalk avatar youtalk commented on August 25, 2024

Nice report. Thank you!

from dynamixel_hardware.

Related Issues (20)

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.