-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Euslispでyaml形式のファイルを読み書きしたい #709
Comments
As far as I know the closest thing we have to a yaml utility in euslisp is the rosparam interface. You could try to couple set/get param with Here is a start: (defun alistp (alist)
(and (listp alist) (every #'consp alist)))
(defun format-alist (lst output-stream &optional (lvl 0))
(dolist (l lst)
(let ((name (car l))
(val (cdr l)))
(spaces (* 2 lvl) output-stream)
(format output-stream "~a: " name)
(if (alistp val)
(progn
(terpri output-stream)
(format-alist val output-stream (1+ lvl)))
(if (listp val)
(dolist (v val)
(terpri output-stream)
(spaces (* 2 (1+ lvl)) output-stream)
(format output-stream "- ~A" v))
(print val output-stream))))))
(defun dump-param (name output-stream)
(format-alist (acons name (ros::get-param name) nil) output-stream))
;; (dump-param "myparam" t) |
Thank you very much. I feel that simple encoder/decoder can be implemented relatively easily if we use rosparam, so I'll think about it for a moment. input.yaml
from-yaml.l
in command line
|
Using #710 , I created a program to read and write any yaml file in roseus by using the load and dump functions of rosparam.
Is there a good way and need to add such functions to jsk_roseus? |
Glad that you were able to read/ write yaml files as expected. However, I am afraid that this still may be a little too 'hacky' to add to jsk_roseus... |
That's right ... |
I think it is ok to leave it as a sample program in this issue. |
Euslispでyaml形式のファイルを読み書きするための関数や読み書きしている例はありますでしょうか?
pythonやcommon lispの例はあるみたいなのでそれらを参考にして作るか,使いたいyamlファイルの形式などがある程度決まっている場合は自分でparserを作るというのも有り得そうです.
また,読み込むだけならrosparamとして渡すという作戦が有効そうかなと思っています.
因みにjsonの例はjsk_roseus/roseus_mongo/euslisp/json/にあるようです.
The text was updated successfully, but these errors were encountered: