code-iai / asimov Goto Github PK
View Code? Open in Web Editor NEWROS Clojure Repository
ROS Clojure Repository
currently, only the minimum set off master-client communication is supported to start a topic and subsribe to a topic.
All messages to update the state of a node are ignored!
The technical overview section seems to provide a lot of information on how the master and slave rpc apis are actually used to make ROSTCP handshakes and exchange topic information.
This work can be done independently of the TCPROS stuff.
Someone has to implement services.
Now that asimov is able to subscribe and publish to topics, it's time to craft it's api and to document it.
A good excercise for this would be to port the tutorial section of the roslisp package to clojure.
Following README, I import asimov.api in the REPL and get the following exception:
user=> (require '[asimov.api :as ros])
ClassCastException java.lang.String cannot be cast to java.util.regex.Pattern clojure.core/re-match
er (core.clj:4386)
user=> (.printStackTrace *e)
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
...
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern
at clojure.core$re_matcher.invoke(core.clj:4386)
at clojure.core$re_matches.invoke(core.clj:4423)
at asimov.defaults$fn__28349.invoke(defaults.clj:12)
at asimov.defaults__init.load(Unknown Source)
at asimov.defaults__init.<clinit>(Unknown Source)
... 62 more
nil
Note that ROS_MASTER_URI
is set in my environment:
$ env | grep ROS_MASTER_URI
ROS_MASTER_URI=http://localhost:11311
Is it possible that a topic can have multiple message types ?
We think not, but the ROS Master and Slave api's seem to suggest that it's possible because you always have to specify both the topic name and the message type for the topic.
If this would not be the case we could further simplify our api
We need to agree on the format for the datastructure returned by parse-message
Current proposal:
bool a => [{:tag ::variable :type "bool" :name "a"}]
bool a=true => [{:tag ::constant :type "bool" :name "a" :value true}]
dasgeht/auch[][] a => [{:tag ::variable :type {:array {:array "dasgeht/auch"}} :name "a"]
see messages.clj in the current dev branch
rospack
is a command line tool which helps finding dependencies and directories in regular ROS environments. Use it --if available-- from asimov:
rospack find <pkg>
to find path corresponding to <pkg>
rospack depends <pkg>
to find all dependencies of <pkg>
(init-note! ...)~~
It is unfortunate that the ros master sends hostnames instead of fully qualified addresses.
For example after subsription to a topic example/topic, the master returns the address of the publishers of that topic.
In my experiments I am using the virtual machine Jan has set up for the lisp course.
The master returns the following address:
http://lisp-tutorial:
My current approach to handle this is having a global config with assoziations from host name to qualified address, but which can be overwritten by the local node config.
Anyone ideas regarding this?
Is it possible to tell the ros master to send fully qualified addresses ?
Is there a resource or example on the floating point constants in the message format?
First of all, thanks for providing detailed descriptions on how to use asimov. Thanks a lot!
When I tried out part of the instructions from the top-level README, I ran into two issues. Here's what I did: I created a publisher which publishes once.
My project.clj
file:
(defproject asimov-tutorials "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[asimov "0.1.1"]]
:main ^:skip-aot asimov-tutorials.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
And my core.clj
file:
(ns asimov-tutorials.core
(require [asimov.api :as ros])
(require [clojure.core.async :as a])
(:gen-class))
(defn -main
[& args]
(println "Hello, Topic!")
(let [m (ros/msgs "/opt/ros/hydro/share/turtlesim") ; the place of my turtlesim
n (ros/init-node! "/asimov" "192.168.1.103"
"192.168.1.103" 11311
{"ai-uni-bremen-shared-laptop" "192.168.1.103"})
out (ros/pub! n (m {:package "turtlesim" :name "Velocity"})
"/turtle1/command_velocity")]
(a/put! out {:angular 2 :linear 2})))
Startup setup:
$ roscore
$ rostopic echo /turtle1/command_velocity
asimov-tutorials.core> (-main)
Then I can see the following in console 2:
Traceback (most recent call last):
File "/opt/ros/hydro/bin/rostopic", line 35, in <module>
rostopic.rostopicmain()
File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/__init__.py", line 1667, in rostopicmain
_rostopic_cmd_echo(argv)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/__init__.py", line 1027, in _rostopic_cmd_echo
_rostopic_echo(topic, callback_echo, bag_file=options.bag)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/__init__.py", line 676, in _rostopic_echo
msg_class, real_topic, msg_eval = get_topic_class(topic, blocking=True)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rostopic/__init__.py", line 355, in get_topic_class
msg_class = roslib.message.get_message_class(topic_type)
File "/opt/ros/hydro/lib/python2.7/dist-packages/roslib/message.py", line 99, in get_message_class
cls = genpy.message.get_message_class(message_type, reload_on_error=reload_on_error)
File "/opt/ros/hydro/lib/python2.7/dist-packages/genpy/message.py", line 599, in get_message_class
cls = _get_message_or_service_class('msg', message_type, reload_on_error=reload_on_error)
File "/opt/ros/hydro/lib/python2.7/dist-packages/genpy/message.py", line 546, in _get_message_or_service_class
raise ValueError("message type is missing package name: %s"%str(message_type))
ValueError: message type is missing package name: /
Question 1:
In my experience, rostopic
is a robust tool. So, I suspect that it has a point when it says ValueError: message type is missing package name: /
. Any idea where the issue might be?
Question 2:
Also, when I start the repl within the tutorials package (which is just the above code) compilation repeat-ably takes ~20s. Do you experience the same load-up times for asimov? If yes, is this usual for clojure libs of this size? If no, is there a way to profile the loading process?
As mentioned in README, I read message definitions under resources
and get an exception:
user=> (def m (ros/msgs "resources"))
IllegalArgumentException No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: java.lang.Character clojure.core/-cache-protocol-fn (core_deftype.clj:541)
This seems to be a minor issue in the README, since passing a ["resources"]
instead of "resources"
solves the issue.
Are they only used to assign names to integer values in variables like enums?
Does code use them as actual constants?
We should simplify the API by introducing optional parameters or explicit option maps, in functions where default parameters can be deduced from the environment or ROS conventions.
For example init-node!
should have an empty hosts map by default and should take the master port from the environment variables.
Seems like the only proper solution to this giant load of crap.
Is the empty message definition (no declarations just whitespace) valid?
Currently we accept also empty messages, is this wrong?
Update documentation to reflect the current call semantics.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.