I published the /joint_command with prismatic_x_joint velocity change
but /joint_states velocity elements remain as 0.0.
(position change control works but velocity change control does not work)
#!/usr/bin/env python
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import rospy
from sensor_msgs.msg import JointState
import numpy as np
import time
rospy.init_node("test_rosbridge", anonymous=True)
pub = rospy.Publisher("/joint_command", JointState, queue_size=10)
joint_state = JointState()
joint_state.name = [
"dummy_base_prismatic_x_joint",
"dummy_base_prismatic_y_joint",
"dummy_base_revolute_z_joint",
"iiwa_joint_1",
"iiwa_joint_2",
"iiwa_joint_3",
"iiwa_joint_4",
"iiwa_joint_5",
"iiwa_joint_6",
"iiwa_joint_7",
]
num_joints = len(joint_state.name)
# Initialize velocities for each joint
joint_state.velocity = [0.0] * num_joints
# Control the velocity of prismatic_joint_x
prismatic_x_index = joint_state.name.index("dummy_base_prismatic_x_joint")
# Set the desired velocity for prismatic_joint_x
desired_velocity = 0.2 # Adjust the desired velocity as needed
# position control the robot to wiggle around each joint
time_start = time.time()
rate = rospy.Rate(20)
while not rospy.is_shutdown():
# Control prismatic_joint_x velocity
joint_state.velocity[prismatic_x_index] = desired_velocity
print(joint_state.velocity)
pub.publish(joint_state)
rate.sleep()
(c.f. action graph)