Robotic arms have revolutionized industries such as manufacturing, logistics, and healthcare, offering increased efficiency, precision, and automation. The uArm Swift Pro robotic arm, in combination with the Brainy Pi platform, provides a powerful solution for entrepreneurs looking to develop their own robotic arm applications. In this blog, we will provide a step-by-step guide on how to get started with the uArm Swift Pro robotic arm using the Brainy Pi platform, from installing dependencies to coding advanced features.
Pre-requisites
-
BrainyPi with power supply
-
uArm Swift Pro with power supply
-
Micro USB cable
Step 1: Installing Dependencies
The first step in developing robotic arm solutions with Brainy Pi is to install the necessary dependencies. The uArm-Python-SDK is a Python library that provides an interface for controlling the uArm Swift Pro robotic arm. Here’s how you can install it:
-
Open a terminal window on Brainy Pi.
-
Install the kernel modules
sudo apt install linux-modules-$(uname -r)
This command will install all the kernel modules required for the operation of Robotic Arm
-
Use the commands below to install the uArm-Python-SDK:
git clone https://github.com/uArm-Developer/uArm-Python-SDK.git
cd uArm-Python-SDK
python3 setup.py install
-
Wait for the installation to complete. Once installed, you can import the uArm module in your Python scripts to interact with the robotic arm.
Step 2: Connecting the Robotic Arm
In order to communicate with the uArm Swift Pro robotic arm, you need to insert the cdc-acm kernel module using modprobe. Follow these steps:
-
Connect the uArm Swift Pro robotic arm to your development machine using a micro USB cable.
-
Open a terminal window and run the following command
sudo ls -l /dev/ttyA*
-
If the command output shows /dev/ttyACM0
, then the uArm Swift Pro robotic arm is recognized as a serial device, and you can proceed with coding the arm’s movements.
-
If the command does not show up then, try with another micro USB cable.
Step 3: Coding the Arm’s Movement
Now that you have installed the necessary dependencies and inserted the cdc-acm kernel module, you can start coding the movements of the uArm Swift Pro robotic arm using the uArm-Python-SDK. Here’s an example code snippet that moves the arm to a specific location:
from uarm.wrapper import SwiftAPI
# Connect to the uArm Swift Pro robotic arm
swift = SwiftAPI()
# Move the arm to a specific location
swift.set_position(200, 200, 200)
In this example, we import the SwiftAPI
module from the uArm-Python-SDK
and create an instance of the SwiftAPI
class to communicate with the robotic arm. We then use the set_position()
method to specify the x, y, and z coordinates of the arm’s target location. You can customize these coordinates to move the arm to the desired position.
Step 4: Coding Advanced Features
The uArm Swift Pro robotic arm offers a range of advanced features that can be programmed using the uArm-Python-SDK. Here are some examples:
Suction Control:
You can control the suction cup of the uArm Swift Pro robotic arm to pick up and release objects. Here’s an example code snippet:
# Turn on the suction
swift.set_pump(on=True)
# Turn off the suction
swift.set_pump(on=False)
Gripper Control:
You can control the gripper of the uArm Swift Pro robotic arm to open and close. Here’s an example code snippet:
# Open the gripper
swift.set_gripper(0)
# Close the gripper
swift.set_gripper(1)
Servo Control:
You can control the servos of the uArm Swift Pro robotic arm to set custom angles for each joint, allowing for more precise control over the arm’s movements. Here’s an example code snippet:
# Set custom angles for each joint
swift.set_servo_angle(0, 90) # Set angle of joint 0 to 90 degrees
swift.set_servo_angle(1, 45) # Set angle of joint 1 to 45 degrees
swift.set_servo_angle(2, 0) # Set angle of joint 2 to 0 degrees
Speed Control
You can control the speed of the uArm Swift Pro robotic arm to adjust the arm’s movements. Here’s an example code snippet:
# Set speed of the arm's movements
swift.set_position(x=250, y=0, z=25, speed=100000,wait = True)
These are just a few examples of the advanced features that can be programmed using the uArm-Python-SDK. You can explore the full documentation of the SDK to learn more about other features and their usage.
Step 5: Application: Pick and place robot
Let’s apply what we have learnt to program the robotic arm to pick and place objects.
Running the application
git clone https://github.com/brainypi/brainypi-robotic-arm-example.git
cd brainypi-robotic-arm-example
python3 pick-and-place-example.py
Conclusion:
The uArm Swift Pro robotic arm, in combination with the BrainyPi platform, provides an excellent solution for entrepreneurs interested in developing robotic arm solutions. By following the steps outlined in this blog, you can get started with installing dependencies, and coding the arm’s movements using the uArm-Python-SDK. Additionally, you can leverage the advanced features of the arm, such as suction control, gripper control, servo control, and speed control, to build more complex and sophisticated applications. With its versatility and ease of use, the uArm Swift Pro robotic arm offers immense potential for entrepreneurs to develop innovative robotic arm solutions using the BrainyPi platform. Happy coding!