Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chencol opened this issue Jul 15, 2015 · 7 comments
Open

Comments

@chencol
Copy link

chencol commented Jul 15, 2015

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
Copy link
Member

cottsay commented Jul 17, 2015

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:

  • Is the baud rate correct? This driver uses 38400 baud, so if your Kangaroo x2 isn't set to use this baud rate, the driver won't successfully communicate.
  • Does the driver have permission to access the port? If /dev/ttyFOO isn't writable by the user that is running the driver, the driver will not function. Consider adding a udev rule to change the permissions on the port, or adding the user to the necessary groups so that it has read/write access to the port.

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

@chencol
Copy link
Author

chencol commented Jul 18, 2015

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
Copy link
Author

chencol commented Jul 18, 2015

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

@mattamert
Copy link
Contributor

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
Copy link
Author

chencol commented Jul 19, 2015

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
Copy link
Contributor

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
Copy link
Author

chencol commented Jul 19, 2015

@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!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants