tutorials/pick_and_place/Scripts_Part4/RealSimPickAndPlace.cs
/// <summary>
///     Execute trajectories from RobotMoveActionGoal topic.
/// 
///     Execution will iterate through every robot pose in the trajectory pose 
///     array while updating the joint values on the simulated robot.
/// 
/// </summary>
/// <param name="trajectories"> The array of poses for the robot to execute</param>
Execute trajectories from RobotMoveActionGoal topic.

Execution will iterate through every robot pose in the trajectory pose
array while updating the joint values on the simulated robot.
Execute trajectories from RobotMoveActionGoal topic . Execution will iterate through every robot pose in the trajectory pose array while updating the joint values on the simulated robot .
private IEnumerator ExecuteTrajectories(RobotTrajectoryMsg trajectories)
    {
        foreach (var point in trajectories.joint_trajectory.points)
        {
            var jointPositions = point.positions;
            float[] result = jointPositions.Select(r => (float)r * Mathf.Rad2Deg).ToArray();
            for (int joint = 0; joint < jointArticulationBodies.Length; joint++)
            {
                var joint1XDrive = jointArticulationBodies[joint].xDrive;
                joint1XDrive.target = result[joint];
                jointArticulationBodies[joint].xDrive = joint1XDrive;
            }
            yield return new WaitForSeconds(JOINT_ASSIGNMENT_WAIT);
        }
    }
private IEnumerator ExecuteTrajectories ( RobotTrajectoryMsg trajectories ) { foreach ( var point in trajectories . joint_trajectory . points ) { var jointPositions = point . positions ; float [ ] result = jointPositions . Select ( r => ( float ) r * Mathf . Rad2Deg ) . ToArray ( ) ; for ( int joint = 0 ; joint < jointArticulationBodies . Length ; joint ++ ) { var joint1XDrive = jointArticulationBodies [ joint ] . xDrive ; joint1XDrive . target = result [ joint ] ; jointArticulationBodies [ joint ] . xDrive = joint1XDrive ; } yield return new WaitForSeconds ( JOINT_ASSIGNMENT_WAIT ) ; } }
Execute trajectories from RobotMoveActionGoal topic.
Execute trajectories from RobotMoveActionGoal topic .
// For every robot pose in trajectory plan // Set the joint values for every joint // Wait for robot to achieve pose for all joint assignments
trajectories
RobotTrajectoryMsg
The array of poses for the robot to execute
The array of poses for the robot to execute