Universal_Robots_ROS2_Driver icon indicating copy to clipboard operation
Universal_Robots_ROS2_Driver copied to clipboard

Trying to do a moveL and moveJ simulated

Open marioesteban11 opened this issue 3 years ago • 15 comments

Hi everyone,

I'm trying to do a MoveL, MoveJ and MoveC simulated in rviz with Moveit and in Gazebo, but iḿ not able to do it.

I'm in: Ubuntu 22 Ros2 Humble Robot: Ur3e

In my c++ code I use the geometry PoseStamped to move my UR3e in severeal position, but my robot goes crazy, doing some loops before getting to the goal I try to publish.

Do you have any idea to do this moves with geometry pose or any other options?

Thanks in advance

marioesteban11 avatar Nov 07 '22 08:11 marioesteban11

@marioesteban11

Do you have any idea to do this moves with geometry pose or any other options?

Until you get a response from the package maintainers, let me point you to an alternative control approach. That's a controller that follows a geometry_msgs/PoseStamped. It's part of the cartesian_controllers suite. It will interpolate for you and command the robot with MoveJ down in the driver for the UR robots.

stefanscherzinger avatar Nov 07 '22 09:11 stefanscherzinger

Trying to clone your repository cartesian controllerss the terminal says:

´´´ Cloning into 'cartesian_controllers'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. ´´´

And I dont know if my github is wrongly configurated or i need any permision to clone it

marioesteban11 avatar Nov 07 '22 11:11 marioesteban11

@marioesteban11 did you manage to set your Tool orientation with

In my c++ code I use the geometry PoseStamped to move my UR3e in severeal position

LucaBross avatar Nov 07 '22 11:11 LucaBross

@marioesteban11 Please open further issues on cartesian_controllers on their issue tracker. Let's keep this discussion on the ROS2 UR driver.

stefanscherzinger avatar Nov 07 '22 11:11 stefanscherzinger

@LucaBross not really: ''' msg.orientation.w = 1.0; msg.orientation.x = 0; msg.orientation.y = 1; msg.orientation.z = 2; '''

when i try to run this, with this orientations or others my Ur3e doesn´t seem to move the orientation

marioesteban11 avatar Nov 07 '22 12:11 marioesteban11

@marioesteban11 i observed the same. I could change the orientation with

msg.orientation.w = 0;
msg.orientation.x = 1.0;

But i still couldn`t figure out how to set a defined position. In this post it looks like it is very complex to do that. I dont know why i cant just set the tool orientation with

msg.orientation.x = 0;
msg.orientation.y = 1;
msg.orientation.z = 2;

like you tried.

LucaBross avatar Nov 07 '22 13:11 LucaBross

@LucaBross I think that we cannot set the tool's orientation like that because, this PoseStamped message need quaternions to set the orientation. I try it, and orientation.x, y, z and w is a number between 0 and 1.

We can set a normal euler orientation in radians (between -pi and +pi) and then with:

''' tf2::Quaternion myQuaternion; myQuaternion.setRPY( 3.14, 0, 0 ); // Create this quaternion from roll/pitch/yaw (in radians) '''

and this function return this:

''' msg.orientation.x = myQuaternion.getX(); msg.orientation.y = myQuaternion.getY(); msg.orientation.z = myQuaternion.getZ(); msg.orientation.w = myQuaternion.getW(); '''

And the orientation is correctly set.

But, I keep with the problem that the robot sometimes gets crazy hehehe.

But that post was really good and help me a lot @LucaBross . Thanks.

I hope this comment helps you also

marioesteban11 avatar Nov 08 '22 09:11 marioesteban11

@marioesteban11 Thanks, now i may be able to figure out the right orientation for me.

I also have a lot of unnecessary movement if i use move_group.move();. I tried to fix this with using a cartesian path:

  std::vector<geometry_msgs::msg::Pose> waypoints;
  waypoints.push_back(start_pose2);

  geometry_msgs::msg::Pose target_pose3 = start_pose2;

  target_pose3.position.z += 0.2;
  waypoints.push_back(target_pose3);

  target_pose3.position.y -= 0.2;
  target_pose3.position.x -= 0.2;
  waypoints.push_back(target_pose3); 

  target_pose3.position.z -= 0.2; 
  waypoints.push_back(target_pose3);  

  moveit_msgs::msg::RobotTrajectory trajectory;
  const double jump_threshold = 0.0;
  const double eef_step = 0.01;
  double fraction = move_group.computeCartesianPath(waypoints, eef_step, jump_threshold, trajectory);
  // move_group.execute(trajectory);

LucaBross avatar Nov 08 '22 14:11 LucaBross

what are you trying to do with that code @LucaBross ? Are you trying to fix those crazy moves that sometimes happens?

marioesteban11 avatar Nov 11 '22 07:11 marioesteban11

Yes, but i observed, that still there is some crazy movement happening. Please let me know if you figure something out to fix it.

LucaBross avatar Nov 11 '22 07:11 LucaBross

Are you using ROS2 humble right @LucaBross. If its true can you tell me which includes are you using? Iḿ in trouble with this move_group.computeCartesianPath.

Can you give any reference to those move_group function pls?

marioesteban11 avatar Nov 11 '22 08:11 marioesteban11

I included this in my script:

#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>

#include <moveit_msgs/msg/display_robot_state.hpp>
#include <moveit_msgs/msg/display_trajectory.hpp>

#include <moveit_msgs/msg/attached_collision_object.hpp>
#include <moveit_msgs/msg/collision_object.hpp>

not sure which of them i need for the Cartesian Path.

LucaBross avatar Nov 11 '22 10:11 LucaBross

Yeah, I've just find it. I found the move_group. Now I'm trying to figure out how it works.

marioesteban11 avatar Nov 11 '22 10:11 marioesteban11

Hi @LucaBross, have you finished your move_group problem? I've been busy with other stuff, and I really could not resolve it yet, do you?

marioesteban11 avatar Nov 30 '22 08:11 marioesteban11

Hello @stefanscherzinger! I am using universal robot UR10e and ros2 drivers. Currently I am using scaled joint Trajectory controller and controlling the robot motion by coding the waypoints with joint positions. However, I would also like to be able to control the robot in cartesian cordinates (position, orientation sent to the end effector) as I am using vision in my application. Is this possible with the cartesian motion controller you mention?

Using UR's internal coding language on the teach pendant we can define linear movements (MoveL) and set offsets, I'd like to be abel to do the same via ros2, what would you suggest? I would also need to store different tools and be able to command the robot to switch between them (that is also switch the payload and TCP for different tools) from ros2 code. How can I do this?

Thanks

shrutichakraborty avatar Feb 13 '24 10:02 shrutichakraborty