This repo contains controllers and ROS code for connecting with the hardware on the robot arm.
First clone or copy this repository into your workspace src
.
$ cd /path/to/workspace/src
$ git clone https://github.uio.no/INF3480/crustcrawler_hardware.git
Then clone DynamixelSDK into src
$ cd /path/to/workspace/src
$ git clone --branch 3.7.0 https://github.com/ROBOTIS-GIT/DynamixelSDK.git
After installing the repository and dependencies (make sure all ROS dependencies have been resolved), build as usual.
# Or `catkin build`
$ catkin_make
Use the launch file control.launch
to run the necessary ROS nodes. The main
configurations for the launch file are control
and full_arm
. The first
selects the controller manager to utilize, available are [trajectory
,
position
, velocity
, effort
], and the later controls how many joints are
connected to the arm, full_arm:=true
when all joints are connected and
full_arm:=false
when the marker is connected.
After successful launch one has to enable the arm as torque is not enabled when the code is run.
The following will enable the arm (commands will now be executed) and torque is applied.
$ rostopic pub -1 /crustcrawler/enable std_msgs/Bool true
To disable torque run (be careful the arm will fall):
$ rostopic pub -1 /crustcrawler/enable std_msgs/Bool false
** Shutting down the node will also disable torque! **
To be a good ROS citizen this package uses ros_control
(and
ros_controllers
) for command controls. The respective controllers and
their capabilities are documented elsewhere, but for most users the
joint_trajectory_controller
should be the first place to look.
Useful for using the pen and MoveIt:
$ roslaunch crustcrawler_hardware control.launch full_arm:=false
control:=trajectory
Useful with the full arm and custom effort controls:
$ roslaunch crustcrawler_hardware control.launch full_arm:=true control:=effort
This will be especially relevant if you are making the 6DOF version.
These are all troubleshooting experiences when working on this hardware repo with Ubuntu 18.04, but will probably be applicable to other setups aswell.
Before you start doing anything, make sure all servos are protocol 2.0 (and not 1.0):
- Download R+ Manager 2.0
- Open it and go to
Update & Test
and check one and one of the servos. - If there is servos that are 1.0, connect them one at a time and update the firmware by going into
Firmware Recovery
, notUpdate & Test
! - Follow the steps and take in and out the 3 pin TTL connector from the servo when you'r asked to disconnect the servo.
Remember to update the Baudrate, ID and other settings (that you have changed) after the protocol update, because all these will be reset.
You are now set for connecting all servos together and try out the hardware.
When connecting to the fully assembled robot, you may get this usb error:
[PortHandlerLinux::SetupPort] Error opening serial port!
Then run:
sudo chown yourUserName /dev/ttyUSB0
Assuming your USB
is connected at ttyUSB0
.
Further, you may get this error:
[ INFO] [1532011582.824068948]: Crustcrawler hardware initialized
Error reading from servos, error: -3001
Error reading from servos, error: -3001
Error reading from servos, error: -3001
Error reading from servo: 4, error: -3001
Error reading from servo: 5, error: -3001
Error reading from servo: 6, error: -3001
which is a communication error.
The first fast thing to check is that the latency may be to high. Set it to 1 (it's originally 16) by running
echo 1 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
and then yo can see that
cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
gives you 1
. Also dmesg
can be useful to check the connection status of the USB
.
If none of this helps and the 3001
error still is making your head hurt, there is probably a bad connection or a faulty/broken wire somewhere.
- Check that all the wires male plugs are connected appropriatly.
- Open R+ Manager and go into Update & Test. Test the whole connection by having all servos connected. You should see an image like this:
if not, connect one and one (or two and two) servos and set correct
- ID
- Baudrate
- If all ID's and Baudrates are correct, and you are still not getting up the whole chain of all the servos (like over), try to disconnect one and one of the servos, starting with the last. Hopefully you will get a chain of at least two servos. Try to get as long a chain of connected servos as possible. In this way you can isolate the faulty cable.
Good luck!
Feel free to check out the documentation on MX-64 and MX-28 for any adresses, values and system requirements.