Skip to content

[Question]: Not able to control robot via publihing on command/joint_group #235

@vignesh-anand

Description

@vignesh-anand

Question

How do i precisely control joint positions via a publisher in ros2 humble

Robot Model

wx250s

Operating System

Ubuntu 22.04

ROS Version

ROS 2 Humble

Additional Info

vignesh@vignesh-OMEN:~$ ros2 topic list
/follower/commands/joint_group
/follower/commands/joint_single
/follower/commands/joint_trajectory
/follower/joint_states

I see these topics and I am trying to command joint positions at 30 Hz via a publisher that looks like this

self.arm_pub.publish_commands("arm", leader_joints[:-1])

class WidowXPublisher:
    def __init__(self, node: Node, topic_name: str, debug: bool = False) -> None:
        self.node = node
        self.debug = debug
        
        # Create QoS profile matching the subscriber
        qos = QoSProfile(
            reliability=QoSReliabilityPolicy.RELIABLE,
            durability=QoSDurabilityPolicy.VOLATILE,
            history=QoSHistoryPolicy.KEEP_LAST,
            depth=10
        )
        
        # Create the publisher using the provided node
        self.publisher = self.node.create_publisher(
            JointGroupCommand,
            topic_name,
            qos
        )
        
    def publish_commands(self, group_name: str, commands: np.ndarray) -> None:
        """
        Publish joint commands to the specified group
        
        Args:
            group_name: Name of the joint group to control
            commands: numpy array of joint commands
        """
        msg = JointGroupCommand()
        msg.name = group_name
        msg.cmd = commands.tolist()  # Convert numpy array to list for ROS message
        self.publisher.publish(msg)
        if self.debug:
            self.node.get_logger().info(f"Published {group_name} commands: {commands}")
        else:
            self.node.get_logger().debug(f"Published {group_name} commands: {commands}")

Either I get the very first pose being acted on and then everything else ignored or , nothing at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    manipulatorsIssues related to manipulatorsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions