Initial commit

This commit is contained in:
CaiXiang
2024-10-25 14:21:27 +08:00
commit 314bf9ad25
2041 changed files with 272126 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
Metadata-Version: 2.1
Name: tutorial-interfaces
Version: 0.0.0

View File

@@ -0,0 +1,11 @@
setup.py
tutorial_interfaces/__init__.py
tutorial_interfaces.egg-info/PKG-INFO
tutorial_interfaces.egg-info/SOURCES.txt
tutorial_interfaces.egg-info/dependency_links.txt
tutorial_interfaces.egg-info/top_level.txt
tutorial_interfaces/msg/__init__.py
tutorial_interfaces/msg/_num.py
tutorial_interfaces/msg/_sphere.py
tutorial_interfaces/srv/__init__.py
tutorial_interfaces/srv/_add_three_ints.py

View File

@@ -0,0 +1,792 @@
// generated from rosidl_generator_py/resource/_idl_pkg_typesupport_entry_point.c.em
// generated code does not contain a copyright notice
#include <Python.h>
static PyMethodDef tutorial_interfaces__methods[] = {
{NULL, NULL, 0, NULL} /* sentinel */
};
static struct PyModuleDef tutorial_interfaces__module = {
PyModuleDef_HEAD_INIT,
"_tutorial_interfaces_support",
"_tutorial_interfaces_doc",
-1, /* -1 means that the module keeps state in global variables */
tutorial_interfaces__methods,
NULL,
NULL,
NULL,
NULL,
};
#include <stdbool.h>
#include <stdint.h>
#include "rosidl_runtime_c/visibility_control.h"
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_runtime_c/service_type_support_struct.h"
#include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/num__type_support.h"
#include "tutorial_interfaces/msg/detail/num__struct.h"
#include "tutorial_interfaces/msg/detail/num__functions.h"
static void * tutorial_interfaces__msg__num__create_ros_message(void)
{
return tutorial_interfaces__msg__Num__create();
}
static void tutorial_interfaces__msg__num__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Num * ros_message = (tutorial_interfaces__msg__Num *)raw_ros_message;
tutorial_interfaces__msg__Num__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__num__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__num__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num);
int8_t
_register_msg_type__msg__num(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__num",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__num",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__num",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__num",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__num",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/sphere__type_support.h"
#include "tutorial_interfaces/msg/detail/sphere__struct.h"
#include "tutorial_interfaces/msg/detail/sphere__functions.h"
static void * tutorial_interfaces__msg__sphere__create_ros_message(void)
{
return tutorial_interfaces__msg__Sphere__create();
}
static void tutorial_interfaces__msg__sphere__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Sphere * ros_message = (tutorial_interfaces__msg__Sphere *)raw_ros_message;
tutorial_interfaces__msg__Sphere__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__sphere__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__sphere__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere);
int8_t
_register_msg_type__msg__sphere(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__sphere",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__sphere",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__sphere",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__sphere",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__sphere",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__request__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Request__create();
}
static void tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Request * ros_message = (tutorial_interfaces__srv__AddThreeInts_Request *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Request__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__request__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request);
int8_t
_register_msg_type__srv__add_three_ints__request(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__request",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__request",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__request",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__request",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__request",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__response__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Response__create();
}
static void tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Response * ros_message = (tutorial_interfaces__srv__AddThreeInts_Response *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Response__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__response__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response);
int8_t
_register_msg_type__srv__add_three_ints__response(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__response",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__response",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__response",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__response",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__response",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__event__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Event__create();
}
static void tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Event * ros_message = (tutorial_interfaces__srv__AddThreeInts_Event *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Event__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__event__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__event__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event);
int8_t
_register_msg_type__srv__add_three_ints__event(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__event",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__event",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__event",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__event",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__event",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
ROSIDL_GENERATOR_C_IMPORT
const rosidl_service_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)();
int8_t
_register_srv_type__srv__add_three_ints(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)(),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_srv__srv__add_three_ints",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
PyMODINIT_FUNC
PyInit_tutorial_interfaces_s__rosidl_typesupport_c(void)
{
PyObject * pymodule = NULL;
pymodule = PyModule_Create(&tutorial_interfaces__module);
if (!pymodule) {
return NULL;
}
int8_t err;
err = _register_msg_type__msg__num(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__msg__sphere(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__request(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__response(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__event(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_srv_type__srv__add_three_ints(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
return pymodule;
}

View File

@@ -0,0 +1,792 @@
// generated from rosidl_generator_py/resource/_idl_pkg_typesupport_entry_point.c.em
// generated code does not contain a copyright notice
#include <Python.h>
static PyMethodDef tutorial_interfaces__methods[] = {
{NULL, NULL, 0, NULL} /* sentinel */
};
static struct PyModuleDef tutorial_interfaces__module = {
PyModuleDef_HEAD_INIT,
"_tutorial_interfaces_support",
"_tutorial_interfaces_doc",
-1, /* -1 means that the module keeps state in global variables */
tutorial_interfaces__methods,
NULL,
NULL,
NULL,
NULL,
};
#include <stdbool.h>
#include <stdint.h>
#include "rosidl_runtime_c/visibility_control.h"
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_runtime_c/service_type_support_struct.h"
#include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/num__type_support.h"
#include "tutorial_interfaces/msg/detail/num__struct.h"
#include "tutorial_interfaces/msg/detail/num__functions.h"
static void * tutorial_interfaces__msg__num__create_ros_message(void)
{
return tutorial_interfaces__msg__Num__create();
}
static void tutorial_interfaces__msg__num__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Num * ros_message = (tutorial_interfaces__msg__Num *)raw_ros_message;
tutorial_interfaces__msg__Num__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__num__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__num__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num);
int8_t
_register_msg_type__msg__num(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__num",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__num",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__num",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__num",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__num",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/sphere__type_support.h"
#include "tutorial_interfaces/msg/detail/sphere__struct.h"
#include "tutorial_interfaces/msg/detail/sphere__functions.h"
static void * tutorial_interfaces__msg__sphere__create_ros_message(void)
{
return tutorial_interfaces__msg__Sphere__create();
}
static void tutorial_interfaces__msg__sphere__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Sphere * ros_message = (tutorial_interfaces__msg__Sphere *)raw_ros_message;
tutorial_interfaces__msg__Sphere__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__sphere__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__sphere__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere);
int8_t
_register_msg_type__msg__sphere(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__sphere",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__sphere",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__sphere",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__sphere",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__sphere",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__request__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Request__create();
}
static void tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Request * ros_message = (tutorial_interfaces__srv__AddThreeInts_Request *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Request__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__request__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request);
int8_t
_register_msg_type__srv__add_three_ints__request(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__request",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__request",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__request",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__request",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__request",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__response__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Response__create();
}
static void tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Response * ros_message = (tutorial_interfaces__srv__AddThreeInts_Response *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Response__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__response__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response);
int8_t
_register_msg_type__srv__add_three_ints__response(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__response",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__response",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__response",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__response",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__response",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__event__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Event__create();
}
static void tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Event * ros_message = (tutorial_interfaces__srv__AddThreeInts_Event *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Event__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__event__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__event__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event);
int8_t
_register_msg_type__srv__add_three_ints__event(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__event",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__event",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__event",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__event",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__event",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
ROSIDL_GENERATOR_C_IMPORT
const rosidl_service_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)();
int8_t
_register_srv_type__srv__add_three_ints(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)(),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_srv__srv__add_three_ints",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
PyMODINIT_FUNC
PyInit_tutorial_interfaces_s__rosidl_typesupport_fastrtps_c(void)
{
PyObject * pymodule = NULL;
pymodule = PyModule_Create(&tutorial_interfaces__module);
if (!pymodule) {
return NULL;
}
int8_t err;
err = _register_msg_type__msg__num(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__msg__sphere(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__request(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__response(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__event(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_srv_type__srv__add_three_ints(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
return pymodule;
}

View File

@@ -0,0 +1,792 @@
// generated from rosidl_generator_py/resource/_idl_pkg_typesupport_entry_point.c.em
// generated code does not contain a copyright notice
#include <Python.h>
static PyMethodDef tutorial_interfaces__methods[] = {
{NULL, NULL, 0, NULL} /* sentinel */
};
static struct PyModuleDef tutorial_interfaces__module = {
PyModuleDef_HEAD_INIT,
"_tutorial_interfaces_support",
"_tutorial_interfaces_doc",
-1, /* -1 means that the module keeps state in global variables */
tutorial_interfaces__methods,
NULL,
NULL,
NULL,
NULL,
};
#include <stdbool.h>
#include <stdint.h>
#include "rosidl_runtime_c/visibility_control.h"
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_runtime_c/service_type_support_struct.h"
#include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/num__type_support.h"
#include "tutorial_interfaces/msg/detail/num__struct.h"
#include "tutorial_interfaces/msg/detail/num__functions.h"
static void * tutorial_interfaces__msg__num__create_ros_message(void)
{
return tutorial_interfaces__msg__Num__create();
}
static void tutorial_interfaces__msg__num__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Num * ros_message = (tutorial_interfaces__msg__Num *)raw_ros_message;
tutorial_interfaces__msg__Num__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__num__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__num__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num);
int8_t
_register_msg_type__msg__num(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__num",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__num",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__num",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__num__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__num",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Num),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__num",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/msg/detail/sphere__type_support.h"
#include "tutorial_interfaces/msg/detail/sphere__struct.h"
#include "tutorial_interfaces/msg/detail/sphere__functions.h"
static void * tutorial_interfaces__msg__sphere__create_ros_message(void)
{
return tutorial_interfaces__msg__Sphere__create();
}
static void tutorial_interfaces__msg__sphere__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__msg__Sphere * ros_message = (tutorial_interfaces__msg__Sphere *)raw_ros_message;
tutorial_interfaces__msg__Sphere__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__msg__sphere__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__msg__sphere__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere);
int8_t
_register_msg_type__msg__sphere(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__msg__sphere",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__msg__sphere",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__msg__sphere",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__msg__sphere__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__msg__sphere",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, msg, Sphere),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__msg__sphere",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__request__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Request__create();
}
static void tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Request * ros_message = (tutorial_interfaces__srv__AddThreeInts_Request *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Request__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__request__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request);
int8_t
_register_msg_type__srv__add_three_ints__request(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__request",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__request",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__request",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__request__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__request",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Request),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__request",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__response__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Response__create();
}
static void tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Response * ros_message = (tutorial_interfaces__srv__AddThreeInts_Response *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Response__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__response__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response);
int8_t
_register_msg_type__srv__add_three_ints__response(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__response",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__response",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__response",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__response__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__response",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Response),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__response",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
// already included above
// #include <stdbool.h>
// already included above
// #include <stdint.h>
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "rosidl_runtime_c/message_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/service_type_support_struct.h"
// already included above
// #include "rosidl_runtime_c/action_type_support_struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__type_support.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
static void * tutorial_interfaces__srv__add_three_ints__event__create_ros_message(void)
{
return tutorial_interfaces__srv__AddThreeInts_Event__create();
}
static void tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message(void * raw_ros_message)
{
tutorial_interfaces__srv__AddThreeInts_Event * ros_message = (tutorial_interfaces__srv__AddThreeInts_Event *)raw_ros_message;
tutorial_interfaces__srv__AddThreeInts_Event__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool tutorial_interfaces__srv__add_three_ints__event__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * tutorial_interfaces__srv__add_three_ints__event__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event);
int8_t
_register_msg_type__srv__add_three_ints__event(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__create_ros_message,
NULL, NULL);
if (!pyobject_create_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"create_ros_message_msg__srv__add_three_ints__event",
pyobject_create_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_create_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_destroy_ros_message = NULL;
pyobject_destroy_ros_message = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__destroy_ros_message,
NULL, NULL);
if (!pyobject_destroy_ros_message) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"destroy_ros_message_msg__srv__add_three_ints__event",
pyobject_destroy_ros_message);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_destroy_ros_message);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_from_py = NULL;
pyobject_convert_from_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_from_py,
NULL, NULL);
if (!pyobject_convert_from_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_from_py_msg__srv__add_three_ints__event",
pyobject_convert_from_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_from_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_convert_to_py = NULL;
pyobject_convert_to_py = PyCapsule_New(
(void *)&tutorial_interfaces__srv__add_three_ints__event__convert_to_py,
NULL, NULL);
if (!pyobject_convert_to_py) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"convert_to_py_msg__srv__add_three_ints__event",
pyobject_convert_to_py);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_convert_to_py);
// previously added objects will be removed when the module is destroyed
return err;
}
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_GET_MSG_TYPE_SUPPORT(tutorial_interfaces, srv, AddThreeInts_Event),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_msg__srv__add_three_ints__event",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
ROSIDL_GENERATOR_C_IMPORT
const rosidl_service_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)();
int8_t
_register_srv_type__srv__add_three_ints(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_type_support = NULL;
pyobject_type_support = PyCapsule_New(
(void *)ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_c, tutorial_interfaces, srv, AddThreeInts)(),
NULL, NULL);
if (!pyobject_type_support) {
// previously added objects will be removed when the module is destroyed
return -1;
}
err = PyModule_AddObject(
pymodule,
"type_support_srv__srv__add_three_ints",
pyobject_type_support);
if (err) {
// the created capsule needs to be decremented
Py_XDECREF(pyobject_type_support);
// previously added objects will be removed when the module is destroyed
return err;
}
return 0;
}
PyMODINIT_FUNC
PyInit_tutorial_interfaces_s__rosidl_typesupport_introspection_c(void)
{
PyObject * pymodule = NULL;
pymodule = PyModule_Create(&tutorial_interfaces__module);
if (!pymodule) {
return NULL;
}
int8_t err;
err = _register_msg_type__msg__num(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__msg__sphere(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__request(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__response(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__srv__add_three_ints__event(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_srv_type__srv__add_three_ints(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
return pymodule;
}

View File

@@ -0,0 +1,2 @@
from tutorial_interfaces.msg._num import Num # noqa: F401
from tutorial_interfaces.msg._sphere import Sphere # noqa: F401

View File

@@ -0,0 +1,142 @@
# generated from rosidl_generator_py/resource/_idl.py.em
# with input from tutorial_interfaces:msg/Num.idl
# generated code does not contain a copyright notice
# This is being done at the module level and not on the instance level to avoid looking
# for the same variable multiple times on each instance. This variable is not supposed to
# change during runtime so it makes sense to only look for it once.
from os import getenv
ros_python_check_fields = getenv('ROS_PYTHON_CHECK_FIELDS', default='')
# Import statements for member types
import builtins # noqa: E402, I100
import rosidl_parser.definition # noqa: E402, I100
class Metaclass_Num(type):
"""Metaclass of message 'Num'."""
_CREATE_ROS_MESSAGE = None
_CONVERT_FROM_PY = None
_CONVERT_TO_PY = None
_DESTROY_ROS_MESSAGE = None
_TYPE_SUPPORT = None
__constants = {
}
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.msg.Num')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__msg__num
cls._CONVERT_FROM_PY = module.convert_from_py_msg__msg__num
cls._CONVERT_TO_PY = module.convert_to_py_msg__msg__num
cls._TYPE_SUPPORT = module.type_support_msg__msg__num
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__msg__num
@classmethod
def __prepare__(cls, name, bases, **kwargs):
# list constant names here so that they appear in the help text of
# the message class under "Data and other attributes defined here:"
# as well as populate each message instance
return {
}
class Num(metaclass=Metaclass_Num):
"""Message class 'Num'."""
__slots__ = [
'_num',
'_check_fields',
]
_fields_and_field_types = {
'num': 'int64',
}
# This attribute is used to store an rosidl_parser.definition variable
# related to the data type of each of the components the message.
SLOT_TYPES = (
rosidl_parser.definition.BasicType('int64'), # noqa: E501
)
def __init__(self, **kwargs):
if 'check_fields' in kwargs:
self._check_fields = kwargs['check_fields']
else:
self._check_fields = ros_python_check_fields == '1'
if self._check_fields:
assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
'Invalid arguments passed to constructor: %s' % \
', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
self.num = kwargs.get('num', int())
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.get_fields_and_field_types().keys(), self.SLOT_TYPES):
field = getattr(self, s)
fieldstr = repr(field)
# We use Python array type for fields that can be directly stored
# in them, and "normal" sequences for everything else. If it is
# a type that we store in an array, strip off the 'array' portion.
if (
isinstance(t, rosidl_parser.definition.AbstractSequence) and
isinstance(t.value_type, rosidl_parser.definition.BasicType) and
t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
):
if len(field) == 0:
fieldstr = '[]'
else:
if self._check_fields:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.num != other.num:
return False
return True
@classmethod
def get_fields_and_field_types(cls):
from copy import copy
return copy(cls._fields_and_field_types)
@builtins.property
def num(self):
"""Message field 'num'."""
return self._num
@num.setter
def num(self, value):
if self._check_fields:
assert \
isinstance(value, int), \
"The 'num' field must be of type 'int'"
assert value >= -9223372036854775808 and value < 9223372036854775808, \
"The 'num' field must be an integer in [-9223372036854775808, 9223372036854775807]"
self._num = value

View File

@@ -0,0 +1,98 @@
// generated from rosidl_generator_py/resource/_idl_support.c.em
// with input from tutorial_interfaces:msg/Num.idl
// generated code does not contain a copyright notice
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#include <stdbool.h>
#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "numpy/ndarrayobject.h"
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
#include "rosidl_runtime_c/visibility_control.h"
#include "tutorial_interfaces/msg/detail/num__struct.h"
#include "tutorial_interfaces/msg/detail/num__functions.h"
ROSIDL_GENERATOR_C_EXPORT
bool tutorial_interfaces__msg__num__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[33];
{
char * class_name = NULL;
char * module_name = NULL;
{
PyObject * class_attr = PyObject_GetAttrString(_pymsg, "__class__");
if (class_attr) {
PyObject * name_attr = PyObject_GetAttrString(class_attr, "__name__");
if (name_attr) {
class_name = (char *)PyUnicode_1BYTE_DATA(name_attr);
Py_DECREF(name_attr);
}
PyObject * module_attr = PyObject_GetAttrString(class_attr, "__module__");
if (module_attr) {
module_name = (char *)PyUnicode_1BYTE_DATA(module_attr);
Py_DECREF(module_attr);
}
Py_DECREF(class_attr);
}
}
if (!class_name || !module_name) {
return false;
}
snprintf(full_classname_dest, sizeof(full_classname_dest), "%s.%s", module_name, class_name);
}
assert(strncmp("tutorial_interfaces.msg._num.Num", full_classname_dest, 32) == 0);
}
tutorial_interfaces__msg__Num * ros_message = _ros_message;
{ // num
PyObject * field = PyObject_GetAttrString(_pymsg, "num");
if (!field) {
return false;
}
assert(PyLong_Check(field));
ros_message->num = PyLong_AsLongLong(field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * tutorial_interfaces__msg__num__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of Num */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("tutorial_interfaces.msg._num");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "Num");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
tutorial_interfaces__msg__Num * ros_message = (tutorial_interfaces__msg__Num *)raw_ros_message;
{ // num
PyObject * field = NULL;
field = PyLong_FromLongLong(ros_message->num);
{
int rc = PyObject_SetAttrString(_pymessage, "num", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}

View File

@@ -0,0 +1,169 @@
# generated from rosidl_generator_py/resource/_idl.py.em
# with input from tutorial_interfaces:msg/Sphere.idl
# generated code does not contain a copyright notice
# This is being done at the module level and not on the instance level to avoid looking
# for the same variable multiple times on each instance. This variable is not supposed to
# change during runtime so it makes sense to only look for it once.
from os import getenv
ros_python_check_fields = getenv('ROS_PYTHON_CHECK_FIELDS', default='')
# Import statements for member types
import builtins # noqa: E402, I100
import math # noqa: E402, I100
import rosidl_parser.definition # noqa: E402, I100
class Metaclass_Sphere(type):
"""Metaclass of message 'Sphere'."""
_CREATE_ROS_MESSAGE = None
_CONVERT_FROM_PY = None
_CONVERT_TO_PY = None
_DESTROY_ROS_MESSAGE = None
_TYPE_SUPPORT = None
__constants = {
}
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.msg.Sphere')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__msg__sphere
cls._CONVERT_FROM_PY = module.convert_from_py_msg__msg__sphere
cls._CONVERT_TO_PY = module.convert_to_py_msg__msg__sphere
cls._TYPE_SUPPORT = module.type_support_msg__msg__sphere
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__msg__sphere
from geometry_msgs.msg import Point
if Point.__class__._TYPE_SUPPORT is None:
Point.__class__.__import_type_support__()
@classmethod
def __prepare__(cls, name, bases, **kwargs):
# list constant names here so that they appear in the help text of
# the message class under "Data and other attributes defined here:"
# as well as populate each message instance
return {
}
class Sphere(metaclass=Metaclass_Sphere):
"""Message class 'Sphere'."""
__slots__ = [
'_center',
'_radius',
'_check_fields',
]
_fields_and_field_types = {
'center': 'geometry_msgs/Point',
'radius': 'double',
}
# This attribute is used to store an rosidl_parser.definition variable
# related to the data type of each of the components the message.
SLOT_TYPES = (
rosidl_parser.definition.NamespacedType(['geometry_msgs', 'msg'], 'Point'), # noqa: E501
rosidl_parser.definition.BasicType('double'), # noqa: E501
)
def __init__(self, **kwargs):
if 'check_fields' in kwargs:
self._check_fields = kwargs['check_fields']
else:
self._check_fields = ros_python_check_fields == '1'
if self._check_fields:
assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
'Invalid arguments passed to constructor: %s' % \
', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
from geometry_msgs.msg import Point
self.center = kwargs.get('center', Point())
self.radius = kwargs.get('radius', float())
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.get_fields_and_field_types().keys(), self.SLOT_TYPES):
field = getattr(self, s)
fieldstr = repr(field)
# We use Python array type for fields that can be directly stored
# in them, and "normal" sequences for everything else. If it is
# a type that we store in an array, strip off the 'array' portion.
if (
isinstance(t, rosidl_parser.definition.AbstractSequence) and
isinstance(t.value_type, rosidl_parser.definition.BasicType) and
t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
):
if len(field) == 0:
fieldstr = '[]'
else:
if self._check_fields:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.center != other.center:
return False
if self.radius != other.radius:
return False
return True
@classmethod
def get_fields_and_field_types(cls):
from copy import copy
return copy(cls._fields_and_field_types)
@builtins.property
def center(self):
"""Message field 'center'."""
return self._center
@center.setter
def center(self, value):
if self._check_fields:
from geometry_msgs.msg import Point
assert \
isinstance(value, Point), \
"The 'center' field must be a sub message of type 'Point'"
self._center = value
@builtins.property
def radius(self):
"""Message field 'radius'."""
return self._radius
@radius.setter
def radius(self, value):
if self._check_fields:
assert \
isinstance(value, float), \
"The 'radius' field must be of type 'float'"
assert not (value < -1.7976931348623157e+308 or value > 1.7976931348623157e+308) or math.isinf(value), \
"The 'radius' field must be a double in [-1.7976931348623157e+308, 1.7976931348623157e+308]"
self._radius = value

View File

@@ -0,0 +1,127 @@
// generated from rosidl_generator_py/resource/_idl_support.c.em
// with input from tutorial_interfaces:msg/Sphere.idl
// generated code does not contain a copyright notice
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#include <stdbool.h>
#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "numpy/ndarrayobject.h"
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
#include "rosidl_runtime_c/visibility_control.h"
#include "tutorial_interfaces/msg/detail/sphere__struct.h"
#include "tutorial_interfaces/msg/detail/sphere__functions.h"
ROSIDL_GENERATOR_C_IMPORT
bool geometry_msgs__msg__point__convert_from_py(PyObject * _pymsg, void * _ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * geometry_msgs__msg__point__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_EXPORT
bool tutorial_interfaces__msg__sphere__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[39];
{
char * class_name = NULL;
char * module_name = NULL;
{
PyObject * class_attr = PyObject_GetAttrString(_pymsg, "__class__");
if (class_attr) {
PyObject * name_attr = PyObject_GetAttrString(class_attr, "__name__");
if (name_attr) {
class_name = (char *)PyUnicode_1BYTE_DATA(name_attr);
Py_DECREF(name_attr);
}
PyObject * module_attr = PyObject_GetAttrString(class_attr, "__module__");
if (module_attr) {
module_name = (char *)PyUnicode_1BYTE_DATA(module_attr);
Py_DECREF(module_attr);
}
Py_DECREF(class_attr);
}
}
if (!class_name || !module_name) {
return false;
}
snprintf(full_classname_dest, sizeof(full_classname_dest), "%s.%s", module_name, class_name);
}
assert(strncmp("tutorial_interfaces.msg._sphere.Sphere", full_classname_dest, 38) == 0);
}
tutorial_interfaces__msg__Sphere * ros_message = _ros_message;
{ // center
PyObject * field = PyObject_GetAttrString(_pymsg, "center");
if (!field) {
return false;
}
if (!geometry_msgs__msg__point__convert_from_py(field, &ros_message->center)) {
Py_DECREF(field);
return false;
}
Py_DECREF(field);
}
{ // radius
PyObject * field = PyObject_GetAttrString(_pymsg, "radius");
if (!field) {
return false;
}
assert(PyFloat_Check(field));
ros_message->radius = PyFloat_AS_DOUBLE(field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * tutorial_interfaces__msg__sphere__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of Sphere */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("tutorial_interfaces.msg._sphere");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "Sphere");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
tutorial_interfaces__msg__Sphere * ros_message = (tutorial_interfaces__msg__Sphere *)raw_ros_message;
{ // center
PyObject * field = NULL;
field = geometry_msgs__msg__point__convert_to_py(&ros_message->center);
if (!field) {
return NULL;
}
{
int rc = PyObject_SetAttrString(_pymessage, "center", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // radius
PyObject * field = NULL;
field = PyFloat_FromDouble(ros_message->radius);
{
int rc = PyObject_SetAttrString(_pymessage, "radius", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}

View File

@@ -0,0 +1,4 @@
from tutorial_interfaces.srv._add_three_ints import AddThreeInts # noqa: F401
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Event # noqa: F401
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Request # noqa: F401
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Response # noqa: F401

View File

@@ -0,0 +1,557 @@
# generated from rosidl_generator_py/resource/_idl.py.em
# with input from tutorial_interfaces:srv/AddThreeInts.idl
# generated code does not contain a copyright notice
# This is being done at the module level and not on the instance level to avoid looking
# for the same variable multiple times on each instance. This variable is not supposed to
# change during runtime so it makes sense to only look for it once.
from os import getenv
ros_python_check_fields = getenv('ROS_PYTHON_CHECK_FIELDS', default='')
# Import statements for member types
import builtins # noqa: E402, I100
import rosidl_parser.definition # noqa: E402, I100
class Metaclass_AddThreeInts_Request(type):
"""Metaclass of message 'AddThreeInts_Request'."""
_CREATE_ROS_MESSAGE = None
_CONVERT_FROM_PY = None
_CONVERT_TO_PY = None
_DESTROY_ROS_MESSAGE = None
_TYPE_SUPPORT = None
__constants = {
}
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.srv.AddThreeInts_Request')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__srv__add_three_ints__request
cls._CONVERT_FROM_PY = module.convert_from_py_msg__srv__add_three_ints__request
cls._CONVERT_TO_PY = module.convert_to_py_msg__srv__add_three_ints__request
cls._TYPE_SUPPORT = module.type_support_msg__srv__add_three_ints__request
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__srv__add_three_ints__request
@classmethod
def __prepare__(cls, name, bases, **kwargs):
# list constant names here so that they appear in the help text of
# the message class under "Data and other attributes defined here:"
# as well as populate each message instance
return {
}
class AddThreeInts_Request(metaclass=Metaclass_AddThreeInts_Request):
"""Message class 'AddThreeInts_Request'."""
__slots__ = [
'_a',
'_b',
'_c',
'_check_fields',
]
_fields_and_field_types = {
'a': 'int64',
'b': 'int64',
'c': 'int64',
}
# This attribute is used to store an rosidl_parser.definition variable
# related to the data type of each of the components the message.
SLOT_TYPES = (
rosidl_parser.definition.BasicType('int64'), # noqa: E501
rosidl_parser.definition.BasicType('int64'), # noqa: E501
rosidl_parser.definition.BasicType('int64'), # noqa: E501
)
def __init__(self, **kwargs):
if 'check_fields' in kwargs:
self._check_fields = kwargs['check_fields']
else:
self._check_fields = ros_python_check_fields == '1'
if self._check_fields:
assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
'Invalid arguments passed to constructor: %s' % \
', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
self.a = kwargs.get('a', int())
self.b = kwargs.get('b', int())
self.c = kwargs.get('c', int())
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.get_fields_and_field_types().keys(), self.SLOT_TYPES):
field = getattr(self, s)
fieldstr = repr(field)
# We use Python array type for fields that can be directly stored
# in them, and "normal" sequences for everything else. If it is
# a type that we store in an array, strip off the 'array' portion.
if (
isinstance(t, rosidl_parser.definition.AbstractSequence) and
isinstance(t.value_type, rosidl_parser.definition.BasicType) and
t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
):
if len(field) == 0:
fieldstr = '[]'
else:
if self._check_fields:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.a != other.a:
return False
if self.b != other.b:
return False
if self.c != other.c:
return False
return True
@classmethod
def get_fields_and_field_types(cls):
from copy import copy
return copy(cls._fields_and_field_types)
@builtins.property
def a(self):
"""Message field 'a'."""
return self._a
@a.setter
def a(self, value):
if self._check_fields:
assert \
isinstance(value, int), \
"The 'a' field must be of type 'int'"
assert value >= -9223372036854775808 and value < 9223372036854775808, \
"The 'a' field must be an integer in [-9223372036854775808, 9223372036854775807]"
self._a = value
@builtins.property
def b(self):
"""Message field 'b'."""
return self._b
@b.setter
def b(self, value):
if self._check_fields:
assert \
isinstance(value, int), \
"The 'b' field must be of type 'int'"
assert value >= -9223372036854775808 and value < 9223372036854775808, \
"The 'b' field must be an integer in [-9223372036854775808, 9223372036854775807]"
self._b = value
@builtins.property
def c(self):
"""Message field 'c'."""
return self._c
@c.setter
def c(self, value):
if self._check_fields:
assert \
isinstance(value, int), \
"The 'c' field must be of type 'int'"
assert value >= -9223372036854775808 and value < 9223372036854775808, \
"The 'c' field must be an integer in [-9223372036854775808, 9223372036854775807]"
self._c = value
# Import statements for member types
# already imported above
# import builtins
# already imported above
# import rosidl_parser.definition
class Metaclass_AddThreeInts_Response(type):
"""Metaclass of message 'AddThreeInts_Response'."""
_CREATE_ROS_MESSAGE = None
_CONVERT_FROM_PY = None
_CONVERT_TO_PY = None
_DESTROY_ROS_MESSAGE = None
_TYPE_SUPPORT = None
__constants = {
}
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.srv.AddThreeInts_Response')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__srv__add_three_ints__response
cls._CONVERT_FROM_PY = module.convert_from_py_msg__srv__add_three_ints__response
cls._CONVERT_TO_PY = module.convert_to_py_msg__srv__add_three_ints__response
cls._TYPE_SUPPORT = module.type_support_msg__srv__add_three_ints__response
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__srv__add_three_ints__response
@classmethod
def __prepare__(cls, name, bases, **kwargs):
# list constant names here so that they appear in the help text of
# the message class under "Data and other attributes defined here:"
# as well as populate each message instance
return {
}
class AddThreeInts_Response(metaclass=Metaclass_AddThreeInts_Response):
"""Message class 'AddThreeInts_Response'."""
__slots__ = [
'_sum',
'_check_fields',
]
_fields_and_field_types = {
'sum': 'int64',
}
# This attribute is used to store an rosidl_parser.definition variable
# related to the data type of each of the components the message.
SLOT_TYPES = (
rosidl_parser.definition.BasicType('int64'), # noqa: E501
)
def __init__(self, **kwargs):
if 'check_fields' in kwargs:
self._check_fields = kwargs['check_fields']
else:
self._check_fields = ros_python_check_fields == '1'
if self._check_fields:
assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
'Invalid arguments passed to constructor: %s' % \
', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
self.sum = kwargs.get('sum', int())
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.get_fields_and_field_types().keys(), self.SLOT_TYPES):
field = getattr(self, s)
fieldstr = repr(field)
# We use Python array type for fields that can be directly stored
# in them, and "normal" sequences for everything else. If it is
# a type that we store in an array, strip off the 'array' portion.
if (
isinstance(t, rosidl_parser.definition.AbstractSequence) and
isinstance(t.value_type, rosidl_parser.definition.BasicType) and
t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
):
if len(field) == 0:
fieldstr = '[]'
else:
if self._check_fields:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.sum != other.sum:
return False
return True
@classmethod
def get_fields_and_field_types(cls):
from copy import copy
return copy(cls._fields_and_field_types)
@builtins.property # noqa: A003
def sum(self): # noqa: A003
"""Message field 'sum'."""
return self._sum
@sum.setter # noqa: A003
def sum(self, value): # noqa: A003
if self._check_fields:
assert \
isinstance(value, int), \
"The 'sum' field must be of type 'int'"
assert value >= -9223372036854775808 and value < 9223372036854775808, \
"The 'sum' field must be an integer in [-9223372036854775808, 9223372036854775807]"
self._sum = value
# Import statements for member types
# already imported above
# import builtins
# already imported above
# import rosidl_parser.definition
class Metaclass_AddThreeInts_Event(type):
"""Metaclass of message 'AddThreeInts_Event'."""
_CREATE_ROS_MESSAGE = None
_CONVERT_FROM_PY = None
_CONVERT_TO_PY = None
_DESTROY_ROS_MESSAGE = None
_TYPE_SUPPORT = None
__constants = {
}
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.srv.AddThreeInts_Event')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._CREATE_ROS_MESSAGE = module.create_ros_message_msg__srv__add_three_ints__event
cls._CONVERT_FROM_PY = module.convert_from_py_msg__srv__add_three_ints__event
cls._CONVERT_TO_PY = module.convert_to_py_msg__srv__add_three_ints__event
cls._TYPE_SUPPORT = module.type_support_msg__srv__add_three_ints__event
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__srv__add_three_ints__event
from service_msgs.msg import ServiceEventInfo
if ServiceEventInfo.__class__._TYPE_SUPPORT is None:
ServiceEventInfo.__class__.__import_type_support__()
@classmethod
def __prepare__(cls, name, bases, **kwargs):
# list constant names here so that they appear in the help text of
# the message class under "Data and other attributes defined here:"
# as well as populate each message instance
return {
}
class AddThreeInts_Event(metaclass=Metaclass_AddThreeInts_Event):
"""Message class 'AddThreeInts_Event'."""
__slots__ = [
'_info',
'_request',
'_response',
'_check_fields',
]
_fields_and_field_types = {
'info': 'service_msgs/ServiceEventInfo',
'request': 'sequence<tutorial_interfaces/AddThreeInts_Request, 1>',
'response': 'sequence<tutorial_interfaces/AddThreeInts_Response, 1>',
}
# This attribute is used to store an rosidl_parser.definition variable
# related to the data type of each of the components the message.
SLOT_TYPES = (
rosidl_parser.definition.NamespacedType(['service_msgs', 'msg'], 'ServiceEventInfo'), # noqa: E501
rosidl_parser.definition.BoundedSequence(rosidl_parser.definition.NamespacedType(['tutorial_interfaces', 'srv'], 'AddThreeInts_Request'), 1), # noqa: E501
rosidl_parser.definition.BoundedSequence(rosidl_parser.definition.NamespacedType(['tutorial_interfaces', 'srv'], 'AddThreeInts_Response'), 1), # noqa: E501
)
def __init__(self, **kwargs):
if 'check_fields' in kwargs:
self._check_fields = kwargs['check_fields']
else:
self._check_fields = ros_python_check_fields == '1'
if self._check_fields:
assert all('_' + key in self.__slots__ for key in kwargs.keys()), \
'Invalid arguments passed to constructor: %s' % \
', '.join(sorted(k for k in kwargs.keys() if '_' + k not in self.__slots__))
from service_msgs.msg import ServiceEventInfo
self.info = kwargs.get('info', ServiceEventInfo())
self.request = kwargs.get('request', [])
self.response = kwargs.get('response', [])
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.get_fields_and_field_types().keys(), self.SLOT_TYPES):
field = getattr(self, s)
fieldstr = repr(field)
# We use Python array type for fields that can be directly stored
# in them, and "normal" sequences for everything else. If it is
# a type that we store in an array, strip off the 'array' portion.
if (
isinstance(t, rosidl_parser.definition.AbstractSequence) and
isinstance(t.value_type, rosidl_parser.definition.BasicType) and
t.value_type.typename in ['float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
):
if len(field) == 0:
fieldstr = '[]'
else:
if self._check_fields:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.info != other.info:
return False
if self.request != other.request:
return False
if self.response != other.response:
return False
return True
@classmethod
def get_fields_and_field_types(cls):
from copy import copy
return copy(cls._fields_and_field_types)
@builtins.property
def info(self):
"""Message field 'info'."""
return self._info
@info.setter
def info(self, value):
if self._check_fields:
from service_msgs.msg import ServiceEventInfo
assert \
isinstance(value, ServiceEventInfo), \
"The 'info' field must be a sub message of type 'ServiceEventInfo'"
self._info = value
@builtins.property
def request(self):
"""Message field 'request'."""
return self._request
@request.setter
def request(self, value):
if self._check_fields:
from tutorial_interfaces.srv import AddThreeInts_Request
from collections.abc import Sequence
from collections.abc import Set
from collections import UserList
from collections import UserString
assert \
((isinstance(value, Sequence) or
isinstance(value, Set) or
isinstance(value, UserList)) and
not isinstance(value, str) and
not isinstance(value, UserString) and
len(value) <= 1 and
all(isinstance(v, AddThreeInts_Request) for v in value) and
True), \
"The 'request' field must be a set or sequence with length <= 1 and each value of type 'AddThreeInts_Request'"
self._request = value
@builtins.property
def response(self):
"""Message field 'response'."""
return self._response
@response.setter
def response(self, value):
if self._check_fields:
from tutorial_interfaces.srv import AddThreeInts_Response
from collections.abc import Sequence
from collections.abc import Set
from collections import UserList
from collections import UserString
assert \
((isinstance(value, Sequence) or
isinstance(value, Set) or
isinstance(value, UserList)) and
not isinstance(value, str) and
not isinstance(value, UserString) and
len(value) <= 1 and
all(isinstance(v, AddThreeInts_Response) for v in value) and
True), \
"The 'response' field must be a set or sequence with length <= 1 and each value of type 'AddThreeInts_Response'"
self._response = value
class Metaclass_AddThreeInts(type):
"""Metaclass of service 'AddThreeInts'."""
_TYPE_SUPPORT = None
@classmethod
def __import_type_support__(cls):
try:
from rosidl_generator_py import import_type_support
module = import_type_support('tutorial_interfaces')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'tutorial_interfaces.srv.AddThreeInts')
logger.debug(
'Failed to import needed modules for type support:\n' +
traceback.format_exc())
else:
cls._TYPE_SUPPORT = module.type_support_srv__srv__add_three_ints
from tutorial_interfaces.srv import _add_three_ints
if _add_three_ints.Metaclass_AddThreeInts_Request._TYPE_SUPPORT is None:
_add_three_ints.Metaclass_AddThreeInts_Request.__import_type_support__()
if _add_three_ints.Metaclass_AddThreeInts_Response._TYPE_SUPPORT is None:
_add_three_ints.Metaclass_AddThreeInts_Response.__import_type_support__()
if _add_three_ints.Metaclass_AddThreeInts_Event._TYPE_SUPPORT is None:
_add_three_ints.Metaclass_AddThreeInts_Event.__import_type_support__()
class AddThreeInts(metaclass=Metaclass_AddThreeInts):
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Request as Request
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Response as Response
from tutorial_interfaces.srv._add_three_ints import AddThreeInts_Event as Event
def __init__(self):
raise NotImplementedError('Service classes can not be instantiated')

View File

@@ -0,0 +1,470 @@
// generated from rosidl_generator_py/resource/_idl_support.c.em
// with input from tutorial_interfaces:srv/AddThreeInts.idl
// generated code does not contain a copyright notice
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#include <stdbool.h>
#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "numpy/ndarrayobject.h"
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
#include "rosidl_runtime_c/visibility_control.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
#include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
ROSIDL_GENERATOR_C_EXPORT
bool tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[61];
{
char * class_name = NULL;
char * module_name = NULL;
{
PyObject * class_attr = PyObject_GetAttrString(_pymsg, "__class__");
if (class_attr) {
PyObject * name_attr = PyObject_GetAttrString(class_attr, "__name__");
if (name_attr) {
class_name = (char *)PyUnicode_1BYTE_DATA(name_attr);
Py_DECREF(name_attr);
}
PyObject * module_attr = PyObject_GetAttrString(class_attr, "__module__");
if (module_attr) {
module_name = (char *)PyUnicode_1BYTE_DATA(module_attr);
Py_DECREF(module_attr);
}
Py_DECREF(class_attr);
}
}
if (!class_name || !module_name) {
return false;
}
snprintf(full_classname_dest, sizeof(full_classname_dest), "%s.%s", module_name, class_name);
}
assert(strncmp("tutorial_interfaces.srv._add_three_ints.AddThreeInts_Request", full_classname_dest, 60) == 0);
}
tutorial_interfaces__srv__AddThreeInts_Request * ros_message = _ros_message;
{ // a
PyObject * field = PyObject_GetAttrString(_pymsg, "a");
if (!field) {
return false;
}
assert(PyLong_Check(field));
ros_message->a = PyLong_AsLongLong(field);
Py_DECREF(field);
}
{ // b
PyObject * field = PyObject_GetAttrString(_pymsg, "b");
if (!field) {
return false;
}
assert(PyLong_Check(field));
ros_message->b = PyLong_AsLongLong(field);
Py_DECREF(field);
}
{ // c
PyObject * field = PyObject_GetAttrString(_pymsg, "c");
if (!field) {
return false;
}
assert(PyLong_Check(field));
ros_message->c = PyLong_AsLongLong(field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * tutorial_interfaces__srv__add_three_ints__request__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of AddThreeInts_Request */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("tutorial_interfaces.srv._add_three_ints");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "AddThreeInts_Request");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
tutorial_interfaces__srv__AddThreeInts_Request * ros_message = (tutorial_interfaces__srv__AddThreeInts_Request *)raw_ros_message;
{ // a
PyObject * field = NULL;
field = PyLong_FromLongLong(ros_message->a);
{
int rc = PyObject_SetAttrString(_pymessage, "a", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // b
PyObject * field = NULL;
field = PyLong_FromLongLong(ros_message->b);
{
int rc = PyObject_SetAttrString(_pymessage, "b", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // c
PyObject * field = NULL;
field = PyLong_FromLongLong(ros_message->c);
{
int rc = PyObject_SetAttrString(_pymessage, "c", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
// already included above
// #include <Python.h>
// already included above
// #include <stdbool.h>
// already included above
// #include "numpy/ndarrayobject.h"
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
ROSIDL_GENERATOR_C_EXPORT
bool tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[62];
{
char * class_name = NULL;
char * module_name = NULL;
{
PyObject * class_attr = PyObject_GetAttrString(_pymsg, "__class__");
if (class_attr) {
PyObject * name_attr = PyObject_GetAttrString(class_attr, "__name__");
if (name_attr) {
class_name = (char *)PyUnicode_1BYTE_DATA(name_attr);
Py_DECREF(name_attr);
}
PyObject * module_attr = PyObject_GetAttrString(class_attr, "__module__");
if (module_attr) {
module_name = (char *)PyUnicode_1BYTE_DATA(module_attr);
Py_DECREF(module_attr);
}
Py_DECREF(class_attr);
}
}
if (!class_name || !module_name) {
return false;
}
snprintf(full_classname_dest, sizeof(full_classname_dest), "%s.%s", module_name, class_name);
}
assert(strncmp("tutorial_interfaces.srv._add_three_ints.AddThreeInts_Response", full_classname_dest, 61) == 0);
}
tutorial_interfaces__srv__AddThreeInts_Response * ros_message = _ros_message;
{ // sum
PyObject * field = PyObject_GetAttrString(_pymsg, "sum");
if (!field) {
return false;
}
assert(PyLong_Check(field));
ros_message->sum = PyLong_AsLongLong(field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * tutorial_interfaces__srv__add_three_ints__response__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of AddThreeInts_Response */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("tutorial_interfaces.srv._add_three_ints");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "AddThreeInts_Response");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
tutorial_interfaces__srv__AddThreeInts_Response * ros_message = (tutorial_interfaces__srv__AddThreeInts_Response *)raw_ros_message;
{ // sum
PyObject * field = NULL;
field = PyLong_FromLongLong(ros_message->sum);
{
int rc = PyObject_SetAttrString(_pymessage, "sum", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
// already included above
// #include <Python.h>
// already included above
// #include <stdbool.h>
// already included above
// #include "numpy/ndarrayobject.h"
// already included above
// #include "rosidl_runtime_c/visibility_control.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__struct.h"
// already included above
// #include "tutorial_interfaces/srv/detail/add_three_ints__functions.h"
#include "rosidl_runtime_c/primitives_sequence.h"
#include "rosidl_runtime_c/primitives_sequence_functions.h"
// Nested array functions includes
// end nested array functions include
ROSIDL_GENERATOR_C_IMPORT
bool service_msgs__msg__service_event_info__convert_from_py(PyObject * _pymsg, void * _ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * service_msgs__msg__service_event_info__convert_to_py(void * raw_ros_message);
bool tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PyObject * _pymsg, void * _ros_message);
PyObject * tutorial_interfaces__srv__add_three_ints__request__convert_to_py(void * raw_ros_message);
bool tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PyObject * _pymsg, void * _ros_message);
PyObject * tutorial_interfaces__srv__add_three_ints__response__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_EXPORT
bool tutorial_interfaces__srv__add_three_ints__event__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[59];
{
char * class_name = NULL;
char * module_name = NULL;
{
PyObject * class_attr = PyObject_GetAttrString(_pymsg, "__class__");
if (class_attr) {
PyObject * name_attr = PyObject_GetAttrString(class_attr, "__name__");
if (name_attr) {
class_name = (char *)PyUnicode_1BYTE_DATA(name_attr);
Py_DECREF(name_attr);
}
PyObject * module_attr = PyObject_GetAttrString(class_attr, "__module__");
if (module_attr) {
module_name = (char *)PyUnicode_1BYTE_DATA(module_attr);
Py_DECREF(module_attr);
}
Py_DECREF(class_attr);
}
}
if (!class_name || !module_name) {
return false;
}
snprintf(full_classname_dest, sizeof(full_classname_dest), "%s.%s", module_name, class_name);
}
assert(strncmp("tutorial_interfaces.srv._add_three_ints.AddThreeInts_Event", full_classname_dest, 58) == 0);
}
tutorial_interfaces__srv__AddThreeInts_Event * ros_message = _ros_message;
{ // info
PyObject * field = PyObject_GetAttrString(_pymsg, "info");
if (!field) {
return false;
}
if (!service_msgs__msg__service_event_info__convert_from_py(field, &ros_message->info)) {
Py_DECREF(field);
return false;
}
Py_DECREF(field);
}
{ // request
PyObject * field = PyObject_GetAttrString(_pymsg, "request");
if (!field) {
return false;
}
PyObject * seq_field = PySequence_Fast(field, "expected a sequence in 'request'");
if (!seq_field) {
Py_DECREF(field);
return false;
}
Py_ssize_t size = PySequence_Size(field);
if (-1 == size) {
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
if (!tutorial_interfaces__srv__AddThreeInts_Request__Sequence__init(&(ros_message->request), size)) {
PyErr_SetString(PyExc_RuntimeError, "unable to create tutorial_interfaces__srv__AddThreeInts_Request__Sequence ros_message");
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
tutorial_interfaces__srv__AddThreeInts_Request * dest = ros_message->request.data;
for (Py_ssize_t i = 0; i < size; ++i) {
if (!tutorial_interfaces__srv__add_three_ints__request__convert_from_py(PySequence_Fast_GET_ITEM(seq_field, i), &dest[i])) {
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
}
Py_DECREF(seq_field);
Py_DECREF(field);
}
{ // response
PyObject * field = PyObject_GetAttrString(_pymsg, "response");
if (!field) {
return false;
}
PyObject * seq_field = PySequence_Fast(field, "expected a sequence in 'response'");
if (!seq_field) {
Py_DECREF(field);
return false;
}
Py_ssize_t size = PySequence_Size(field);
if (-1 == size) {
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
if (!tutorial_interfaces__srv__AddThreeInts_Response__Sequence__init(&(ros_message->response), size)) {
PyErr_SetString(PyExc_RuntimeError, "unable to create tutorial_interfaces__srv__AddThreeInts_Response__Sequence ros_message");
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
tutorial_interfaces__srv__AddThreeInts_Response * dest = ros_message->response.data;
for (Py_ssize_t i = 0; i < size; ++i) {
if (!tutorial_interfaces__srv__add_three_ints__response__convert_from_py(PySequence_Fast_GET_ITEM(seq_field, i), &dest[i])) {
Py_DECREF(seq_field);
Py_DECREF(field);
return false;
}
}
Py_DECREF(seq_field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * tutorial_interfaces__srv__add_three_ints__event__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of AddThreeInts_Event */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("tutorial_interfaces.srv._add_three_ints");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "AddThreeInts_Event");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
tutorial_interfaces__srv__AddThreeInts_Event * ros_message = (tutorial_interfaces__srv__AddThreeInts_Event *)raw_ros_message;
{ // info
PyObject * field = NULL;
field = service_msgs__msg__service_event_info__convert_to_py(&ros_message->info);
if (!field) {
return NULL;
}
{
int rc = PyObject_SetAttrString(_pymessage, "info", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // request
PyObject * field = NULL;
size_t size = ros_message->request.size;
field = PyList_New(size);
if (!field) {
return NULL;
}
tutorial_interfaces__srv__AddThreeInts_Request * item;
for (size_t i = 0; i < size; ++i) {
item = &(ros_message->request.data[i]);
PyObject * pyitem = tutorial_interfaces__srv__add_three_ints__request__convert_to_py(item);
if (!pyitem) {
Py_DECREF(field);
return NULL;
}
int rc = PyList_SetItem(field, i, pyitem);
(void)rc;
assert(rc == 0);
}
assert(PySequence_Check(field));
{
int rc = PyObject_SetAttrString(_pymessage, "request", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // response
PyObject * field = NULL;
size_t size = ros_message->response.size;
field = PyList_New(size);
if (!field) {
return NULL;
}
tutorial_interfaces__srv__AddThreeInts_Response * item;
for (size_t i = 0; i < size; ++i) {
item = &(ros_message->response.data[i]);
PyObject * pyitem = tutorial_interfaces__srv__add_three_ints__response__convert_to_py(item);
if (!pyitem) {
Py_DECREF(field);
return NULL;
}
int rc = PyList_SetItem(field, i, pyitem);
(void)rc;
assert(rc == 0);
}
assert(PySequence_Check(field));
{
int rc = PyObject_SetAttrString(_pymessage, "response", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}