This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Import files | |
| import rospy | |
| from intro_pkg1.srv import * | |
| # Service server function | |
| def equation(request): | |
| # Response object | |
| response = FloatIOResponse() | |
| # Relation between request and response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Include header files | |
| #include "ros/ros.h" | |
| // The service header file | |
| #include "intro_pkg1/FloatIO.h" | |
| // Definition function | |
| bool equation(intro_pkg1::FloatIO::Request &req, intro_pkg1::FloatIO::Response &res) { | |
| // Relation between output and input | |
| res.output = 2 * (req.input) + 1; | |
| ROS_INFO("Request: [%f], Response: [%f]", req.input, res.output); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Header files for ROS | |
| #include "ros/ros.h" | |
| // For service | |
| #include "intro_pkg1/FloatIO.h" | |
| // For atof | |
| #include "stdlib.h" | |
| int main(int argc, char **argv) { | |
| // Initialize the node | |
| ros::init(argc, argv, "FloatIO_ServiceClient"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Import libraries | |
| import rospy | |
| # Service files | |
| from intro_pkg1.srv import * | |
| # System files | |
| import sys | |
| def main(): | |
| # Initialize the node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| PACKAGE = "intro_pkg1" # Package variable | |
| from dynamic_reconfigure.parameter_generator_catkin import * | |
| # Parameter Generator object | |
| gen = ParameterGenerator() | |
| # Add parameters | |
| gen.add("Integer_param", int_t, 0, "An integer parameter", 0, -5, 5) | |
| gen.add("Double_param", double_t, 0, "A double parameter", 0.0, -2, 2) | |
| gen.add("String_param", str_t, 0, "A string parameter", "String Here") | |
| gen.add("Bool_param", bool_t, 0, "A boolean parameter", False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Header files | |
| #include "ros/ros.h" | |
| // Dynamic reconfigure server file | |
| #include "dynamic_reconfigure/server.h" | |
| // Configuration file | |
| #include "intro_pkg1/SampleConfig.h" | |
| void callback_function(intro_pkg1::SampleConfig &conf, uint32_t level) { | |
| // Accessing parameters | |
| ROS_INFO("Reconfiguration results: %i %f %s %s %i", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Import rospy | |
| import rospy | |
| # Main dynamic reconfiguration files | |
| from dynamic_reconfigure.server import Server | |
| # Configuration made in the devel folder | |
| from intro_pkg1.cfg import SampleConfig | |
| # Callback function | |
| def callback(config, level): | |
| rospy.loginfo("Values: {0}, {1}, {2}, {3}, {4}".format(config.Integer_param, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <launch> | |
| <!-- Argument parser made using C++ --> | |
| <node name="Debugger1" pkg="intro_pkg1" type="AllLevelDebugger" launch-prefix="gnome-terminal --tab -e "/> | |
| <node name="Debugger2" pkg="intro_pkg1" type="DebuggerAll.py" launch-prefix="gnome-terminal --tab -e"/> | |
| </launch> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // All #include files .... | |
| #include "ros/console.h" | |
| // Code here... | |
| int main(int argc, char **argv) { | |
| // Initialize ROS node using ros::init function | |
| ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug); // Set console level to debug | |
| // Code here... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Override the rosconsole logger | |
| # output level for this package ONLY | |
| log4j.logger.ros.intro_pkg1=DEBUG |