Main Content
Move the Robot Using ROS topic
Execute the following set of commands to control the robot using the topic interface. Using this interface, you can command the robot to move to desired joint configuration. However, there is no control over the intermediate path the robot takes from the current position to the desired configuration because the desired velocity and acceleration is set to zero.
[trajPub,trajCmd] = rospublisher('/pos_joint_traj_controller/command'); jointWaypoints = [90 -90 90 0 90 90]'*pi/180; jointWaypointTimes = 5; trajCmd.JointNames = {'elbow_joint','shoulder_lift_joint','shoulder_pan_joint','wrist_1_joint','wrist_2_joint','wrist_3_joint'}; trajCmd.Points = rosmessage('trajectory_msgs/JointTrajectoryPoint'); trajCmd.Points.TimeFromStart = rosduration(jointWaypointTimes); trajCmd.Points.Positions = jointWaypoints; trajCmd.Points.Velocities = zeros(size(jointWaypoints)); trajCmd.Points.Accelerations = zeros(size(jointWaypoints)); trajCmd.Points.Effort = zeros(size(jointWaypoints));