Tonight I continued to work with brushless motors, VESC and ROS. The Differential drive works. I hooked up a DS4 running turtlebot_teleop_joystick In order to control the motors with a joystick. I also adjusted a few settings. I Have a good start torque with low speeds. But Its not always running smooth from low speed start (Because of the hall sensors don’t know where the rotor position is) To be able to control the low speeds with a better start torque I am thinking off getting encoders to the motors.
The VESC´s have integrated support of the AS5047P which is a high-resolution rotary position sensor for high speed (up to 28krpm) angle measurement over a full 360-degree range. I was trying to buy this, but could not find a place which had this encoders on stock. So I started looking at AS5047D and the AS5048A. The AS5048Ahas 16384 positions per revolution which will make the rotor position very precise. I am trying to find out if the VESC´s supports them “out of the box”. Lets see.
To get the DS4 working with Jetson TX2 and ROS was easy.
- Pair and connect the DS4 To the JetsonTX2
#rfkill unblock bluetooth #bluetoothctl #show #scan on #pair on Check Input: ls /dev/input/
The Joystick will appear as js. In my case my mouse appears as js0 and the DS4 as js1. Which device that belongs to what js can easily be tested with
sudo jstest /dev/input/jsX (change X to number)
To confirm that is working with ROS:
#roscore #rosparam set joy_node/dev "/dev/input/jsX" #rosrun joy joy_node #rostopic list #rostopic echo /joy
Test to move the buttons on the DS4 and you will see things change.
To get the turtlebot_teleop_joystick working with the DS4 simply use the ps3_teleop.launch and change the things highlighted in bold (In my case I also changed the scale_angular and scale_linear to higher values. The motors Where running a bit slow on the default values.
<launch> <!-- smooths inputs from cmd_vel_mux/input/teleop_raw to cmd_vel_mux/input/teleop --> <include file="$(find turtlebot_teleop)/launch/includes/velocity_smoother.launch.xml"/> <node pkg="turtlebot_teleop" type="turtlebot_teleop_joy" name="turtlebot_teleop_joystick"> <param name="scale_angular" value="4.5"/> <param name="scale_linear" value="2.5"/> <param name="axis_deadman" value="4"/> <param name="axis_linear" value="1"/> <param name="axis_angular" value="0"/> <remap from="turtlebot_teleop_joystick/cmd_vel" to="mobile_base_controller/cmd_vel"/> </node> <node pkg="joy" type="joy_node" name="joystick"/> </launch>
Here is a video of the second test: