2018 02 Results - BJU-Robot-Team/Bruin-2-Master GitHub Wiki
Team Members
Nathan Collins
Carter Shean
Alex Raddatz
Goals
The primary goal of this semester was to add braking to the robot, implemented through a hydraulic controller. And we wanted the software to control the brakes.
Accomplishments
Understanding the code
This was our biggest accomplishment this semester. Coming in, we had no idea how it worked, and we had to go through and trace how each piece worked.
Documentation
We've worked on improving and simplifying the documentation. The goal here is to help someone get started understanding how everything works.
Refactoring State Machine
We have been working on refactoring how the state machine controls the actuators into simple functions such as Brake::set(). These functions are defined in src/nodes/master/state_machine/interface
Refactoring the Relay Board Controller Node
I (Nathan Collins) have been working on refactoring the relay board node as a model of how to do all the actuator nodes. It should be much simpler to use a subscriber with callbacks than the method that was being used.
Suggestions for future work
Rewrite in Python
I would strongly recommend that we work on rewriting the program in Python for a number of reasons:
- Python is my favorite language (Just getting this out of the way that I'm biased)
- Python is a much simpler language. It is much easier and faster to write working code in Python than C++
- We're probably the last generation of CpS students who will know C++ well. CpS 209 is now based on C#, and as far as I know, there are no classes left with a strong focus on C++. I think it's still covered a little in Data Structures, but future students are more likely to know Python well than C++
Rewriting in Python doesn't have to be a huge ordeal. Individual nodes can be converted one at a time. For example, you could rewrite the Relay Board node and leave all the other nodes as is. Additionally, Python may not be the best choice for nodes that require fast data processing, such as camera or LIDAR as Python is much slower than C++. However, Python may be a good choice for image processing because it has good libraries that are implemented in C++ like numpy, opencl, etc.
Implement Unit Tests
We really need good unit tests to verify that the code does what it says it does. This may involve some simple GUI nodes, such as a test for the relay board that allows you to manually control each relay. Then you could test it on the robot and check whether the motors move as expected.
Find Source of Build Errors
Alex was having significant issues with building the code with catkin_make. After a bit of work, I traced it down to the fact that the build order is not deterministic. Catkin builds the code in a somewhat random order, but it allows you to specify dependencies. For example, the state machine is dependent on the msg files for many of the sensors/actuators being built. Sometimes, when we get lucky, the msg files build before the code that needs them and the code works fine. However, sometimes the msg files don't build in time because dependencies aren't set. I added several of the dependencies so that it built successfully every time for me, but Alex is still having issues. It might be worth tracking down the missing dependencies so that the issue doesn't recur. However, these problems might be fixed by switching to Python as dependencies wouldn't be evaluated till runtime.
Finish Refactoring State Machine
We didn't finish this. Additionally, the state machine doesn't do much actual driving yet. You might want to include this when switching to Python.
Finish Refactoring Relay Board
Again, you might want to wait till rewriting in Python