Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Elephant Robotics
Published © GPL3+

Adjustable Controller Makes Robot Remote Control Flexible

Exoskeleton controller simplifies robot programming with an adjustable structure, making remote control of the cobot FR3 easy.

BeginnerFull instructions provided4 hours128

Things used in this project

Hand tools and fabrication machines

myController S570
Elephant Robotics myController S570

Story

Read more

Schematics

_20250110150547_kz26fPsj9T.png

Code

control_test.py

Python
#!/usr/bin/env python3

import rospy
from sensor_msgs.msg import JointState
import math
import time
import frrpc

# Define your parameters
acc = 0.01
vel = 0.01
t = 0.01
lookahead_time = 0.0
P = 0.0
eP1=[0.000,0.000,0.000,0.000]
dP1=[1.000,1.000,1.000,1.000,1.000,1.000]

# Initialize joint_angles_deg as a global variable
joint_angles_deg = [0.0] * 6

robot = frrpc.RPC('192.168.58.2')


def joint_state_callback(msg):
    global joint_angles_deg
    joint_angles_rad = msg.position[:6]
    
    # Convert angles from radians to degrees
    joint_angles_deg = [angle * (180.0 / math.pi) for angle in joint_angles_rad]
    
    # Modify specific joint angles as needed
    joint_angles_deg[0] = -16.11
    joint_angles_deg[4] = 90.0
    joint_angles_deg[5] = 90.0

# Initialize the ROS node
rospy.init_node('joint_state_listener', anonymous=True)

# Subscribe to the /joint_states topic
rospy.Subscriber('/joint_states', JointState, joint_state_callback)

# Assuming robot is initialized and available in your system
# Example: robot = RobotController()

while not rospy.is_shutdown():
    # Update the joint angles whenever new data is received
    if joint_angles_deg:  # Check if joint_angles_deg has been updated

        if(joint_angles_deg[0]!=0.0):
            
            joint_angles_deg = [float(angle) for angle in joint_angles_deg]

            joint_c = robot.GetForwardKin(joint_angles_deg)
            joint_c = [joint_c[1],joint_c[2],joint_c[3],joint_c[4],joint_c[5],joint_c[6]]

            ret = robot.RobotEnable(1)
            ret = robot.MoveJ(joint_angles_deg,joint_c,1,0,250.0,200.0,100.0,eP1,-1.0,0,dP1) 


            print("Updated Joint Angles (Degrees):")
            for i, angle in enumerate(joint_angles_deg):
                print(f"Joint {i+1}: {angle:.2f} degrees")
                
            for i, angle in enumerate(joint_c):
                print(f"L{i+1}: {angle:.2f} degrees")
        
        time.sleep(0.02)

Credits

Elephant Robotics
100 projects • 216 followers
An Innovative Robotics Company.
Contact

Comments

Please log in or sign up to comment.