This repository features a simulation of a 3 Degrees of Freedom (DOF) robotic arm controller. The objective of the project is to simulate the control of a 3 DOF robotic arm, enabling it to reach a desired setpoint by regulating the joint velocities using Jacobian matrices.
- This simulation project uses the Robotics Toolbox for Python to modeland control a 3 DOF robot.
- Generating a robot model using the xacro urdf file.
- Visualized the robot model in RVIZ2.
- Controlling the robot's end-effector by computing joint velocities using the Jacobian.
- Controlling the robot's end-effector by Jacobian.
- The robot can be controlled in 3 modes:
- Control by specifying a target position
- Control using teleop_twist_keyboard
- Control by random target position selection
To run this project, ensure you have the following installed:
- ROS2 Humble (or your preferred ROS2 distribution)
- Colcon build system
- Python 3.8+
- Robotics Toolbox for Python
- RVIZ2
- geometry2 tf2_ros
- robot_state_publisher package
- teleop_twist_keyboard
Install & upgrade python3-pip.
sudo apt-get install python3-pip
python3 -m pip install --upgrade pip
pip3 install -U pip
Install Robotics Toolbox for Python using pip3.
pip3 install roboticstoolbox-python
For use Robotics Toolbox for Python have to use numpy < 1.25.0
pip3 install numpy==1.24.4
Clone this workspace in to your terminal.
git clone https://github.com/Toonzaza/Fun4_RoboticDev.git
Go to the project directory.
cd Fun4_RoboticDev
Build and source this project.
colcon build && source install/setup.bash
For finding robot workspace of RRR robot.
- Create the DH parameter of the RRR robot.
- limit of q1 q2 q3 and sample all possible data that q1 q2 q3 can go to that position.
- Use Loop for plot position to a graph.
You can try it by running the code. : work_space.py
cd Fun4_RoboticDev/src/RoboticsDev2024/scripts
code .
You can see position of target and position of end-effector in this picture.
Custom service
## Don't coppy this code. ##
Name : /set_mode
Request : mode --> Enter mode 1-3.
x --> Enter qx
y --> Enter qy
z --> Enter qz
Respond : state --> Show current status
- Inverse Pose Kinematics (IPK)
First you must run this command to open the launch file.
ros2 launch example_description fun.launch.py
For IPK you must open new terminal and enter mode: 1 and enter qx qy qz in x y z.
ros2 service call /set_mode fun4_interfaces/srv/Mode "mode: 1
x: 0.0
y: 0.05
z: 0.3"
If you find the answer in taskspace.
If answer not in taskspace.
- Teleoperation
If you want to play this mode you must open new terminal and run this command.
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Commanding /cmd_vel in Teleoperation mode can be commanded in 2 modes:
Reference End-effector
ros2 service call /set_mode fun4_interfaces/srv/Mode "mode: 2
x: 0.0
y: 0.0
z: 0.0"
Reference Base
ros2 service call /set_mode fun4_interfaces/srv/Mode "mode: 2
x: 1.0
y: 0.0
z: 0.0"
And if while ordering the robot It then detects that the robot is approaching the Singularity condition.
- Auto
If you want to play this mode you must run this command.
ros2 service call /set_mode fun4_interfaces/srv/Mode "mode: 3
x: 0.0
y: 0.0
z: 0.0"
If problems occur during use, you should exit and launch again.