Comments (5)
@Bradford-Miller Thank you for reporting this. We'll look into this. Could you please help us with this by (a) Providing a minimal code example that shows the faulty behavior, and (b) providing your patch as a pull request? That would be really nice and would help us a lot!
@gaya- Who of us should have a look at this?
from roslisp.
a)
(let ((n 5))
(defun loopy ()
(format t "time: ~S" (get-internal-real-time))
(sleep n)
(if (plusp n) (decf n)))
(defun reset-loopy (x) (setq n x)))
(run-at-most-every 1 (loopy))
note the times after the captured variable reaches 0, there are a number of interations spaced 0 ticks apart, instead of the expected 1 second (which it eventually does after "catching up" to the erroneous time calculated by run-and-increment-delay.
b) I would, but firewall issues seem to be preventing me from doing so. The only difference is the first argument to '+ which should be the current time, not the previously captured time.
from roslisp.
@Bradford-Miller Thank you for providing this code snippet that produces the problem! I agree there seems to be a bug.
@gaya- I used @Bradford-Miller's example on Indigo
, roslisp
version 1.9.20
to confirm it:
ROSLISP> (defvar *n* 0)
ROSLISP> (defun loopy ()
(format t "time: ~s~%" (get-internal-real-time))
(sleep *n*)
(if (plusp *n*) (decf *n*)))
ROSLISP> (loop-at-most-every 1 (loopy))
So, the variable *n*
allows us to extend the computation time of the body run within loop-at-most-every
. When using the above setting of 0s
, we get the correct iteration durations of 1s
:
time: 912115
time: 913115
time: 914115
time: 915116
time: 916115
By setting *n*
to something higher number,e.g. 3
, we get three correction iteration durations of 3s
, 2s
, 1s
, and then three incorrect iteration durations of seemingly 0s
. Afterwards, all is fine again:
ROSLISP> (setf *n* 3)
3
ROSLISP> (loop-at-most-every 1 (loopy))
time: 1242747
time: 1245747
time: 1247747
time: 1248747
time: 1248747
time: 1248747
time: 1248747
time: 1249747
time: 1250747
@gaya- Could you please also confirm this bug?
from roslisp.
@Bradford-Miller Also, thank you very much for providing your fix in a separate pull request! Unfortunately, it seems like it introduce a new bug. This is what I ran to test it:
ROSLISP> (defvar *n* 0)
ROSLISP> (defun loopy ()
(format t "time: ~s~%" (get-internal-real-time))
(sleep *n*)
(if (plusp *n*) (decf *n*)))
ROSLISP> (loop-at-most-every 1 (loopy))
And it seems that in this setup our function body gets called twice per iteration:
time: 26723
time: 27723
time: 27723
time: 28723
time: 28724
time: 29724
time: 29724
time: 30724
time: 30724
time: 31724
time: 31724
For the case with a longer runtime for the function body, I initially get the desired behavior but also the above bug:
ROSLISP> (setf *n* 3)
3
ROSLISP> (loop-at-most-every 1 (loopy))
time: 216467
time: 219467
time: 221467
time: 222467
time: 223467
time: 223467
time: 224468
time: 224468
time: 225468
time: 225468
@Bradford-Miller Could you please confirm this behavior?
from roslisp.
Confirmed in Kinetic 16.04, roslisp 1.9.20
I've updated the pull request and retested. Sorry about that!
from roslisp.
Related Issues (20)
- start-ros-node not taking $ROS_IP into account HOT 9
- Subscription and publication to same topic from one node crashes.
- Move from SBCL HOT 16
- Broken on Trusty (because of ASDF 3) HOT 11
- Topic remapping not working HOT 1
- ros-time gives different timestamp than rosccp's ros::Time::now HOT 8
- Compiling Lisp code through catkin. HOT 1
- add_lisp_executable fails if bin dir is not deployed HOT 3
- Add a nicer structure for param namespaces
- Problem with installation on Mac OS El Capitan HOT 7
- When starting a new node ensure that no dashes are used in the name HOT 2
- MAKE-MESSAGE also accepting symbols for specifying message type HOT 4
- Warning in doc jobs HOT 17
- Error loading roslisp on newer SBCL versions HOT 3
- [noetic] Uses python on Buster when ROS_PYTHON_VERSION is 3 HOT 5
- Noetic Release? HOT 4
- Nodelets for zero-copy message passing between nodes
- rosilisp serialisation may not warn
- roslisp: avoid /bin/bash
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 roslisp.