Lab 5: Introduction to Arm Kinematics in Simulation - GIXLabs/TECHIN516 GitHub Wiki
1. Intro to Kinova Gen 3 Lite
For the second half of this class we will use Kinova robotic arms. The lab has 3 gen3 lite 6-degrees-of-freedom (dof) arms, and 1 gen3 research 7-dof arm with a stereo camera. All of the packages you will need are listed in the kinova_ws
directory of this repo. It is generally best practice to maintain different workspaces for different platforms to isolate issues and reduce dependency conflicts. Independent workspaces can still communicate by sharing the same ROS_DOMAIN_ID
and by routing node discovery through the same fastdds discovery server.
-
Install the new packages by navigating to the
kinova_ws
directory and running:./install_kinova_dependencies.sh
-
To source this new workspace in new terminals, change the
source
command in your.bashrc
from the oldturtlebot_ws
to thiskinova_ws
, then re-source your.bashrc
. -
Launch a simulation environment with the Kinova gen3 lite robot using:
ros2 launch kortex_bringup kortex_sim_control.launch.py \ robot_type:=gen3_lite \ robot_name:=gen3_lite \ dof:=6 \ gripper:=gen3_lite_2f \ launch_rviz:=false
Deliverable 1.1: Which ros2 packages were installed using install_kinova_dependencies.sh
?
2. MoveIt
Many robot manufacturers have programmed proprietary functions for controlling their robots. Many of them have also integrated with open source controllers like MoveIt which is the most popular package for motion planning, collision checking, inverse kinematics, path execution, and manipulation. We will use MoveIt to control the Kinova arms because it integrates better with the ROS ecosystem and generalizes to other platforms you might use one day. All MoveIt packages and dependencies should have been installed with the script you ran above. If you ever build your own robot you can use this package to avoid reinventing the wheel. Check out their official documentation to learn more:
https://moveit.picknik.ai/humble/index.html#
-
Launch MoveIt for the gen3 lite using:
ros2 launch kinova_gen3_lite_moveit_config sim.launch.py
3. Task Space Movement
There are two ways of controlling a robot arm: "inverse kinematics" and "forward kinematics". Inverse kinematics allows you the programmer to dictate where the arm's "end-effector" (whatever tool it holds) should be, using a point and a direction. Given a goal, the robot uses a motion planning solver to figure out how to reach that position (similar to how the turtlebot uses a solver to navigate the map). These positions must be within the "task space" of the robot - the physical area within its reach. The MoveIt library allows for generalized motion planning given constraints of the robot, the end-effector, and the environment.
Using the launch files above, you should see a set of markers around the robot's gripper end-effector in Rviz. Use these markers to change the position and orientation of the arm to a new position. The orange version of the arm represents the new proposed position. Use the "Plan" and "Execute" buttons in the motion planning panel to move the simulated robot in Gazebo.
Some useful tools to track the robot's motions are:
Check the values of the joints:
ros2 topic echo /joint_states
Output the pose of the robot's end-effector with respect to the world frame
ros2 run tf2_ros tf2_echo world end_effector_link
Output the pose of the robot's end-effector with respect to the base frame
ros2 run tf2_ros tf2_echo base_link end_effector_link
Deliverables
3.1: Add a TF component in RViz and enable only the base_link and the end_effector_link. Disable the Motion Planning component to temporarily remove the interactive markers. Add a screenshot of the RViZ view.
3.2: Use rqt to determine the kinematic chain between the two reference frames (base_link and end_effector_link).
3.3: Turn on the Motion Planning component again. Move the robot to a new position. Include a screenshot of the robot in the new position in Gazebo.
4. Configuration Space Movement
Forward kinematics requires that you set the position of each individual joint in order to reach a desired configuration. This can be desirable in order to make isolated movements and to maintain control over the arm as inverse kinematic solvers can sometimes be unpredictable. Forward kinematic motions can be plotted within a "configuration space" where the position of each joint represents a value on an independent axis. Since the gen3_lite is a 6-dof robot, this is hard for us to visualize.
In the MotionPlanning panel, find the "Joints" tab. You will be able to change the values of the different joint angles. Explore the configuration space, determine which joints move in which direction when a positive or a negative angle is given to each joint.
Deliverables
4.1: Configure the joint angles and move to your desired position. Add a screenshot of the rviz window (including joint values and the robot visualization), use the same tools described in the previous subsection to explore the values for the pose and the joint angles.
4.2: Explain the differences you observed when controlling the robot's position using either the interactive markers or the joint angles.