User Tools

Site Tools


hebi_arm_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
hebi_arm_tutorial [2020/10/15 15:56] leogeorgescuhebi_arm_tutorial [2020/11/20 05:16] (current) jkreitz
Line 2: Line 2:
 \\ \\
 **Author:** Leonardo Georgescu and Jason Kreitz\\ **Author:** Leonardo Georgescu and Jason Kreitz\\
-**Email:** [email protected]\\ +**Email:** georgl3@unlv.nevada.edu and kreitzj@unlv.nevada.edu\\ 
-**Date:** Last Edited 10/08/2020\\ +**Date:** Last Edited 11/20/2020\\ 
-**Keywords:** Hebi Arm+**Keywords:** Hebi Arm, IK, Python SDK, ROS 
 +\\
 \\ \\
 Hebi arm is a 6 DoF arm that has a gripper and is able to pick and place objects. The benefit of the arm is that it has series elastic actuators. It also has force-torque sensors which I will be discussing how they work later. \\ Hebi arm is a 6 DoF arm that has a gripper and is able to pick and place objects. The benefit of the arm is that it has series elastic actuators. It also has force-torque sensors which I will be discussing how they work later. \\
Line 64: Line 65:
 For the full Gazebo simulator please see this github repository: https://github.com/HebiRobotics/hebi_gazebo \\ For the full Gazebo simulator please see this github repository: https://github.com/HebiRobotics/hebi_gazebo \\
  
 +\\
 +\\
 +<fs x-large>**ROS Interface Tutorial**</fs>\\
 +\\
 +Arm Model:= A-2085-06\\
 +Home position:[0,1.69517,2.16275,2.44159,-1.39,1.57459]
 +\\
 +
 +Use the below bash script to install the ROS packages.
 +
 +
 +<code php>
 +sudo apt-get install ros-<ros-distro>-hebi-cpp-api
 +
 +mkdir -p ~/catkin_ws/src
 +cd ~/catkin_ws/src
 +git clone https://github.com/HebiRobotics/hebi_moveit_configs.git
 +git clone https://github.com/HebiRobotics/hebi_description.git
 +git clone https://github.com/HebiRobotics/hebi_cpp_api_ros_examples.git hebi_cpp_api_examples
 +cd ..
 +catkin_make
 +
 +</code>
 +
 +**__Warning: Make sure you have the power supply nearby in case you need to shut off the robot. If the IK seed is set improperly, the robot will move erratically. Just make sure you have it just in case – until you’re comfortable.__**\\
 +\\
 +\\
 +
 +<fs large>__**First Test: Run Premade Movements**__</fs>
 +\\
 +Open the file catkin_ws/src/hebi_cpp_api_examples/data/paths/6_dof_circle.txt and change “paths/circle” to “data/paths/circle”. Repeat for  data/waypoints/6_dof_home.txt, etc. (ie. data/waypoints/home, data/waypoints/pick…) for all other files within the waypoints folder.
 +\\
 +
 +Then, run the below script in order to start the Hebi Arm.
 +<code php>
 +roslaunch hebi_cpp_api_examples arm_teach_repeat_6_dof.launch 
 +</code>
 +
 +In order to make the arm move, run the below script in a terminal. Make sure that index and mode are on new lines.
 +<code php>
 +rostopic pub /playback hebi_cpp_api_examples/Playback "name: 'circle'
 +index: 0
 +mode: 2"
 +</code>
 +
 +Basically, the roslaunch will include the list of paths and waypoints from the txt files, and the arm_teach_repeat node will then load those paths and waypoints into named vectors. Those vectors can then be ran when you publish a “Playback” message (from  hebi_cpp_api_examples/Playback) on the   /playback topic. The name of the path should be ‘circle’ (ie from data/paths/circle), and the mode should be 2. You can find what the different modes are by looking at the Playback.msg file. For more information on how the node accomplishes this, read the arm_teach_repeat_node.cpp and  arm_teach_repeat_node.hpp files within the src/kits/arm directory.\\
 +\\
 +
 +<fs large>__**Second Test: Move Robot by Publishing on Topics**__</fs>\\
 +Run the following two scripts in separate terminals:
 +<code php>
 +rosrun hebi_cpp_api_examples arm_node 
 +rosservice call -- /set_ik_seed [0,1.69517,2.16275,2.44159,-1.39,1.57459]
 +</code>
 +
 +__**Topics that the arm listens to after running the above rosrun:**__ \\
 +\\
 +**1. /offset_target (geometry_msgs::Point) **
 +This topic will jog the end effector in the given cartesian direction relative to the base. \\
 +It requires a  geometry_msgs::Point message, then will “jog” (move a short relative distance)\\
 +The below three lines is one example terminal command (make sure that y and z are on separate newlines):
 +      
 +<code php>    
 +rostopic pub /offset_target geometry_msgs/Point "x: 0.1 
 +y: 0.1
 +z: 0.1"
 +</code>
 +
 +(I would recommend not moving more than 0.1 in any direction. The arm moves very fast, and moving it more than 0.1 in any direction will make it jump unsafely)\\
 +If you want to use the offset in an actual client node, just create a publisher to publish a Point message to this topic.\\
 +This mode would be useful for implementing the use of a game controller...\\
 +\\
 +              
 +**2. /cartesian_waypoints (hebi_cpp_api_examples::TargetWaypoint)** \\
 +Command the arm to move through a series of cartesian-space (relative to the base) waypoints \\
 +Allows us to specify an array/queue of geometry_msgs/Point messages, and then move along that trajectory.\\ 
 +You can publish an array of Point messages on the topic as the waypoints_vector.\\
 +The below lines are examples of terminal commands that we can use to publish on the topics.
 +
 +<code php>
 +rostopic pub /cartesian_waypoints hebi_cpp_api_examples/TargetWaypoints "waypoints_vector:
 +- x: 0.2
 +  y: 0.3
 +  z: 0.0" 
 +  
 +rostopic pub /cartesian_waypoints hebi_cpp_api_argetWaypoints "waypoints_vector:
 +- x: 0.2
 +  y: 0.3
 +  z: 0.2" 
 +  
 +rostopic pub /cartesian_waypoints hebi_cpp_api_examplesargetWaypoints "waypoints_vector:
 +- x: 0.2
 +  y: 0.3
 +  z: 0.4" 
 +</code>
 +
 +I'm personally not a big fan of this one. It doesn’t give the user control over the timing of queue execution. In addition, Point messages only allow for X, Y, Z movement – no end effector rotation. \\
 +In reality, the end effector just moves around without any user control, and there’s nothing that the user can really do about it…\\
 +\\
 +
 +**3. /joint_waypoints (trajectory_msgs::JointTrajectory)** \\
 +Command the arm to move through a series of joint-space waypoints \\
 +Same as the above, except with trajectory messages in joint space (joint thetas, instead of cartesian coordinates of the end effector).\\
 +This most likely will allow us to control the entire robot, including the end effector rotation (unlike the above), but it requires us to use our own IK solver if we want to use IK. I haven’t yet tested this one.\\
 +\\
 +\\
 +**4. /motion (action, hebi_cpp_api_examples::ArmMotion)** \\
 +Use a ROS action to move the robot to a given Cartesian location.\\
 +Uses the ROS ActionLib API to give control over the robot queuing system. For more information on using the ROS ActionLib API, take a look at my RB5 ROS Wrapper at https://github.com/astemeric/rb5-ros-wrapper. I have examples of Action Clients in the /example_clients folder. Actual implementation of the Action Client will be in the RB5_Client.h file in /src and the implementation of its Action Server will be in the wrapper.cpp file in /src.\\
 +\\
 +For some reason, their implementation is giving me errors. I have a simple test client that is passing the same parameters as cartesian_waypoints, but for some reason there are errors internal to the actual Hebi ROS node – and I’m not sure yet how to fix them. I’m giving the correct data structure to the messages, and I’m not receiving any compiler errors – it seems like the error is coming from the IK solver itself...
 +\\
 +
 +**In addition to the above, the current robot orientation information can be found by running the following in a terminal:**
 +<code php>
 +rostopic echo /joint_states 
 +</code>
 +
 +Comments: I’m not too sure what set_ik_seed actually does, but I think (after reading – I could definitely use some clarification onto how the IK solver works) that the IK solver uses some sort of gradient descent for local minimum, and the ik_seed is required in order to set the initial test value. I used the home position as seed, and it works very well – even though it’s joint positions and not Cartesian.
 +
 +Note/Warning: I gave the IK seed the following array, and it freaked out when I gave it a movement command: [0.01,1.0,2.5,1.5,-1.5,0.01]. 
 +I got this value from the following link: https://github.com/HebiRobotics/hebi-matlab-examples/blob/master/kits/arms/setupArm.m). So this means that the IK seed value is very important, and the robot WILL move erratically.\\
 +\\
 +
 +<fs large>__**Third Test: Open and Close Gripper**__</fs>\\
 +
 +Replace the following line in the file gripper_node.cpp in the src/kits/arm folder
 +<code php>
 +    [Line 80] if (!gains_cmd.readGains(ros::package::getPath(gains_package) + std::string("/") + gains_file))
 +</code>
 +
 +With the following lines of code:
 +<code php>
 +    std::string myTest = ros::package::getPath(gains_package) + std::string("/") + gains_file;
 +    std::vector<char> chars(myTest.begin(), myTest.end());
 +    chars.push_back('\0');
 +    char *c = &chars[0];
 +    if (!c)
 +</code>
 +
 +Then run the following line in one terminal to activate the gripper's subscribers:
 +<code php>
 +rosrun hebi_cpp_api_examples gripper_node 
 +</code>
 +
 +Afterwards, run the following line to close the gripper:
 +<code php>
 +rostopic pub /gripper_strength std_msgs/Float64 "data: 0.5" 
 +</code>
 +Note: You should be able to use any float between 0 and 1 for the above. Even if the gripper is closed, by turning up the effort value, you should be able to grip stronger... \\
 +\\
 +Or run the following line to open the gripper:
 +<code php>
 +rostopic pub /gripper_strength std_msgs/Float64 "data: 0.0" 
 +</code>
 +Again, we can write a node that publishes to these topics so that we can control the robot in our own client. 
hebi_arm_tutorial.1602802590.txt.gz · Last modified: 2020/10/15 15:56 by leogeorgescu