Init commit.
This commit is contained in:
commit
264c972100
|
|
@ -0,0 +1,17 @@
|
|||
cmake_minimum_required(VERSION 3.10.2)
|
||||
project(logging_debug)
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
roscpp
|
||||
)
|
||||
|
||||
catkin_package(
|
||||
CATKIN_DEPENDS roscpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${catkin_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_executable(roslog src/roslog.cpp)
|
||||
target_link_libraries(roslog ${catkin_LIBRARIES})
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="2">
|
||||
<name>logging_debug</name>
|
||||
<version>0.0.0</version>
|
||||
<description>TODO: Package description</description>
|
||||
<maintainer email="jpace121@gmail.com">jimmy</maintainer>
|
||||
<license>MPL-2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
<depend>roscpp</depend>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/* Copyright 2025 James Pace
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
* defined by the Mozilla Public License, v. 2.0.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
class Publisher
|
||||
{
|
||||
public:
|
||||
Publisher():
|
||||
nh_{}
|
||||
{
|
||||
timer_ = nh_.createTimer(ros::Duration(0.1), [this](const ros::TimerEvent&)
|
||||
{
|
||||
double val = 0;
|
||||
const auto start = std::chrono::steady_clock::now();
|
||||
for(int i = 0; i < 10000; i++)
|
||||
{
|
||||
val = val + 0.001*(1.0 - val);
|
||||
ROS_INFO_STREAM("Val is " << val);
|
||||
}
|
||||
const auto end = std::chrono::steady_clock::now();
|
||||
|
||||
const std::chrono::duration<double> diff = end - start;
|
||||
ROS_INFO_STREAM("Time delta: " << diff.count());
|
||||
|
||||
std::exit(0);
|
||||
}, true);
|
||||
}
|
||||
|
||||
private:
|
||||
ros::NodeHandle nh_;
|
||||
ros::Timer timer_;
|
||||
};
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
ros::init(argc, argv, "publisher");
|
||||
auto node = Publisher();
|
||||
ros::spin();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue