smd-ros-devel / kangaroo_x2_driver

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

Fail to run kangaroo driver node but not error when it was compile. #3

Open chencol opened 9 years ago

chencol commented 9 years ago

Hi.Today in lab I want to use the ROS in virtual box to control the motor connect to the kangaroo and sabertooth set. The node is compiled successfully and I did find out the port which has been using and make it available. Besides, I have modified the port setting inside the kangaroo_driver.cpp. Everything seems perfect. When I tried to run the node, it shows "fail to read from the serial. Sent start signals to clear." The address of the code used is https://github.com/smd-ros devel/kangaroo_x2_driver/blob/master/src/kangaroo_driver.cpp .

cottsay commented 9 years ago

You shouldn't need to modify the port setting in kangaroo_driver.cpp - you should use a ROS param to set it [1]. This will allow you to change the port without re-compiling the driver.

Some other things to watch out for:

[1] http://wiki.ros.org/Parameter%20Server

chencol commented 9 years ago

Yeah. I used the delink to connect kangaroo to PC. Then I checked the port by typing /dev/tty . I found ACM0. Then I chomd 777 /dev/ttyACM0. The baud rate for kangaroo is 9600 and I did change it in the kangaroo_driver.cpp.

chencol commented 9 years ago

Sir.Sorry to disturb you again. Does ACM0 look a little wired? Is it supposed to be something like USBX?

mattamert commented 9 years ago

Okay, so if you look at the code here: https://github.com/smd-ros-devel/kangaroo_x2_driver/blob/master/src/kangaroo_driver.cpp#L504, you can see where your error is being thrown. Now, the error message that we are giving you in our driver is not very good (sorry about that). We actually are able to read from the serial, but the real issue is that the Kangaroo told us there was an error and did not return meaningful data otherwise.

Taking a look at http://www.dimensionengineering.com/datasheets/KangarooPacketSerialReference.pdf, specifically under the section "Error Codes", we see that the error code you are getting back is error code 3. Referencing the other kangaroo manual (http://www.dimensionengineering.com/datasheets/KangarooManual.pdf), we see that error code 3 means "Control error, channel disabled. Check to make sure your feedback sources are working and the system matches how it was set up during the tune. "

Okay, so now we know for sure that A) you are actually able to successfully send and receive data from the Kangaroo, and therefore B) it is not an issue with the baud rate, port number, etc.

Now, there are several things that could be going wrong, and we are going to need more information in order to fully diagnose it. Could you describe in more detail what's happening with the error message? Is it only happening once, or are you being flooded with the error messages?

Also, could you show us the code you are using to run the node so that we can get a better idea of what could be happening?

Thanks!

chencol commented 9 years ago

To @mattamert . Yeah. It happens all time whenever I run the kangaroo_driver node. And another point is that my kangaroo motion controller only has one motor connected. Is it the reason that error happened? For the code used, I am not quite clear about what you mentioned. Are you referring to the kangaroo_driver.node? Hope to get your reply. Thanks.

mattamert commented 9 years ago

Sorry, the code that I was referring to were your ROS params (it's been over a year since I've touched ROS related stuff, so I'm very rusty at this).

Only having one motor connected is probably the reason the error messages are occurring. The driver assumes that there are two motors, and when the driver sends a message to the Kangaroo, it sends one for each channel. This is because the driver was not, at the time, meant to be extensible; it was written in only a few days and meant to be only used for our specific robot. (We were in a time crunch for a competition).

Try connecting a second motor to the other channel, and see if that fixes the problem. I am hesitant about modifying the code right now to support only one motor because I do not have access to the equipment necessary to test the changes. However, if you do not have access to a second motor controller, I can probably point you to the lines of code you will have to remove to support only one motor.

I hope this helps!

chencol commented 9 years ago

@mattamert Yeah . I will try it when school starts. Thanks for you help. Both you and @cottsay are all so kind and patient. It makes me feel confident in completing this project. Thanks!!!