Warning: Experimental code !!
This package is 3 components:
This ROS 2 package, tmotor_ros2, facilitates the control of a robot featuring a two-link robot arm. The package encompasses components for both joystick-based manual control and a computed torque controller.
A 2 DoF arm using this code is demonstrated in this video: https://youtu.be/Cbtk6y84C6I
- ROS2
- Python 3
- Numpy
- Mini-cheetah-tmotor-python-can
- Qt5
- Bitstring
- Pyro -- branch dev-proto-tmotor (optional for advanced control modes)
-
Ensure that ROS2 is installed on your system ROS 2 Installation Guide .
-
Create or go to YOUR-ROS-WORKSPACE.
-
Clone this repository into your ROS workspace.
git clone https://github.com/SherbyRobotics/tmotor_ros2.git
-
Build your ROS workspace.
cd YOUR-ROS-WORKSPACE colcon build
-
Source your project:
add to .bashrc
export PYTHONPATH=$PYTHONPATH:"""path-to"""/pyro source /opt/ros/ROSDISTRO/setup.bash source ~/YOUR-ROS-WORKSPACE/install/local_setup.bash
Use ip link show
to verify that the CAN interface is detected
To communicate with the motors, it is important to set up the CAN interface to 1M baudrate:
sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0
ros2 launch tmotor_ros2 start_basic_robot_controller.launch.py
ros2 launch tmotor_ros2 start_pyro_robot_controller.launch.py
Two arguments are available for both launch files:
joy_input
to select the input of the joy controllerinverted
to switch motor indexes
-
Description: This node takes care of the low level communication with both motors.
It reads the motor commands and sends them to the motors, and reads the feedback from the motor to send back to the controller.To communicate with the motors, this librairy is used: https://github.com/dfki-ric-underactuated-lab/mini-cheetah-tmotor-python-can .
-
Subscribed Topics:
/joints_cmd
: Controller command to send to motors.
-
Published Topics:
/joints_sensor
: Motor states feedback.
-
Description: This node is used to control the robot using openloop commands. Available control modes are torque, velocity or position.
-
Subscribed Topics:
/joints_sensor
: Motor states feedback./joy
: Remote input from user .
-
Published Topics:
/joints_cmd
: Controller command to send to motors.
-
Description: This node is used to control the robot using the pyro twolink manipulator interface.
Available control modes are openloop torque, velocity and position, effector velocity and postion, gravity compensation, effector pd with gravity compensation, computed torque and trajectory following.
This node also shows an animation of the robot state in real time.
-
Subscribed Topics:
/joints_sensor
: Motor states feedback./joy
: Remote input from user .
-
Published Topics:
/joints_cmd
: Controller command to send to motors.