-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the ws23-youbot-manipulation-ros2 wiki!
- Using Ubuntu: 22.04 (Jammy) and ROS2 Rolling as base. In this step you are going to setup a new workspace and install required dependencies to be able to simulate the youBot and move it using joint state publisher GUI.
apt update
apt install gedit python3-pip ros-rolling-twist-mux ros-rolling-moveit ros-rolling-urg-node
apt install ros-rolling-ros2-control ros-rolling-joint-state-publisher-gui
pip install setuptools==58.2.0
mkdir -p /home/mir/src && cd /home/mir/src
git clone -b rolling https://github.com/b-it-bots/mas_industrial_robotics
git clone -b ros2 https://github.com/mas-group/brics_actuator.git
git clone -b rolling-devel https://github.com/mas-group/youbot_description.git
git clone -b foxy-devel https://github.com/mas-group/youbot_driver.git
git clone -b foxy-devel https://github.com/mas-group/youbot_driver_ros_interface.git
git clone -b b-it-bots https://github.com/b-it-bots/orocos_kinematics_dynamics.git
. /opt/ros/rolling/setup.sh
cd /home/mir
colcon build --executor sequential --parallel-workers 4
export ROBOT=youbot-brsu-2
source install/local_setup.bash
ros2 launch mir_bringup view_youbot.launch.py
source /opt/ros/rolling/setup.sh
source /home/mir/install/local_setup.bash
rviz2
- Workspace setup is completed, you should be able to see the youBot model now and control it with joint state publisher GUI
- In this step, you are installing the customized package for youBot manipulation and configuring your system in a way that makes you able to control the real robot's arm using this customized package.
git clone https://github.com/HBRS-SDP/ws23-youbot-manipulation-ros2.git
- Build source files:
colcon build --packages-select mir_youbot_manipulation
- Source your local setup:
source install/local_setup.bash
- For every new build, run below command:
sudo setcap cap_net_raw+ep install/mir_youbot_manipulation/lib/mir_youbot_manipulation/youbot_manipulation
- There are two options:
- Connect the ethernet cable directly to the base
- Connect the ethernet cable to youBot's arm
- Get your ethernet interface name
ip a
- Navigate to below directory:
cd ./home/mir/install/youbot_driver/share/youbot_driver/config/
- Interface name from
ip a
should match the content ofyoubot-ethercat.cfg
file, otherwise, edit the config file and change the name. - Edit manipulator config file to set the joint ids
gedit youbot-manipulator.cfg
- Modify
youbot_manipulator.cfg
according to:- If ethernet cable is connected directly to the base controller, joint ids should start from 5 to 9
- If ethernet cable is connected to the arm, joint ids should start from 1 to 5
gedit /etc/ld.so.conf.d/ros.conf
- Create a new file with this name if doesn't exist.
- Add below lines to the file
/opt/ros/rolling/lib
/opt/ros/rolling/lib/x86_64-linux-gnu
~your_workspace_path~/install/mir_interfaces/lib
~your_workspace_path~/install/brics_actuator/lib
- Execute this command:
sudo ldconfig
sudo apt install ros-rolling-kdl-parser
-
Navigate to mas_industrial_robotics/mir_interfaces/mir_manipulation
-
Create a new folder named
action
and open it. -
Create a file with name:
CartesianCoordinates.action
, with the contents as:
# Request
geometry_msgs/PoseStamped cartesian_coodinates
---
# Result
bool cartesian_pose_reached
---
# Feedback
string message
- Create a file with name:
MoveToJointAngles.action
, with the contents as:
# Request
brics_actuator/JointPositions joint_positions_setpoint
---
# Result
bool joint_postions_reached
---
# Feedback
string message
- Create a file with name:
MoveUsingJointVelocities.action
, with the contents as:
# Request
geometry_msgs/PoseStamped cartesian_pose
---
# Result
bool cartesian_pose_reached
---
# Feedback
string message
- Open the CMakeLists of mir_interface directory, add the below lines to the set(manipulation_msg_files) attribute:
"mir_manipulation/action/MoveToJointAngles.action"
"mir_manipulation/action/CartesianCoordinates.action"
"mir_manipulation/action/MoveUsingJointVelocities.action"
- Rebuild colcon with select package - mir_interfaces :
colcon build --packages-select mir_interfaces
In this step, you would be running the commands to use the customised package for various user stories.
- Open the cloned youbot workspace (1) with the installed packages and changes (2) and source ROS rolling in three terminals
- Make sure to be in
main
branch of the project. Usegit checkout main
- In first terminal, to run the customized package:
colcon build --packages-select mir_youbot_manipulation
source install/local_setup.bash
sudo setcap cap_net_raw+ep install/mir_youbot_manipulation/lib/mir_youbot_manipulation/youbot_manipulation
ros2 launch mir_youbot_manipulation mir_youbot_manipulation.launch.py
- In the second terminal, to run the ROS lifecycle node:
source install/local_setup.bash
ros2 run lifecycle_controller lifecycle_controller --ros-args -p lc_name:=youbot_manipulation_node
Once the lifecycle node is setup, user Shift+C
for CALIBRATION of the youBot arm.
After that use Shift+A
for activation of CONFIGURE node.
(the Lifecycle Controller waits for 10 seconds, for completion of calibration, otherwise node might exit, and re-run of the node is recommended)
- In the third terminal, to provide joint angles input (you change the input joint angle values in the 'value' section of the below command, is 2 examples for input being in radians or in degrees) using action server
MoveToJointAngles
:
source install/local_setup.bash
ros2 action send_goal /youbot_manipulation_node/joint_angles mir_interfaces/action/MoveToJointAngles '{ "joint_positions": { "positions": [
{ "joint_uri": "arm_joint_1", "unit":"rad", "value": 0.0 },
{ "joint_uri": "arm_joint_2", "unit":"rad", "value": 0.5 },
{ "joint_uri": "arm_joint_3", "unit":"rad", "value": 0.5 },
{ "joint_uri": "arm_joint_4", "unit":"rad", "value": 0.5 },
{ "joint_uri": "arm_joint_5", "unit":"rad", "value": 0.5 }
] } }'
ros2 action send_goal /youbot_manipulation_node/joint_angles mir_interfaces/action/MoveToJointAngles '{ "joint_positions": { "positions": [
{ "joint_uri": "arm_joint_1", "unit":"deg", "value": 10.0 },
{ "joint_uri": "arm_joint_2", "unit":"deg", "value": 10.0 },
{ "joint_uri": "arm_joint_3", "unit":"deg", "value": 10.0 },
{ "joint_uri": "arm_joint_4", "unit":"deg", "value": 10.0 },
{ "joint_uri": "arm_joint_5", "unit":"deg", "value": 10.0 }
] } }'
At this step, you should be able to see the youBot's arm movement to the desired joint angles.
- Open the cloned youbot workspace (1) with the installed packages and changes (2) and source ROS rolling in three terminals
- Make sure to be in
main
branch of the project. Usegit checkout main
- In first terminal, to run the customized package:
colcon build --packages-select mir_youbot_manipulation
source install/local_setup.bash
sudo setcap cap_net_raw+ep install/mir_youbot_manipulation/lib/mir_youbot_manipulation/youbot_manipulation
ros2 launch mir_youbot_manipulation mir_youbot_manipulation.launch.py
- In the second terminal, to run the ROS lifecycle node:
source install/local_setup.bash
ros2 run lifecycle_controller lifecycle_controller --ros-args -p lc_name:=youbot_manipulation_node
Once the lifecycle node is setup, user Shift+C
for CALIBRATION of the youBot arm.
After that use Shift+A
for activation of CONFIGURE node.
(the Lifecycle Controller waits for 10 seconds, for completion of calibration, otherwise node might exit, and re-run of the node is recommended)
- In the third terminal, to provide pose as input (you change the input pose and orientation values as shown in the below commands), using action server
MoveToCartesianPose
:
source install/local_setup.bash
ros2 action send_goal /youbot_manipulation_node/cartesian_pose mir_interfaces/action/MoveToCartesianPose "{cartesian_coordinates: {pose: {position: {x: 0.0, y: 0.0, z: 0.0}, orientation: {x: 0.0, y: 0.0, z: 0.0, w: 0.0}}}}"
ros2 action send_goal /youbot_manipulation_node/cartesian_pose mir_interfaces/action/MoveToCartesianPose "{cartesian_coordinates: {pose: {position: {x: 0.25732, y: 0.0849215, z: 0.2807}, orientation: {x: 0.845497, y: 0.187442, z: 0.495722, w: -0.0652631}}}}"
At this step, you should be able to see the youBot's arm movement to the desired cartesian pose.
- Open the cloned youbot workspace (1) with the installed packages and changes (2) and source ROS rolling in three terminals
- Make sure to be in
main
branch of the project. Usegit checkout main
- In first terminal, to run the customized package:
colcon build --packages-select mir_youbot_manipulation
source install/local_setup.bash
sudo setcap cap_net_raw+ep install/mir_youbot_manipulation/lib/mir_youbot_manipulation/youbot_manipulation
ros2 launch mir_youbot_manipulation mir_youbot_manipulation.launch.py
- In the second terminal, to run the ROS lifecycle node:
source install/local_setup.bash
ros2 run lifecycle_controller lifecycle_controller --ros-args -p lc_name:=youbot_manipulation_node
Once the lifecycle node is setup, user Shift+C
for CALIBRATION of the youBot arm.
After that use Shift+A
for activation of CONFIGURE node.
(the Lifecycle Controller waits for 10 seconds, for completion of calibration, otherwise node might exit, and re-run of the node is recommended)
- In the third terminal, provide cartesian pose using action server
MoveUsingJointVelocities
:
source install/local_setup.bash
ros2 action send_goal /youbot_manipulation_node/joint_velocities mir_interfaces/action/MoveUsingJointVelocities "{cartesian_pose: {pose: {position: {x: 0.309412, y: 0.100961, z: 0.15903}, orientation: {x: 0.939726, y: 0.200296, z: 0.274782, w: -0.0359243}}}}"
ros2 action send_goal /youbot_manipulation_node/joint_velocities mir_interfaces/action/MoveUsingJointVelocities "{cartesian_pose: {pose: {position: {x: 0.289579, y: 0.145087, z: 0.395511}, orientation: {x: 0.547089, y: 0.139695, z: 0.799678, w: -0.204191}}}}"
At this step, you should be able to see the youBot's arm movement to the desired cartesian pose using velocity control.