Skip to content

Commit

Permalink
Started implementing standard ROS message -> dict serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
asmodehn committed Sep 9, 2016
1 parent d3a7be1 commit 9933796
Show file tree
Hide file tree
Showing 18 changed files with 1,267 additions and 0 deletions.
Empty file added .gitignore
Empty file.
72 changes: 72 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
##############################################################################
# CMake
##############################################################################

cmake_minimum_required(VERSION 2.8.3)
project(pyros_msgs)

##############################################################################
# Find Packages
##############################################################################

find_package(catkin REQUIRED COMPONENTS
roslint
std_msgs
message_generation
message_runtime
)


catkin_python_setup()


# Lint Python modules
file(GLOB_RECURSE ${PROJECT_NAME}_PY_SRCS
RELATIVE ${PROJECT_SOURCE_DIR} src/pyros_test/*.py)
roslint_python(${${PROJECT_NAME}_PY_SRCS})


#####
# MESSAGES
#####

add_message_files(
DIRECTORY
msg
FILES
HttpRequest.msg
HttpResponse.msg
)

#####
# SERVICES
#####

# add_service_files(
# DIRECTORY
# srv
# FILES
# httpbin_ip.srv
# httpbin_get.srv
# httpbin_post.srv
# )

generate_messages(DEPENDENCIES std_msgs)



##############################################################################
# Catkin
##############################################################################

catkin_package()

#########
# Tests
#######

if (CATKIN_ENABLE_TESTING)
catkin_add_nosetests(tests)
endif()


20 changes: 20 additions & 0 deletions msg/HttpRequest.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This comes from requests package API

# possible HTTP methods
uint8 HEAD = 0
uint8 OPTIONS = 1
uint8 GET = 2
uint8 POST = 3
uint8 PUT = 4
uint8 PATCH = 5
uint8 DELETE = 6

uint8 method
string url

string params
string headers
string data

bool allow_redirects
float32 timeout
263 changes: 263 additions & 0 deletions msg/HttpResponse.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
# This comes from
# >>> import requests
# >>> vars(requests.codes)
# >>> for k, w in vars(requests.codes).items():
# ... print("uint8 {0} = {1}".format(k, w))
# ...
# minus :
# - uint16 name = status_codes
# - non ascii characters ( erased with http://utils.paranoiaworks.org/diacriticsremover/ )
# - emojis that fail when interpreted with python.
#
# using uint16 because
# genmsg.base.InvalidMsgSpec: /home/alexv/ROS/gopher_bootstrap/src/gopher_common/gopher_webclient/msg/httpresponse.msg: Invalid constant value: cannot coerce [510] to uint8 (out of bounds)



uint16 RESET = 205
uint16 not_extended = 510
uint16 precondition = 412
uint16 partial = 206
uint16 multi_stati = 207
uint16 RESUME = 308
uint16 forbidden = 403
# uint16 /o\ = 500
uint16 none = 444
uint16 bandwidth = 509
uint16 misdirected_request = 421
# uint16 /O\ = 500
uint16 all_ok = 200
# uint16 \o/ = 200
uint16 non_authoritative_info = 203
# uint16 \o- = 301
uint16 request_timeout = 408
uint16 SWITCHING_PROTOCOLS = 101
uint16 accepted = 202
uint16 upgrade = 426
uint16 im_a_teapot = 418
uint16 HEADER_FIELDS_TOO_LARGE = 431
uint16 i_am_a_teapot = 418
uint16 gateway_timeout = 504
uint16 ok = 200
# uint16 -O- = 404
uint16 PARENTAL_CONTROLS = 450
uint16 failed_dependency = 424
# uint16 _ = 500
uint16 see_other = 303
uint16 NETWORK_AUTHENTICATION_REQUIRED = 511
# uint16 _ = 200
uint16 service_unavailable = 503
uint16 moved_permanently = 301
uint16 CREATED = 201
uint16 RESET_CONTENT = 205
uint16 all_good = 200
uint16 network_authentication = 511
uint16 PRECONDITION_FAILED = 412
uint16 legal_reasons = 451
uint16 unprocessable_entity = 422
uint16 length_required = 411
uint16 NOT_ACCEPTABLE = 406
uint16 unsupported_media_type = 415
# uint16 -o- = 404
uint16 MEDIA_TYPE = 415
uint16 UNORDERED_COLLECTION = 425
uint16 MULTI_STATUS = 207
uint16 temporary_moved = 307
uint16 switching_protocols = 101
uint16 unordered_collection = 425
uint16 OK = 200
uint16 unauthorized = 401
uint16 SWITCH_PROXY = 306
uint16 ALL_GOOD = 200
uint16 MULTI_STATI = 207
uint16 NOT_IMPLEMENTED = 501
uint16 bad = 400
uint16 continue = 100
uint16 not_acceptable = 406
uint16 CONFLICT = 409
uint16 timeout = 408
uint16 proxy_authentication = 407
uint16 NOT_ALLOWED = 405
uint16 UNAVAILABLE = 503
uint16 PAYMENT = 402
uint16 insufficient_storage = 507
uint16 permanent_redirect = 308
uint16 BAD_GATEWAY = 502
uint16 UNAVAILABLE_FOR_LEGAL_REASONS = 451
uint16 HTTP_VERSION = 505
uint16 reset_content = 205
uint16 CLIENT_CLOSED_REQUEST = 499
uint16 TEMPORARY_REDIRECT = 307
uint16 NO_RESPONSE = 444
uint16 multiple_choices = 300
uint16 NON_AUTHORITATIVE_INFO = 203
uint16 LENGTH_REQUIRED = 411
uint16 request_uri_too_large = 414
uint16 proxy_auth = 407
uint16 too_many = 429
uint16 okay = 200
uint16 ACCEPTED = 202
uint16 header_fields_too_large = 431
uint16 bandwidth_limit_exceeded = 509
uint16 NONE = 444
uint16 retry = 449
uint16 EXPECTATION_FAILED = 417
uint16 use_proxy = 305
uint16 UNAUTHORIZED = 401
uint16 FORBIDDEN = 403
uint16 NOT_MODIFIED = 304
uint16 NON_AUTHORITATIVE_INFORMATION = 203
uint16 MULTIPLE_CHOICES = 300
uint16 BANDWIDTH = 509
uint16 BAD_REQUEST = 400
uint16 MULTIPLE_STATI = 207
uint16 VARIANT_ALSO_NEGOTIATES = 506
uint16 RETRY_WITH = 449
uint16 requested_range_not_satisfiable = 416
uint16 found = 302
uint16 PAYMENT_REQUIRED = 402
uint16 processing = 102
uint16 no_content = 204
uint16 NETWORK_AUTHENTICATION = 511
uint16 UNSUPPORTED_MEDIA_TYPE = 415
uint16 PROXY_AUTHENTICATION = 407
uint16 requested_range = 416
uint16 upgrade_required = 426
uint16 URI_TOO_LONG = 122
uint16 PARTIAL = 206
uint16 already_reported = 208
uint16 LOCKED = 423
uint16 proxy_authentication_required = 407
uint16 multi_status = 207
uint16 METHOD_NOT_ALLOWED = 405
uint16 NO_CONTENT = 204
uint16 MULTIPLE_STATUS = 207
uint16 CHECKPOINT = 103
uint16 dependency = 424
uint16 BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450
uint16 request_entity_too_large = 413
uint16 uri_too_long = 122
uint16 http_version = 505
uint16 PROXY_AUTHENTICATION_REQUIRED = 407
uint16 precondition_required = 428
uint16 ALL_OK = 200
uint16 UNPROCESSABLE = 422
uint16 GONE = 410
uint16 ALREADY_REPORTED = 208
uint16 bad_gateway = 502
uint16 IM_A_TEAPOT = 418
uint16 RETRY = 449
uint16 not_found = 404
uint16 ALL_OKAY = 200
uint16 REQUESTED_RANGE_NOT_SATISFIABLE = 416
uint16 REQUEST_TIMEOUT = 408
uint16 unavailable = 503
uint16 NETWORK_AUTH = 511
uint16 resume_incomplete = 308
uint16 HTTP_VERSION_NOT_SUPPORTED = 505
uint16 client_closed_request = 499
uint16 IM_USED = 226
uint16 payment = 402
uint16 checkpoint = 103
uint16 bad_request = 400
uint16 TOO_MANY = 429
uint16 media_type = 415
uint16 unavailable_for_legal_reasons = 451
uint16 MISDIRECTED_REQUEST = 421
uint16 retry_with = 449
uint16 PARTIAL_CONTENT = 206
uint16 http_version_not_supported = 505
uint16 UNSUPPORTED_MEDIA = 415
uint16 LEGAL_REASONS = 451
uint16 too_many_requests = 429
uint16 REQUEST_URI_TOO_LARGE = 414
uint16 not_allowed = 405
uint16 FIELDS_TOO_LARGE = 431
uint16 REQUESTED_RANGE = 416
uint16 variant_also_negotiates = 506
uint16 teapot = 418
uint16 TEMPORARY_MOVED = 307
uint16 reset = 205
uint16 BANDWIDTH_LIMIT_EXCEEDED = 509
uint16 temporary_redirect = 307
uint16 PERMANENT_REDIRECT = 308
uint16 locked = 423
uint16 internal_server_error = 500
uint16 not_modified = 304
uint16 RESUME_INCOMPLETE = 308
uint16 payment_required = 402
uint16 created = 201
uint16 resume = 308
uint16 blocked_by_windows_parental_controls = 450
uint16 range_not_satisfiable = 416
uint16 PROXY_AUTH = 407
uint16 request_uri_too_long = 122
uint16 unprocessable = 422
uint16 UPGRADE_REQUIRED = 426
uint16 gone = 410
uint16 MOVED_PERMANENTLY = 301
uint16 UPGRADE = 426
uint16 expectation_failed = 417
uint16 RANGE_NOT_SATISFIABLE = 416
uint16 partial_content = 206
uint16 SERVICE_UNAVAILABLE = 503
uint16 switch_proxy = 306
uint16 moved = 301
uint16 unsupported_media = 415
uint16 fields_too_large = 431
uint16 BAD = 400
uint16 TIMEOUT = 408
uint16 CONTINUE = 100
uint16 TOO_MANY_REQUESTS = 429
uint16 network_authentication_required = 511
uint16 unordered = 425
uint16 INSUFFICIENT_STORAGE = 507
uint16 server_error = 500
uint16 non_authoritative_information = 203
uint16 TEMPORARY = 307
uint16 not_implemented = 501
uint16 method_not_allowed = 405
uint16 MOVED = 301
uint16 other = 303
uint16 UNPROCESSABLE_ENTITY = 422
uint16 I_AM_A_TEAPOT = 418
uint16 GATEWAY_TIMEOUT = 504
uint16 FAILED_DEPENDENCY = 424
uint16 PRECONDITION_REQUIRED = 428
uint16 all_okay = 200
uint16 conflict = 409
uint16 SERVER_ERROR = 500
uint16 PRECONDITION = 412
uint16 PROCESSING = 102
uint16 temporary = 307
uint16 INTERNAL_SERVER_ERROR = 500
uint16 precondition_failed = 412
uint16 no_response = 444
uint16 OTHER = 303
uint16 REQUEST_ENTITY_TOO_LARGE = 413
uint16 FOUND = 302
uint16 NOT_FOUND = 404
uint16 TEAPOT = 418
uint16 USE_PROXY = 305
uint16 NOT_EXTENDED = 510
uint16 network_auth = 511
uint16 parental_controls = 450
uint16 OKAY = 200
uint16 im_used = 226
uint16 multiple_status = 207
uint16 DEPENDENCY = 424
uint16 REQUEST_URI_TOO_LONG = 122
uint16 SEE_OTHER = 303
uint16 UNORDERED = 425
uint16 multiple_stati = 207


# Actual message structure
# this is defined so that a response (using requests python package)
# can be converted automatically into a message as much as possible...

uint16 status_code
string encoding
string headers
string text
string json
32 changes: 32 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<package format="2">
<name>pyros_msgs</name>
<version>0.0.1</version>
<description>
Pyros messages and services definition
</description>

<author>AlexV</author>
<maintainer email="[email protected]">AlexV</maintainer>
<license>BSD</license>

<url type="website">http://www.ros.org/wiki/rocon_tools</url>
<url type="repository">https://bitbucket.org/yujinrobot/gopher_common</url>
<url type="bugtracker">https://bitbucket.org/yujinrobot/gopher_common/issues</url>

<buildtool_depend version_gte="0.6.18">catkin</buildtool_depend>

<depend version_gte="1.11.19">rospy</depend>
<depend version_gte="0.5.9">std_msgs</depend>

<build_depend version_gte="0.2.10">message_generation</build_depend>
<exec_depend version_gte="0.4.12">message_runtime</exec_depend>

<!-- documentation dependencies -->
<doc_depend version_gte="0.2.10">python-catkin-pkg</doc_depend>

<export>
<rosdoc config="rosdoc.yaml"/>
</export>

</package>
2 changes: 2 additions & 0 deletions rosdoc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- builder: sphinx # specify document generator. e.g) doxygen, epidoc, sphinx
sphinx_root_dir: doc # document directory
Loading

0 comments on commit 9933796

Please sign in to comment.