smd-ros-devel / kangaroo_x2_driver

ROS Driver for the Dimension Engineering Kangaroo x2 Motion Controller
9 stars 2 forks source link

Failing to read from Serial #10

Open shoemakerlevy9 opened 8 years ago

shoemakerlevy9 commented 8 years ago

Hi,

I've connected a Kangaroo/Sabertooth to a system running ROS using an FTDI cable. I used the DEScribe software to change the baud rate of the Kangaroo to 38400. I'm calling your node with a launch file like so:

<node pkg="kangaroo_driver" type="kangaroo_driver_node" name="kangaroo" output="screen">
      <param name="port" value="/dev/ttyUSB0" />
      <param name="baud" value="38400" />
      <param name="ch1_joint_name" value="D" />
      <param name="ch2_joint_name" value="T" />
</node>

I get the errors:

Failed to read from serial Failed to get the header

I also made sure that /dev/ttyUSB0 is the correct port with the command

$lsusb

which outputs...

Bus 001 Device 010: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

combined with this bash script


#!/bin/bash

for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && continue
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && continue
        echo "/dev/$devname - $ID_SERIAL"
    )
done

which outputs...

/dev/ttyUSB0 - FTDI_TTL232R-3V3_FT97PQ1E

Is there anything else required to use your package? How should the Sabertooth be configured?

cottsay commented 8 years ago

Hello!

Have you verified that the user you're running roslaunch from has sufficient permission to write to /dev/ttyUSB0?

--scott

shoemakerlevy9 commented 8 years ago

Thanks for the response. I figured out that my issue is a repeat of issue #4, I just misunderstood what their fix was, but I understand now.

When the Kangaroo is in mixed_mode the channels names change from the default of '1' and '2' to 'd' and 't' (which stand for drive and turn). I used ROS params to set those in my launch file like so:

    <node pkg="kangaroo_driver" type="kangaroo_driver_node" name="kangaroo" respawn="true" respawn_delay="5">
        <param name="port" value="/dev/ttyUSB0" />
        <param name="ch1_joint_name" value="D" />
        <param name="ch2_joint_name" value="T" />
    </node>

However this library currently doesn't do anything with 'ch1_joint_name" and "ch2_joint_name" so those where not being set. I just went into kangaroo_driver.cpp and changed all of the '1' and '2' to 'd' and 't' as a quick fix.

I'll keep this issue open so that it can be closed once those params are hooked up.

zakoliveira commented 7 years ago

Hello,

I'm having the same problem and changing the "1" and "2"s it doesn't solves I want to control two motors using serial, with sabertooth 25x2 + kangaroo. I'm using the setup shown in below and everytime I run the node I get the errors "Failed to read from serial Failed to get the header"

18641403_1615635895113424_992321072_o 18675118_1615635865113427_1086438679_o 18641580_1615635831780097_1021072907_o

Hope someone can help me with this issue and thank you.