How can I use connect to the ur5_e in c++

asked 2018-12-18 09:12:54 -0600

Jenna gravatar image

updated 2018-12-18 13:50:55 -0600

jayess gravatar image

HI. This is my first question. I'm new to ROS and a little poor in English. I will describe my question as clearly as I can. Forgive me if I make some mistakes and don't feel uncomfortable to tell me. Thx.

I'm having problems in controlling the real ur5_e with c++. I used the code in the tutorial. I've already changed the link names and it works well in rviz when it is not connected to a real robot.(i.e. It performs as I defined in the code every time I press next)

However, when I connect it to a real ur5_e robot and open rviz, it starts to show two models. One is laying down(I think every joint of it is 0 ,which is defined in urdf.). The other one is the same with the real robot. But the one is laying down doesn't show often. It only appears suddenly and then disappear soon. And when I press next, the laying down one performs , as I defined, and the other one stays. The real robot doesn't move at all.

I think this issue appears because I opened two models somewhere on my own. I know one is in my code and I think the other one is in the terminal. So I searched methods of connecting ur5_e in c++ and I found this. But I still don't know how to fix my code because I can't understand this code. I just know it connects the robot in c++. So I really need some help here. I don't know am I right about my problem and I don't know how to fix it.

I use ubuntu 16.04. ROS is kineitc version.

I use those to start:

$ roslaunch ur_modern_driver ur5e_bringup.launch robot_ip:=192.168.1.129 

$ roslaunch ur5_e move_demo.launch

what move_demo.launch looks like:

<launch>

    <arg name="debug" default="false"/>
    <arg unless="$(arg debug)" name="launch_prefix" value=""/>
    <arg    if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args"/>
    <arg name="limited" default="false"/>

  <include file="$(find ur5_e_moveit_config)/launch/ur5_e_moveit_planning_execution.launch">
       <param name="limited" value="true" />
  </include>

    <include file="$(find ur5_e_moveit_config)/launch/planning_context.launch">
        <arg name="load_robot_description" value="true"/>
        <arg name="limited" value="$(arg limited)"/>
    </include>

    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">    
        <param name="/use_gui" value="true" />
    </node>

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen"/>

    <include file="$(find ur5_e_moveit_config)/launch/moveit_rviz.launch">
        <arg name="config" value="true"/>
    </include>

    <node name="move_demo" pkg="ur5_e" type="move_demo" respawn="false" launch-prefix="$(arg launch_prefix)" output="screen">

    <rosparam command="load" file="$(find ur5_e_moveit_config)/config/kinematics.yaml"/>
    <param name="/planning_plugin" value="ompl_interface/OMPLPlanner"/>

    <rosparam command="load" file="$(find ur5_e_moveit_config)/config/ompl_planning.yaml"/>
    </node>

</launch>
edit retag flag offensive close merge delete