ROS 2 Driver for AR4 Now Available
Hi Annin Robotics Community,
I'm excited to share that I've recently developed and released a ROS 2 driver for the AR4 robot arm. It uses ros2_control framework for robot control, MoveIt 2 for motion planning, and Rviz2 for user interface and visualization. It's available to use at
https://github.com/ycheng517/ar4_ros_driver
and will be actively developed and maintained. Check it out if you wish to tap into the power of ROS 2 with the AR4, and contributions are welcome!
That looks awesome, I'm not familiar with ROS/ROS2, would this run on a light client like a Pi ?
Also, does your driver also control the nano/gripper ?
Pierre-Alexandre Girard Yes it should work on the raspberry pi, you'll have to install Ubuntu for Raspberry Pi. I'm not supporting the nano/gripper yet but will be working on that in the medium future
I wanted to mention that Yifei Cheng has added files for the MK2 to this repo. I have not had time to test yet but I was hoping someone in the comunity would be able to test this out on the MK2 and give feedback. I also wanted to thank Yifei for taking the time to put this together and contributing to the project. This is a great development - Thank you.
@jacob it would be great if you can test it!
Update: AR4 servo gripper control has been added!
Yifei Cheng I’ll be testing this out this weekend! Get ready for some pull requests with OpenCV/Camera functionality in the coming weeks too 🙂
Great work ! Thanks a lot. My AR4 is now ROS2 controlled. Calibration works, path planning and execution using MoveIt works well. I'm stuck with the hand-eye validation. Intel camera is detected and I see the video in MoveIt. Hand-eye calibration is ok, I took 6 samples, aruco tag is detected. When I try to run the hand-eye validation procedure, the aruco tag is detected but planning fails. with the following message: "unable to sample any valid states for goal tree" Any idea why ??
Yifei Cheng You rock ! I didn't catch that part in the instructions, sorry about that. The result is well better now. There are still a few things I'm trying to understand: 1) in validation mode, in general, the robot finds the marker successfully and moves accordingly but sometimes it targets the center of the marker and sometimes it targets the borders (and not always the same side) 2) results are not so good when the marker to find is placed at a lower position. For example: calibration has been performed at Z = approx 25 cm. During validation, the marker is placed at z = approx 10 cm, the robot finds it but goes to low and hit the marker.
Philippe For posterity, the calibration routine has been updated and now the validation routine should work no matter the camera angle
When using the driver I often have issues with path tolerance being violated, halting the robots movment and causing problems, this especially happens for joints 3 and 4, do you run into this problem? When the controllers.yaml file in ar_hardware_interface is updated it seems the new values are not used, and it continues to use a tolerance of .200.
Evan Wassmann hey I'm not sure why that's not being updated but another way of tackling the problem is to reduce the max_velocity of those joints in ar_moveit_config/config/joint_limits.yaml
Any chance this works with the AR-3?
My use of it has gone in fits and starts, and I'm back to it now. I never got ROS Melodic fully implemented, and now it's so old it's starting to lose compatibility with new equipment like the depth and tracking cameras I'm trying to use...
duanemclemore It should work with moderate effort. You just need to figure out the differences between AR3 and AR4, and update configs in both the Teensy sketch and the hardware interface. Then you should be able to run the AR3.
wow! that's great!
I'm looking for a URDF file (for MK3, a simple one, just with the joints and limitations) - I saw you have something xarco), but I didnt see any regular urdf. do you have something similar by any chance (and I'm completely newbe, so it might be that I simply didnt see it...) thanks!!
Alon Borenshtein Hi, xacro is a macro format for generating urdf's on the fly. You can do that in the terminal as well, you'll find samples online, here's one
https://automaticaddison.com/how-to-convert-a-xacro-file-to-urdf-and-then-to-sdf/
Janneta Bohlander oh, thanks 🙂 I knew I still have a lot to learn... thanks for the help! will check this out!
Hey Yifei!
Firstly, thank you very much for all your effort on this. Second, do you have any recommendations on how to 'calibrate & commission' the arm to a user's unique implementation? For example, in the instructions that Chris Annin gives for the AR4-MK3, the commissioning procedure verifies that the motors and encoders are going the right direction, and that the limit switches are acting correctly. I ask this because when I started up the arm today after getting ROS2 working through WSLg, with calibrate:=True the arm started moving in an unexpected way, so I turned off the power. I investigated in RVIZ and the encoders are causing correct movements on some joints, and opposite on others.
Any hints would be appreciated!
I am currently working on bringing up the AR4 MK3 system with ROS 2 Humble and would like to confirm the exact versions being used to ensure compatibility and debug alignment.
Could you please provide me with the following:
- The specific version or commit hash of the AR4 driver code you are currently using.
- The ROS 2 distribution and version that the AR4 driver has been tested with.
- The Arduino sketch version or last updated date for the Teensy controlling the AR4.
- The working example of xacro file
Having these details will help me align my environment precisely with your tested configuration, ensuring a smoother debugging and integration process.
Thank you in advance for your assistance.
colcon build
Starting >>> annin_ar4_description
Finished <<< annin_ar4_description [0.88s]
Starting >>> annin_ar4_driver
Starting >>> annin_ar4_moveit_config
Finished <<< annin_ar4_moveit_config [0.90s]
--- stderr: annin_ar4_driver
/home/ravi/ar4_ros_driver_bkkk/annin_ar4_driver/src/ar_servo_gripper_hw_interface.cpp: In member function ‘virtual hardware_interface::CallbackReturn annin_ar4_driver::ARServoGripperHWInterface::on_init(const hardware_interface::HardwareInfo&)’:
/home/ravi/ar4_ros_driver_bkkk/annin_ar4_driver/src/ar_servo_gripper_hw_interface.cpp:21:14: error: ‘struct hardware_interface::HardwareInfo’ has no member named ‘limits’
21 | if (!info_.limits.empty()) {
| ^~
/home/ravi/ar4_ros_driver_bkkk/annin_ar4_driver/src/ar_servo_gripper_hw_interface.cpp:22:41: error: ‘struct hardware_interface::HardwareInfo’ has no member named ‘limits’
22 | for (const auto& limitpair : info.limits) {
| ^~
gmake[2]: [CMakeFiles/annin_ar4_driver.dir/build.make:90: CMakeFiles/annin_ar4_driver.dir/src/ar_servo_gripper_hw_interface.cpp.o] Error 1
gmake[2]: Waiting for unfinished jobs....
gmake[1]: [CMakeFiles/Makefile2:139: CMakeFiles/annin_ar4_driver.dir/all] Error 2
gmake: [Makefile:146: all] Error 2
---
Failed <<< annin_ar4_driver [9.12s, exited with code 2]
Summary: 2 packages finished [10.5s]
1 package failed: annin_ar4_driver
1 package had stderr output: annin_ar4_driver
1 package not processed
I was getting this error while building main branch, I just blocked that part and continue , is that an issue?
Dipin basically everything should compile successfully, so it does look strange.
Anyway, from what I see- it fails on the gripper part, so as long as you don't use it (at least for the beginning, when you try to calibrate the arm) - it should not be a problem. In any case, its strange that 'struct hardware_interface::HardwareInfo’ has no member named ‘limits’', maybe its a matter of ROS version (I strongly recommend to use the same version ycheng517 used, otherwise you might get more similar issues).
Thanks,
Alon.
Dipin don't use the main branch on humble, it won't work even if you get past this build problem. Investigate and fix your limit switches like what Alon said.
hi Yifei Cheng
I am wondering if the code will work out of the box with a setup running the newer AR4 6.3 controller software. Given that the microstepping is altert via the dip switches, I assume the teensy code from your ros2-repo would also need some changes?
Justin Iszatt I use different and much more slimmed down microcontroller code. So to use the ros2 driver, you need to flash the arduino with the sketch in my repo.
hi Yifei Cheng ,
I am aware of that and have been using your script before updating to the new official ar4 software release 6. as it comes with a change in the micro step settings I was specifically wondering if the teensy code you provide is working with the new settings or if one would have to roll-back to the micro-step settings from the older instructions??
Justin Iszatt I haven't had the time to checkout the recent AR4 software changes. Can you describe the micro step settings change in more detail?
hi Yifei Cheng,
Chris Annin changed the motor-driver-settings for each motor upon his 6.1 release of the official HMI-Software.
I attached two images from the user-manual/build instructions below.
As you can see, Chris basically doubled the steps per revolution on all drivers (instead of taking 400 steps for a 360° move, on the new version this would only move 180° -> we now need 800 steps for 360° for J1).
From inspections you Teensy-Arduino code for ROS2, there are many elements referring to those steps.
While line 32 really names those steps ( const int MOTOR_STEPS_PER_REV[] = {400, 400, 400, 400, 800, 400}; ), I see many references made indirectly 60-63 and many things I don't really understand (line 25-29).
While my guess is, that we could just introduce a "multiply by two" method and be happy, I would be really grateful if you could take a look at this and decide on how to approach this.
Personally I would be really happy to have - at least a "6.N"copy of your code - a ROS2-setup that runs with my "official" robot.
Really looking forward to a reply and have to thank you so much for creating the ROS2 driver!!!
LG
Justin
Justin Iszatt thanks for the info! You're mostly right. I've created a PR with what I think will work here: https://github.com/ycheng517/ar4_ros_driver/pull/61
I haven't upgraded my arm to the MK3 yet so I can't test it myself, but hopefully you can!
I think I got rid of this part some time ago: "const int MOTOR_STEPS_PER_REV[] = {400, 400, 400, 400, 800, 400};"
So you may need to update to the latest main branch