Add code to use encoders#65
Add code to use encoders#65ryanloeffelman merged 13 commits intoMST-Robotics:masterfrom ryanloeffelman:encoder
Conversation
Needs to be tested on working robot, to verify the speed is calculated correctlly, and acurattly
Changed the desiered_speed variable to desired_speed
Added code to Arduino to publish encoder ticks Created a custom msg including Header, and Uint8
|
I know it currently doesn't work, I need help in getting the Arduino compiler to see the custom msg I created @islamelnabarawy |
|
I think this link may help, http://wiki.ros.org/rosserial_client/Tutorials/Generating%20Message%20Header%20Files but I don't fully understand it |
ros_ws/src/control/CMakeLists.txt
Outdated
There was a problem hiding this comment.
There is a missing function here which is what is causing the msg build failure. Since this depends on std_msgs you need the line:
generate_messages(DEPENDENCIES std_msgs)
to come here. This entire message block will also have to be moved up to be above the catkin_specific configuration block in order for it to build.
|
@ryanloeffelman @matthewia94 |
|
Matt fixed the main issue, however I have yet to push my changes, give me around 10ish minuets and it should be ready to review |
Allowed the Arduino to see the Ros Custom Header, will require remaking the rosserial_python libraries after making, so that the arduino code can actully compile
|
I haven't actually been able to test the code on the Robot yet, as we have no encoders installed to test with, however the code will has at least been able to read the encoder successfully. The ROS message updating has yet to be tested. Also, I am starting to get a low memory warning on the Arduino Compiler, not to much of an issue, however If you see anything I do to save space, that would be great, thanks @islamelnabarawy |
|
@ryanloeffelman The arduino file caused merge conflicts, and after resolving them I'm getting a compilation error saying it can't find Encoder.h. We might need to go over this together in person. |
|
The arduino file needs you to build the message headers. This is done with the make_libraries script contained in the rosserial_arduino package. The section Install ros_lib into the Arduino Environment here: http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup gives details on how to set it up |
|
The error I'm getting while trying to compile the arduino code is: motor.ino:14:29: fatal error: control/Encoder.h: No such file or directory |
|
Correct, you would get this error if you have not run the make_libraries script as the message header is auto generated by ROS. @ryanloeffelman Would you mind maybe adding the build process for custom messages to the arduino page on our wiki? Basically you need to build the normal code and source, find the libraries folder for arduino, delete ros_lib directory if it exists and run: |
|
Ok, it's possible that I hadn't sourced the project before generating the libraries last time. This time it worked, but there was another error because the set_pwm_frequency() function needed to be forward-declared. I did that and it compiled. I'll add a comment to the relevant line of code. |
|
At least its not just me who makes that mistake. Are you using the Arduino Compiler? I know its good practice to forward declare things, however Arduino doesn't usually care about that. |
|
It might have been due to a merge error. I will have to merge the code manually to make sure the merge doesn't break anything, and I'll accept the pull request as soon as I'm done with that. |
|
Sound good, however I wouldn't actually accept this pull request until we can test it on the Robot, which will be after the encoder have been successfully installed |
|
Noted. |
ros_ws/src/arudino/motor/motor.ino
Outdated
There was a problem hiding this comment.
Change to:
attachInterrupt(0, encoderCount, RISING);
This will update on the rising edge and we won't have to check if the change was from low to high or not.
…coder Conflicts: ros_ws/src/arudino/motor/motor.ino
Needs to be tested on working robot, to verify the speed is calculated
correctly, and accurately
Also updated a lot of names to match the Missouri S&T Robotics Competition Team standards
closes #35