ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROSDeveloper1996's profile - activity

2020-11-19 06:17:44 -0500 received badge  Nice Question (source)
2020-03-15 11:40:58 -0500 received badge  Student (source)
2020-03-15 11:40:35 -0500 received badge  Famous Question (source)
2019-11-08 14:23:25 -0500 received badge  Notable Question (source)
2019-11-05 09:00:43 -0500 received badge  Popular Question (source)
2019-11-05 00:41:16 -0500 marked best answer How to move a ur3 robot arm by using actions?

Dear community,

  1. I'm absolutely new to ROS, so please excuse my technically perhaps not always quite correct expressions.
  2. I'm running ROS Kinetic on Ubuntu 16.04 LTS and cloned the "universal robot" package from the following GitHub repository: (https://github.com/ros-industrial/uni...)
  3. After "building" my Catkin workspace by typing catkin_make everything worked fine so far and I could successfully launch a simulation of an ur3 robot in Gazebo by typing roslaunch ur_gazebo ur3.launch into a new terminal.
  4. What i wanted to do now, was to control the total of six joints of the ur3 without using MoveIt. So i did some research and found the following Link: Moving the arm using the Joint Trajectory Action So basically I wanted to try to control the ur3 in the Gazebo simulation via an action client. Since the description in the link above did not exactly fit to my robot, I tried to adapt the simple_trajectory.cpp file written there to the ur3 robot.

My "adapted" code file (without the included headers) now looks like shown below.

(The libraries I included by writing #include are the following: <ros/ros.h>; <control_msgs/FollowJointTrajectoryAction.h> and <actionlib/client/simple_action_client.h)


typedef actionlib::SimpleActionClient <control_msgs::FollowJointTrajectoryAction> TrajClient;

class Ur3Arm
{
    private:
        // Action client for the follow joint trajectory action used to trigger the arm movement action
        TrajClient* traj_client_;

    public:
        // Initialize the action client and wait for action server to come up.
        Ur3Arm()
        {
            // Tell the action client that we want to spin a thread by default:
            traj_client_ = new TrajClient("arm_controller/follow_joint_trajectory_action", true);

            // Wait for the action server to come up
            while(!traj_client_->waitForServer(ros::Duration(5.0))) 
            {
                ROS_INFO("Wait for the follow_joint_trajectory_action server");
            }
        }

        // Clean up the action client
        // -> Destructor of class Ur3Arm

        ~Ur3Arm()
        {
            delete traj_client_;
        }

        // Send the command to start a given trajectory

        void startTrajectory(control_msgs::FollowJointTrajectoryGoal goal)
        {
            // When to start the trajectory: 1s from now
            goal.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
            traj_client_->sendGoal(goal);
        }

        // Generates a simple trajectory with two waypoints, used as an example
        /* Note that this trajectory contains two waypoints, joined together as a single trajectory.
           Alternatively, each of these waypoints could be in its own trajectory - a trajectory can have one
           or more waypoints depending on the desired application.
        */

        control_msgs::FollowJointTrajectoryGoal armExtensionTrajectory()
        {
            // The goal variable:
            control_msgs::FollowJointTrajectoryGoal goal;

            // First, the joint names, which apply to all waypoints
            goal.trajectory.joint_names.resize(1);
            goal.trajectory.joint_names.push_back("shoulder_pan_joint");
            goal.trajectory.joint_names.push_back("shoulder_lift_joint");
            goal.trajectory.joint_names.push_back("elbow_joint");
            goal.trajectory.joint_names.push_back("wrist_1_joint");
            goal.trajectory.joint_names.push_back("wrist_2_joint");
            goal.trajectory.joint_names.push_back("wrist_3_joint");

            // In this simple case there asre only two waypoints in this goal trajectory
            goal.trajectory.points.resize(2);

            // First trajectory waypoint

                        int ind = 0; // Represents the number of the actual waypoint

                        // Positions:

                        goal.trajectory.points[ind].positions.resize(6);
                        goal.trajectory.points[ind].positions[0] = 0.0;
                        goal.trajectory.points[ind].positions[1] = 0.0;
                        goal.trajectory.points[ind].positions[2] = 0.0;
                        goal.trajectory.points[ind].positions[3] = 0.0;
                        goal.trajectory.points ...
(more)
2019-11-05 00:41:16 -0500 received badge  Scholar (source)
2019-11-05 00:41:04 -0500 received badge  Supporter (source)
2019-11-05 00:40:33 -0500 answered a question How to move a ur3 robot arm by using actions?

Hi jschornak, First of all thank you very much for your quick help! You made me understand the whole thing a little bit

2019-11-05 00:40:33 -0500 received badge  Rapid Responder (source)
2019-11-04 08:09:52 -0500 asked a question How to move a ur3 robot arm by using actions?

How to move a ur3 robot arm by using actions? Dear community, I'm absolutely new to ROS, so please excuse my technical