Skip to content

Commit 2835ba1

Browse files
authored
Merge pull request #39 from jdlangs/clear_readme
Remove documentation from repository README.md
2 parents bc82dbf + 8f57253 commit 2835ba1

File tree

5 files changed

+72
-233
lines changed

5 files changed

+72
-233
lines changed

README.md

Lines changed: 4 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -3,226 +3,10 @@
33
[![Build Status](https://travis-ci.org/jdlangs/RobotOS.jl.svg?branch=master)](https://travis-ci.org/jdlangs/RobotOS.jl)
44
[![Coverage Status](https://coveralls.io/repos/jdlangs/RobotOS.jl/badge.svg?branch=master)](https://coveralls.io/r/jdlangs/RobotOS.jl?branch=master)
55

6-
## Overview
6+
The Julia client library for [ROS](http://wiki.ros.org/) (Robot Operating System).
77

8-
### Description
8+
Documentation links:
99

10-
This package enables interfacing Julia code with a ROS ([Robot Operating
11-
System](http://wiki.ros.org)) system. It works by generating native Julia types
12-
for ROS types, the same as in C++ or Python, and then wrapping rospy through
13-
the PyCall package to get communication through topics, services, and
14-
parameters.
10+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://jdlangs.github.io/RobotOS.jl/stable)
1511

16-
### Installation
17-
18-
Pkg.add("RobotOS")
19-
using RobotOS
20-
21-
### Contributing
22-
23-
The package will hopefully continue to undergo substantial improvement. Please
24-
feel free to submit either an issue or pull request through github if you want
25-
to fix something or suggest a needed improvment, even if it's just to add an
26-
extra sentence in this README.
27-
28-
#### Testing
29-
30-
Currently, `Pkg.test("RobotOS")` requires some bootstrapping to work properly.
31-
Before running Julia, make sure a ROS master is running and start the helper
32-
node by running the `test/echonode.py` file.
33-
34-
## Usage: Type Generation
35-
36-
ROS types are brought into your program with the `@rosimport` macro which
37-
specifies a package and one or more types. The three valid syntax forms can be
38-
seen in these examples:
39-
40-
@rosimport std_msgs.msg.Header
41-
@rosimport nav_msgs.srv: GetPlan
42-
@rosimport geometry_msgs.msg: PoseStamped, Vector3
43-
44-
`@rosimport` will import the python modules for the requested type and all
45-
its dependencies but the native Julia types are not created yet since any
46-
inter-module dependencies have to be resolved first. After the final
47-
`@rosimport` call, initiate the type generation with:
48-
49-
rostypegen()
50-
51-
The new types will be placed in newly created modules in `Main`, corresponding
52-
to the packages requested. For example, `"std_msgs/Header" =>
53-
std_msgs.msg.Header`. After calling `rostypegen()` they can be interacted with
54-
just like regular modules with `import` and `using` statements bringing the
55-
generated type names into the local namespace.
56-
57-
using nav_msgs.msg
58-
import geometry_msgs.msg: Pose, Vector3
59-
p = Path()
60-
v = Vector3(1.1,2.2,3.3)
61-
62-
There is one special case, where the ROS type name conflicts with a built-in
63-
Julia type name (e.g., `std_msgs/Float64` or `std_msgs/String`). In these
64-
cases, the generated Julia type will have "Msg" appended to the name for
65-
disambiguation (e.g., `std_msgs.msg.Float64Msg` and `std_msgs.msg.StringMsg`).
66-
67-
An additional function, `rostypereset()`, resets the type generation process,
68-
possibly useful for development in the REPL. When invoked, new `@rosimport`
69-
calls will be needed to generate the same or different types, and previously
70-
generated modules will be overwritten after `rostypegen()` is called again. Keep
71-
in mind that names cannot be cleared once defined so if a module is not
72-
regenerated, the first version will remain.
73-
74-
## Usage: ROS API
75-
76-
In general, the API functions provided directly match those provided in rospy,
77-
with few cosmetic differences. The rospy API functions can reviewed here:
78-
[http://wiki.ros.org/rospy/Overview](http://wiki.ros.org/rospy/Overview)
79-
80-
### General Functions
81-
82-
- `init_node(name::String; kwargs...)` : Initialize node. Passes keyword
83-
arguments on to rospy directly. (Required)
84-
- `is_shutdown()` : Check for ROS shutdown state.
85-
- `spin()` : Wait for callbacks until shutdown happens.
86-
- `logdebug`,`loginfo`,`logwarn`,`logerr`,`logfatal` all work as in rospy.
87-
88-
### Time
89-
90-
Native Julia types `Time` and `Duration` are defined, both as a composite of an
91-
integral number of seconds and nanoseconds, as in rospy. Arithmetic and
92-
comparison operators are also defined. A `Rate` type is defined as a wrapper
93-
for the rospy Rate, which keeps loops running on a near fixed time interval. It
94-
can be constructed with a `Duration` object, or a floating-point value,
95-
specifying the loop rate in Hz. Other functions are:
96-
97-
- `get_rostime()`, `RobotOS.now()` : Current time as `Time` object.
98-
- `to_sec(time_obj)`, `convert(Float64, time_obj)` : Convert `Time` or
99-
`Duration` object to floating-point number of seconds.
100-
- `to_nsec(time_obj)` : Convert object to integral number of nanoseconds.
101-
- `rossleep(t)` with `t` of type `Duration`, `Rate`, `Real`. Also
102-
`sleep(t::Duration)` and `sleep(t::Rate)` : Sleep the amount implied by type
103-
and value of the `t` parameter.
104-
105-
### Publishing Messages
106-
107-
Publishing messages is the same as in rospy, except use the `publish` method,
108-
paired with a Publisher object. For example:
109-
110-
using geometry_msgs.msg
111-
pub = Publisher{PointStamped}("topic", queue_size = 10) #or...
112-
#pub = Publisher("topic", PointStamped, queue_size = 10)
113-
msg = PointStamped()
114-
msg.header.stamp = now()
115-
msg.point.x = 1.1
116-
publish(pub, msg)
117-
118-
The keyword arguments in the `Publisher` constructor are passed directly on to
119-
rospy so anything it accepts will be valid.
120-
121-
### Subscribing to a Topic
122-
123-
Subscribing to a topic is the same as in rospy. When creating a `Subscriber`,
124-
an optional `callback_args` parameter can be given to forward on whenever the
125-
callback is invoked. Note that it must be passed as a tuple, even if there is
126-
only a single argument. And again, keyword arguments are directly forwarded. An
127-
example:
128-
129-
using sensor_msgs.msg
130-
cb1(msg::Imu, a::String) = println(a,": ",msg.linear_acceleration.x)
131-
cb2(msg::Imu) = println(msg.angular_velocity.z)
132-
sub1 = Subscriber{Imu}("topic", cb1, ("accel",), queue_size = 10) #or...
133-
#sub1 = Subscriber("topic", Imu, cb1, ("accel",), queue_size = 10)
134-
sub2 = Subscriber{Imu}("topic", cb2, queue_size = 10)
135-
spin()
136-
137-
### Using services
138-
139-
ROS services are fully supported, including automatic request and response type
140-
generation. For the `@rosimport` call, use the plain service type name. After
141-
`rostypegen()`, the generated `.srv` submodule will contain 3 types: the plain
142-
type, a request type, and a response type. For example `@rosimport
143-
nav_msgs.srv.GetPlan` will create `GetPlan`, `GetPlanRequest`, and
144-
`GetPlanResponse`. To provide the service to other nodes, you would create a
145-
`Service{GetPlan}` object. To call it, a `ServiceProxy{GetPlan}` object. The
146-
syntax exactly matches rospy to construct and use these objects. For example,
147-
if `myproxy` is a `ServiceProxy` object, it can be called with
148-
`myproxy(my_request)`.
149-
150-
### Parameter Server
151-
152-
`get_param`, `set_param`, `has_param`, and `delete_param` are all implemented
153-
in the `RobotOS` module with the same syntax as in rospy.
154-
155-
### Message Constants
156-
Message constants may be accessed using `getindex` syntax. For example for
157-
[visualization_msgs/Marker.msg](http://docs.ros.org/api/visualization_msgs/html/msg/Marker.html)
158-
we have:
159-
160-
import visualization_msgs.msg: Marker
161-
Marker[:SPHERE] == getindex(Marker, :SPHERE) == 2 # true
162-
163-
## ROS Integration
164-
165-
Since Julia code needs no prior compilation, it is possible to integrate very
166-
tightly and natively with a larger ROS system. Just make sure you:
167-
168-
- Keep your code inside your ROS packages as usual.
169-
- Ensure your .jl script is executable (e.g., `chmod a+x script.jl`) and has
170-
the hint to the Julia binary as the first line (`#!/usr/bin/env julia`).
171-
172-
Now your Julia code will run exactly like any python script that gets invoked
173-
through `rosrun` or `roslaunch`. And since `include` takes paths relative to
174-
the location of the calling file, you can bring in whatever other modules or
175-
functions reside in your package from the single executable script.
176-
177-
#!/usr/bin/env julia
178-
#main.jl in thebot_pkg/src
179-
using RobotOS
180-
181-
include("BotSrc/Bot.jl")
182-
using Bot
183-
#...
184-
185-
## Full example
186-
187-
This example demonstrates publishing a random `geometry_msgs/Point` message at
188-
5 Hz. It also listens for incoming `geometry_msgs/Pose2D` messages and
189-
republishes them as Points.
190-
191-
#!/usr/bin/env julia
192-
193-
using RobotOS
194-
@rosimport geometry_msgs.msg: Point, Pose2D
195-
rostypegen()
196-
using geometry_msgs.msg
197-
198-
function callback(msg::Pose2D, pub_obj::Publisher{Point})
199-
pt_msg = Point(msg.x, msg.y, 0.0)
200-
publish(pub_obj, pt_msg)
201-
end
202-
203-
function loop(pub_obj)
204-
loop_rate = Rate(5.0)
205-
while ! is_shutdown()
206-
npt = Point(rand(), rand(), 0.0)
207-
publish(pub_obj, npt)
208-
rossleep(loop_rate)
209-
end
210-
end
211-
212-
function main()
213-
init_node("rosjl_example")
214-
pub = Publisher{Point}("pts", queue_size=10)
215-
sub = Subscriber{Pose2D}("pose", callback, (pub,), queue_size=10)
216-
loop(pub)
217-
end
218-
219-
if ! isinteractive()
220-
main()
221-
end
222-
223-
## Versions
224-
225-
- `0.1` : Initial release
226-
- `0.2` : Changed type gen API and moved generated modules to Main
227-
- `0.3` : Added service type generation and API
228-
- `0.4` : Julia v0.4+ support only
12+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://jdlangs.github.io/RobotOS.jl/latest)

docs/make.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@ using Documenter,RobotOS
22

33
makedocs(
44
modules=[RobotOS],
5-
doctest=false, clean=true,
6-
format =:html,
75
authors="Josh Langsfeld",
8-
sitename="RobotOS.jl",
9-
pages = Any[
10-
"Home" => "index.md"
11-
"API Reference" => "api.md"
12-
]
136
)
147

158
deploydocs(
16-
deps=Deps.pip("mkdocs","python-markdown-math"),
9+
deps=Deps.pip("mkdocs"),
1710
repo="github.com/jdlangs/RobotOS.jl",
1811
branch = "gh-pages",
1912
latest = "master",

docs/mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
site_name: RobotOS.jl
22
repo_url: https://github.com/jdlangs/RobotOS.jl
3-
site_description: Description
3+
site_description: Julia client library for ROS
44
site_author: Josh Langsfeld
5-
theme: readthedocs
5+
theme: mkdocs
66

77
markdown_extensions:
88
- codehilite
@@ -22,3 +22,4 @@ docs_dir: 'build'
2222

2323
pages:
2424
- Introduction: index.md
25+
- API Reference: api.md

docs/src/api.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
# API Reference
22

3-
```@autodocs
4-
Modules = [RobotOS]
3+
## ROS Type Generation
4+
5+
```@docs
6+
@rosimport
7+
rostypegen
8+
rostypereset
9+
```
10+
11+
## Publishing and Subscribing
12+
13+
```@docs
14+
Publisher
15+
publish
16+
Subscriber
17+
```
18+
19+
## Services
20+
21+
```@docs
22+
Service
23+
ServiceProxy
24+
wait_for_service
25+
```
26+
27+
## General ROS Functions
28+
29+
```@docs
30+
init_node
31+
is_shutdown
32+
spin
33+
```
34+
35+
## Time Handling
36+
37+
```@docs
38+
Time
39+
Duration
40+
Rate
41+
to_sec
42+
to_nsec
43+
RobotOS.now
44+
get_rostime
45+
rossleep
46+
sleep
47+
```
48+
49+
## Parameters
50+
51+
```@docs
52+
get_param
53+
set_param
54+
has_param
55+
delete_param
56+
```
57+
58+
## Logging
59+
60+
```@docs
61+
logdebug
62+
loginfo
63+
logwarn
64+
logerr
65+
logfatal
566
```

src/time.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export Time, Duration, Rate, to_sec, to_nsec, get_rostime, rossleep
1414
Object representing an absolute time from a fixed past reference point at nanosecond precision.
1515
1616
Basic arithmetic can be performed on combinations of `Time` and `Duration` objects that make sense.
17-
For example, if `t::Time` and `d::Duration`, `t+d` will be a `Time`, `d+d` a Duration`, `t-d` a
17+
For example, if `t::Time` and `d::Duration`, `t+d` will be a `Time`, `d+d` a `Duration`, `t-d` a
1818
`Time`, `d-d` a `Duration`, and `t-t` a `Duration`.
1919
"""
2020
immutable Time <: TVal

0 commit comments

Comments
 (0)