Controller_overseer to C++#1
Conversation
Learned the difference between trigger service callbacks in cpp and python: python returns a response object but cpp passes in a ptr to the response and you just make construct that...
|
|
||
| #define FF_PUBLISH_PARAM "disable_native_ff" | ||
|
|
||
| #define PARAMETER_SCALE 1000000 |
There was a problem hiding this comment.
I just did this to match what was done in the current version but I don't really see a point
|
|
||
| //parameters | ||
| string robotName, configPath, thrusterSolverName; | ||
| bool writeAutoFF; |
There was a problem hiding this comment.
In ROS standard, variable declarations are placed after functions. Think about it like defining the public interface at the top of the file. Also, don't feel the need to leave whitespace between each variable. It can make the code feel cluttered. Use whitespace for logical organization of variables
|
|
||
| updateTimer = create_wall_timer(std::chrono_literals::1s, /*callback*/); | ||
|
|
||
| weightTimer = create_wall_timer(std::chrono_literals::1s, /*callback*/); |
There was a problem hiding this comment.
Same kind of deal here. Don't need all the whitespace
|
|
||
| tfListener = std::make_shared<tf2_ros::TransformListener>(*tfBuffer); | ||
|
|
||
| tfNamespace = "talos"; //get_parameter("robot").as_string()?? |
There was a problem hiding this comment.
Correct. You want to use the robot parameter instead of hardcoding it
| bool writeAutoFF; | ||
|
|
||
| ControllerOverseer() : Node("controller_overseer") { | ||
|
|
There was a problem hiding this comment.
Just be careful since you're declaring the constructor as private currently
| /* | ||
| Yaml traversal -- get recursed | ||
| */ | ||
| void traversal(std::vector<std::pair<std::string,int64_t>>& ints, std::vector<std::pair<std::string,bool>>& bools, std::vector<std::pair<std::string,std::vector<int64_t>>> & arrays, const YAML::Node& tree, const std::string path){ |
There was a problem hiding this comment.
These are some pretty nasty C++ types. Consider making a using reference for them
| } | ||
|
|
||
| } | ||
|
|
There was a problem hiding this comment.
Parsing code is always going to be kinda gross, and this seems pretty good, so nice work
| }; | ||
|
|
||
| //queue of service calls | ||
| std::deque<servicePair> waitingRequests; |
|
|
||
|
|
||
| //constructor | ||
| SimulinkModelClass::SimulinkModelClass(std::shared_ptr<ControllerOverseer> overseerNode, string nodeName) : overseer(overseerNode), nodeName(nodeName), modelActive(false), paramsLoaded(false){ |
There was a problem hiding this comment.
Space please between parenthesis and curly brace
|
|
||
| bool found = false; | ||
| //check for integers | ||
| for (const std::pair<std::string, int64_t>& p : intV) { |
There was a problem hiding this comment.
Appreciate the use of const reference in for loops
|
|
||
| <test_depend>ament_lint_auto</test_depend> | ||
| <test_depend>ament_lint_common</test_depend> | ||
|
|
There was a problem hiding this comment.
Keep in mind that in future you'll need to update the package.xml with dependencies added in the CmakeList using the key. Please don't for the time being, until we remove all the riptide deps from the controller
|
Seems like overall solid development on pace to be done in time. Functionality, where implemented, seems to be as I expected. Just focus on reformatting for a few stylistic things when you get the chance |
…ons from robot_class.cpp from the simulator
…first try im so happy
Needed to link yaml cpp (stole from physics simulator) lots of ROS/tf2 sytax and type nonsense specifically I needed to use a vector of long ints instead of doubles even though I was under the impression that cpp would just cast that for me. Also made hpp file for controller overseer but all of this needs comments so I need to go through that and then start testing. Also, need to determine if this will be tested within the new software stack or I should be using this with all old stack things and testing in sim that way.
|
Seems like mostly just naming changes. Glad the model seems to be working and the overseer builds. More thorough testing coming this week! |
|
Can you remove the extra models you added while working on the controller since it takes longer to generate the matlab packages. These would include: 'trial', 'newController', 'complete_controller_organized', 'complete_controller_unorganized' |
Refactoring of controller_overseer.py to C++