Comments (10)
Please note that rclcpp::Rate use RCL_SYSTEM_TIME
in default. Do you change it ?
rclcpp/rclcpp/include/rclcpp/rate.hpp
Lines 133 to 146 in 348e22a
from rclcpp.
I have been set use_sim_time=true
https://design.ros2.org/articles/clock_and_time.html
use_sim_time
is set on the node, but Rate
object. with your example, as @Barry-Xu-2018 mentions, Rate
is instantiated with system time as default, not simulation time. I think you need to set RCL_SYSTEM_TIME
for Rate
, the it can get the time from simulation clock.
this->get_clock()->now() or this->now() can get the sim time,
assuming that this
is the Node
. because the use_sim_time
is set to true, clock belongs to node is now set to simulation clock. so that it can get simulation clock.
from rclcpp.
How do you create timer to publish messages ?
create_wall_timer or create_timer
Simulate time doesn't affect create_wall_timer.
from rclcpp.
from rclcpp.
How do you create timer to publish messages ? create_wall_timer or create_timer Simulate time doesn't affect create_wall_timer.
Hi, Barry. In simulation, i used rclcpp::Rate loop_rate(ctrl_freq); And In a
while(rclcpp::ok()) { rclcpp::spin_some(mynode); //my program loop_rate.sleep(); }
from rclcpp.
Please note that rclcpp::Rate use
RCL_SYSTEM_TIME
in default. Do you change it ?rclcpp/rclcpp/include/rclcpp/rate.hpp
Lines 133 to 146 in 348e22a
I have been set use_sim_time=true
https://design.ros2.org/articles/clock_and_time.html
from rclcpp.
As fujitatomoya said,you should modify code on creating Rate.
rclcpp::Rate loop_rate(ctrl_freq, std::make_shared(RCL_ROS_TIME));
from rclcpp.
As fujitatomoya said,you should modify code on creating Rate.
rclcpp::Rate loop_rate(ctrl_freq, std::make_shared(RCL_ROS_TIME));
I have tried add this code. But have some error in IDE, my ros2 version is foxy
error: no matching function for call to ‘make_shared(rcl_clock_type_t)’
268 | rclcpp::Rate loop_rate(ctrl_freq, std::make_shared(RCL_ROS_TIME));
from rclcpp.
I have tried add this code. But have some error in IDE, my ros2 version is foxy
Foxy is already E.O.L, can you use humble
or later instead?
from rclcpp.
For Foxy, you should create a Clock with RCL_ROS_TIME
rclcpp/rclcpp/include/rclcpp/clock.hpp
Lines 53 to 66 in b0c25d5
Create a new "Rate" like with above Clock.
rclcpp/rclcpp/include/rclcpp/rate.hpp
Line 115 in b0c25d5
BTW, foxy is EOL.
So it's best to upgrade to the Humble or Iron version.
from rclcpp.
Related Issues (20)
- :farmer: `test_lifecycle_service_client` failing consisntent in CycloneDDS HOT 1
- Bug in Executor::get_next_ready_executable ? HOT 3
- TypeAdapted publishing doesn't use provided allocator HOT 3
- TimersManager doesn't follow ROS time HOT 2
- rclcpp_action: Provide enum class return ClientGoalHandle::get_status
- Callback works on Galactic but fails on Rolling - handle_message is not implemented for GenericSubscription HOT 1
- Clang warning: ordered comparison of function pointers (Rolling) HOT 1
- `-fanalyzer` warning: possible null dereference when using TypeAdapters HOT 4
- leak due to std::shared_ptr circular reference between Context and GuardCondition HOT 3
- :farmer: `rclcpp.test_executors` failing in Rolling and Jazzy CycloneDDS HOT 2
- rclcpp::Time(int64_t nanoseconds, ...) should check for negative time
- Regression : Executor::spin_some_impl is active waiting HOT 5
- Parameter service behavior is inconsistent with the documentation of rcl_interfaces HOT 9
- Lifecycle destructor calls shutdown while in shuttingdown intermediate state HOT 45
- Backport PR2063 to Humble for Windows HOT 2
- Executor callbacks are no longer in a predictable order HOT 25
- Program exits with code -11 when using async_send_request to set parameters in ROS 2 C++ client HOT 1
- Timer callbacks can be delayed when using simulation time HOT 4
- Possible regression in rcl preshutdown callbacks - context invalid? HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rclcpp.