rbonghi / roboteq_control

⚙️ Driver for Roboteq devices using ros_control
MIT License
41 stars 12 forks source link

Emergency Stop #16

Closed enco77 closed 2 years ago

enco77 commented 2 years ago

whenever publishing false or true to '/roboteq/emergency stop' topic emergency stop turns on rostopic pub /roboteq/emergency_stop std_msgs/Bool "data: false" -r 10 Publishing like @thingsjimenez said code:

void Roboteq::stop_Callback(const std_msgs::Bool::ConstPtr& msg)
{
    // Wait end motor loop
    while(motor_loop_);
    // Read status message
    bool status = (bool)msg.get()->data;
    if(status)
    {
        // Send emergency stop
        mSerial->command("EX");
        ROS_WARN_STREAM("Emergency stop");
    } else
    {
        // Safety release
        mSerial->command("MG");
        ROS_WARN_STREAM("Safety release");
    }
}`

emergency stop don't release

sjimenez44 commented 2 years ago

@enco77 The problem with this rostopic pub /roboteq/emergency_stop std_msgs/Bool "data: false" -r 10. Because when you release the command in the terminal you only send the same flag, you need to send the command to continue controlling the motors.

enco77 commented 2 years ago

@enco77 The problem with this rostopic pub /roboteq/emergency_stop std_msgs/Bool "data: false" -r 10. Because when you release the command in the terminal you only send the same flag, you need to send the command to continue controlling the motors.

I don't clearly understand you. Did you mean velocity commands? I control motors usingrosrun teleop_twist_keyboard teleop_twist_keyboard.py

But nothing is happen after emergency stop

enco77 commented 2 years ago

maybe it's a bug

void Roboteq::stop_Callback(const std_msgs::Bool::ConstPtr& msg)
{
    // Wait end motor loop
    //while(motor_loop_);
    // Read status message
    bool status = (bool)msg.get()->data;
    if(status)
    {
        // Send emergency stop
        mSerial->command("EX");
        ROS_WARN_STREAM("Emergency stop");
    } else
    {
        // Safety release
        mSerial->command("MG");
        ROS_WARN_STREAM("Safety release");
    }
}`

after commenting while(motor_loop_); it's work