Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with MoveIt! Realtime Arm Servoing when using from a clean install. Patch proposed to fix the problem. #1

Open
ETS-J-Boutin opened this issue Nov 7, 2024 · 0 comments

Comments

@ETS-J-Boutin
Copy link
Collaborator

I did a clean install on a new laptop and encountered a behavior that did not occur on my old laptop, which I used for most of my project work. When all the scripts from the example are activated, MoveIt! sends a command of zeros between all the desired commands from Unity. This results in jerky movements, which are not intended with this method.

To patch this problem, I added a script to filter the zeros from MoveIt!, so it only sends the final command to stop the robot when multiple zeros in a row are detected, which happens when MoveIt! receives a zero as input. The script made look like this and you'll have to make it executable:

#!/usr/bin/env python3

import rospy
import numpy as np
from std_msgs.msg import Float64MultiArray

'''
This script is a patch script used with the doosan as
the Moveit! servo publishes zeros between desired command.
'''

# Global publisher to create once
pub = rospy.Publisher('/dsr_joint_velocity_controller/command', Float64MultiArray, queue_size=1)

counter = 0

def callback(msg):
    '''
    Receive the message from Moveit! and filter non-zero values unless its the last message
    '''
    global counter

    if np.count_nonzero(msg.data):
        pub.publish(msg)
        counter = 0
    else:
        counter = counter +1
        if counter >=5:
            pub.publish(msg)
            counter = 0

    rospy.loginfo(counter)

def patch_RT_command():
    '''
    Create the node to listen to Moveit! servo.
    '''

    rospy.init_node('moveit_rt_patch')
    rospy.Subscriber('/moveit/patch_command', Float64MultiArray, callback, queue_size=1)
    rospy.spin()

if __name__ == '__main__':
    try:
        patch_RT_command()
    except rospy.ROSInterruptException:
        pass

Additionally, you need to modify the vr_unity_ros_doosan/config/doosan_m1013_config.yaml file. On the line command_out_topic: /dsr_joint_velocity_controller/command, change the topic to /moveit/patch_command.

With this change, the robot rarely, if ever, jerks during movement. This resolves the unusual behavior from MoveIt!, although it is more of a patch than a complete fix for the issue.

@ETS-J-Boutin ETS-J-Boutin changed the title Issue with MoveIt! Realtime Arm Servoing when using from a clean install Issue with MoveIt! Realtime Arm Servoing when using from a clean install. Patch proposed to fix the problem. Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant