机器人项目完成

This commit is contained in:
2026-02-19 16:21:36 +08:00
parent 357934af9b
commit 5384cdb6ff
532 changed files with 70884 additions and 459 deletions

View File

@@ -21,9 +21,6 @@ _colcon_prefix_chain_bash_source_script() {
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
COLCON_CURRENT_PREFIX="/opt/ros/humble"
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
COLCON_CURRENT_PREFIX="/home/quella/ROS2_WS/protocol_ws/cpp_prococol/install"
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
# source this prefix
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script

View File

@@ -23,7 +23,6 @@ function _colcon_prefix_chain_powershell_source_script {
# source chained prefixes
_colcon_prefix_chain_powershell_source_script "/opt/ros/humble\local_setup.ps1"
_colcon_prefix_chain_powershell_source_script "/home/quella/ROS2_WS/protocol_ws/cpp_prococol/install\local_setup.ps1"
# source this prefix
$env:COLCON_CURRENT_PREFIX=(Split-Path $PSCommandPath -Parent)

View File

@@ -34,10 +34,6 @@ _colcon_prefix_chain_sh_source_script() {
COLCON_CURRENT_PREFIX="/opt/ros/humble"
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script
COLCON_CURRENT_PREFIX="/home/quella/ROS2_WS/protocol_ws/cpp_prococol/install"
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
# source this prefix
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script

View File

@@ -21,9 +21,6 @@ _colcon_prefix_chain_zsh_source_script() {
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
COLCON_CURRENT_PREFIX="/opt/ros/humble"
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
COLCON_CURRENT_PREFIX="/home/quella/ROS2_WS/protocol_ws/cpp_prococol/install"
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
# source this prefix
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script

View File

@@ -0,0 +1,72 @@
// generated from rosidl_generator_cpp/resource/idl__builder.hpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__BUILDER_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__BUILDER_HPP_
#include <algorithm>
#include <utility>
#include "virtual_robot_prococol/msg/detail/robot_command__struct.hpp"
#include "rosidl_runtime_cpp/message_initialization.hpp"
namespace virtual_robot_prococol
{
namespace msg
{
namespace builder
{
class Init_RobotCommand_speed_y
{
public:
explicit Init_RobotCommand_speed_y(::virtual_robot_prococol::msg::RobotCommand & msg)
: msg_(msg)
{}
::virtual_robot_prococol::msg::RobotCommand speed_y(::virtual_robot_prococol::msg::RobotCommand::_speed_y_type arg)
{
msg_.speed_y = std::move(arg);
return std::move(msg_);
}
private:
::virtual_robot_prococol::msg::RobotCommand msg_;
};
class Init_RobotCommand_speed_x
{
public:
Init_RobotCommand_speed_x()
: msg_(::rosidl_runtime_cpp::MessageInitialization::SKIP)
{}
Init_RobotCommand_speed_y speed_x(::virtual_robot_prococol::msg::RobotCommand::_speed_x_type arg)
{
msg_.speed_x = std::move(arg);
return Init_RobotCommand_speed_y(msg_);
}
private:
::virtual_robot_prococol::msg::RobotCommand msg_;
};
} // namespace builder
} // namespace msg
template<typename MessageType>
auto build();
template<>
inline
auto build<::virtual_robot_prococol::msg::RobotCommand>()
{
return virtual_robot_prococol::msg::builder::Init_RobotCommand_speed_x();
}
} // namespace virtual_robot_prococol
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__BUILDER_HPP_

View File

@@ -0,0 +1,244 @@
// generated from rosidl_generator_c/resource/idl__functions.c.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "rcutils/allocator.h"
bool
virtual_robot_prococol__msg__RobotCommand__init(virtual_robot_prococol__msg__RobotCommand * msg)
{
if (!msg) {
return false;
}
// speed_x
// speed_y
return true;
}
void
virtual_robot_prococol__msg__RobotCommand__fini(virtual_robot_prococol__msg__RobotCommand * msg)
{
if (!msg) {
return;
}
// speed_x
// speed_y
}
bool
virtual_robot_prococol__msg__RobotCommand__are_equal(const virtual_robot_prococol__msg__RobotCommand * lhs, const virtual_robot_prococol__msg__RobotCommand * rhs)
{
if (!lhs || !rhs) {
return false;
}
// speed_x
if (lhs->speed_x != rhs->speed_x) {
return false;
}
// speed_y
if (lhs->speed_y != rhs->speed_y) {
return false;
}
return true;
}
bool
virtual_robot_prococol__msg__RobotCommand__copy(
const virtual_robot_prococol__msg__RobotCommand * input,
virtual_robot_prococol__msg__RobotCommand * output)
{
if (!input || !output) {
return false;
}
// speed_x
output->speed_x = input->speed_x;
// speed_y
output->speed_y = input->speed_y;
return true;
}
virtual_robot_prococol__msg__RobotCommand *
virtual_robot_prococol__msg__RobotCommand__create()
{
rcutils_allocator_t allocator = rcutils_get_default_allocator();
virtual_robot_prococol__msg__RobotCommand * msg = (virtual_robot_prococol__msg__RobotCommand *)allocator.allocate(sizeof(virtual_robot_prococol__msg__RobotCommand), allocator.state);
if (!msg) {
return NULL;
}
memset(msg, 0, sizeof(virtual_robot_prococol__msg__RobotCommand));
bool success = virtual_robot_prococol__msg__RobotCommand__init(msg);
if (!success) {
allocator.deallocate(msg, allocator.state);
return NULL;
}
return msg;
}
void
virtual_robot_prococol__msg__RobotCommand__destroy(virtual_robot_prococol__msg__RobotCommand * msg)
{
rcutils_allocator_t allocator = rcutils_get_default_allocator();
if (msg) {
virtual_robot_prococol__msg__RobotCommand__fini(msg);
}
allocator.deallocate(msg, allocator.state);
}
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__init(virtual_robot_prococol__msg__RobotCommand__Sequence * array, size_t size)
{
if (!array) {
return false;
}
rcutils_allocator_t allocator = rcutils_get_default_allocator();
virtual_robot_prococol__msg__RobotCommand * data = NULL;
if (size) {
data = (virtual_robot_prococol__msg__RobotCommand *)allocator.zero_allocate(size, sizeof(virtual_robot_prococol__msg__RobotCommand), allocator.state);
if (!data) {
return false;
}
// initialize all array elements
size_t i;
for (i = 0; i < size; ++i) {
bool success = virtual_robot_prococol__msg__RobotCommand__init(&data[i]);
if (!success) {
break;
}
}
if (i < size) {
// if initialization failed finalize the already initialized array elements
for (; i > 0; --i) {
virtual_robot_prococol__msg__RobotCommand__fini(&data[i - 1]);
}
allocator.deallocate(data, allocator.state);
return false;
}
}
array->data = data;
array->size = size;
array->capacity = size;
return true;
}
void
virtual_robot_prococol__msg__RobotCommand__Sequence__fini(virtual_robot_prococol__msg__RobotCommand__Sequence * array)
{
if (!array) {
return;
}
rcutils_allocator_t allocator = rcutils_get_default_allocator();
if (array->data) {
// ensure that data and capacity values are consistent
assert(array->capacity > 0);
// finalize all array elements
for (size_t i = 0; i < array->capacity; ++i) {
virtual_robot_prococol__msg__RobotCommand__fini(&array->data[i]);
}
allocator.deallocate(array->data, allocator.state);
array->data = NULL;
array->size = 0;
array->capacity = 0;
} else {
// ensure that data, size, and capacity values are consistent
assert(0 == array->size);
assert(0 == array->capacity);
}
}
virtual_robot_prococol__msg__RobotCommand__Sequence *
virtual_robot_prococol__msg__RobotCommand__Sequence__create(size_t size)
{
rcutils_allocator_t allocator = rcutils_get_default_allocator();
virtual_robot_prococol__msg__RobotCommand__Sequence * array = (virtual_robot_prococol__msg__RobotCommand__Sequence *)allocator.allocate(sizeof(virtual_robot_prococol__msg__RobotCommand__Sequence), allocator.state);
if (!array) {
return NULL;
}
bool success = virtual_robot_prococol__msg__RobotCommand__Sequence__init(array, size);
if (!success) {
allocator.deallocate(array, allocator.state);
return NULL;
}
return array;
}
void
virtual_robot_prococol__msg__RobotCommand__Sequence__destroy(virtual_robot_prococol__msg__RobotCommand__Sequence * array)
{
rcutils_allocator_t allocator = rcutils_get_default_allocator();
if (array) {
virtual_robot_prococol__msg__RobotCommand__Sequence__fini(array);
}
allocator.deallocate(array, allocator.state);
}
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__are_equal(const virtual_robot_prococol__msg__RobotCommand__Sequence * lhs, const virtual_robot_prococol__msg__RobotCommand__Sequence * rhs)
{
if (!lhs || !rhs) {
return false;
}
if (lhs->size != rhs->size) {
return false;
}
for (size_t i = 0; i < lhs->size; ++i) {
if (!virtual_robot_prococol__msg__RobotCommand__are_equal(&(lhs->data[i]), &(rhs->data[i]))) {
return false;
}
}
return true;
}
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__copy(
const virtual_robot_prococol__msg__RobotCommand__Sequence * input,
virtual_robot_prococol__msg__RobotCommand__Sequence * output)
{
if (!input || !output) {
return false;
}
if (output->capacity < input->size) {
const size_t allocation_size =
input->size * sizeof(virtual_robot_prococol__msg__RobotCommand);
rcutils_allocator_t allocator = rcutils_get_default_allocator();
virtual_robot_prococol__msg__RobotCommand * data =
(virtual_robot_prococol__msg__RobotCommand *)allocator.reallocate(
output->data, allocation_size, allocator.state);
if (!data) {
return false;
}
// If reallocation succeeded, memory may or may not have been moved
// to fulfill the allocation request, invalidating output->data.
output->data = data;
for (size_t i = output->capacity; i < input->size; ++i) {
if (!virtual_robot_prococol__msg__RobotCommand__init(&output->data[i])) {
// If initialization of any new item fails, roll back
// all previously initialized items. Existing items
// in output are to be left unmodified.
for (; i-- > output->capacity; ) {
virtual_robot_prococol__msg__RobotCommand__fini(&output->data[i]);
}
return false;
}
}
output->capacity = input->size;
}
output->size = input->size;
for (size_t i = 0; i < input->size; ++i) {
if (!virtual_robot_prococol__msg__RobotCommand__copy(
&(input->data[i]), &(output->data[i])))
{
return false;
}
}
return true;
}

View File

@@ -0,0 +1,177 @@
// generated from rosidl_generator_c/resource/idl__functions.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__FUNCTIONS_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__FUNCTIONS_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include <stdlib.h>
#include "rosidl_runtime_c/visibility_control.h"
#include "virtual_robot_prococol/msg/rosidl_generator_c__visibility_control.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
/// Initialize msg/RobotCommand message.
/**
* If the init function is called twice for the same message without
* calling fini inbetween previously allocated memory will be leaked.
* \param[in,out] msg The previously allocated message pointer.
* Fields without a default value will not be initialized by this function.
* You might want to call memset(msg, 0, sizeof(
* virtual_robot_prococol__msg__RobotCommand
* )) before or use
* virtual_robot_prococol__msg__RobotCommand__create()
* to allocate and initialize the message.
* \return true if initialization was successful, otherwise false
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__init(virtual_robot_prococol__msg__RobotCommand * msg);
/// Finalize msg/RobotCommand message.
/**
* \param[in,out] msg The allocated message pointer.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
void
virtual_robot_prococol__msg__RobotCommand__fini(virtual_robot_prococol__msg__RobotCommand * msg);
/// Create msg/RobotCommand message.
/**
* It allocates the memory for the message, sets the memory to zero, and
* calls
* virtual_robot_prococol__msg__RobotCommand__init().
* \return The pointer to the initialized message if successful,
* otherwise NULL
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
virtual_robot_prococol__msg__RobotCommand *
virtual_robot_prococol__msg__RobotCommand__create();
/// Destroy msg/RobotCommand message.
/**
* It calls
* virtual_robot_prococol__msg__RobotCommand__fini()
* and frees the memory of the message.
* \param[in,out] msg The allocated message pointer.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
void
virtual_robot_prococol__msg__RobotCommand__destroy(virtual_robot_prococol__msg__RobotCommand * msg);
/// Check for msg/RobotCommand message equality.
/**
* \param[in] lhs The message on the left hand size of the equality operator.
* \param[in] rhs The message on the right hand size of the equality operator.
* \return true if messages are equal, otherwise false.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__are_equal(const virtual_robot_prococol__msg__RobotCommand * lhs, const virtual_robot_prococol__msg__RobotCommand * rhs);
/// Copy a msg/RobotCommand message.
/**
* This functions performs a deep copy, as opposed to the shallow copy that
* plain assignment yields.
*
* \param[in] input The source message pointer.
* \param[out] output The target message pointer, which must
* have been initialized before calling this function.
* \return true if successful, or false if either pointer is null
* or memory allocation fails.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__copy(
const virtual_robot_prococol__msg__RobotCommand * input,
virtual_robot_prococol__msg__RobotCommand * output);
/// Initialize array of msg/RobotCommand messages.
/**
* It allocates the memory for the number of elements and calls
* virtual_robot_prococol__msg__RobotCommand__init()
* for each element of the array.
* \param[in,out] array The allocated array pointer.
* \param[in] size The size / capacity of the array.
* \return true if initialization was successful, otherwise false
* If the array pointer is valid and the size is zero it is guaranteed
# to return true.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__init(virtual_robot_prococol__msg__RobotCommand__Sequence * array, size_t size);
/// Finalize array of msg/RobotCommand messages.
/**
* It calls
* virtual_robot_prococol__msg__RobotCommand__fini()
* for each element of the array and frees the memory for the number of
* elements.
* \param[in,out] array The initialized array pointer.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
void
virtual_robot_prococol__msg__RobotCommand__Sequence__fini(virtual_robot_prococol__msg__RobotCommand__Sequence * array);
/// Create array of msg/RobotCommand messages.
/**
* It allocates the memory for the array and calls
* virtual_robot_prococol__msg__RobotCommand__Sequence__init().
* \param[in] size The size / capacity of the array.
* \return The pointer to the initialized array if successful, otherwise NULL
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
virtual_robot_prococol__msg__RobotCommand__Sequence *
virtual_robot_prococol__msg__RobotCommand__Sequence__create(size_t size);
/// Destroy array of msg/RobotCommand messages.
/**
* It calls
* virtual_robot_prococol__msg__RobotCommand__Sequence__fini()
* on the array,
* and frees the memory of the array.
* \param[in,out] array The initialized array pointer.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
void
virtual_robot_prococol__msg__RobotCommand__Sequence__destroy(virtual_robot_prococol__msg__RobotCommand__Sequence * array);
/// Check for msg/RobotCommand message array equality.
/**
* \param[in] lhs The message array on the left hand size of the equality operator.
* \param[in] rhs The message array on the right hand size of the equality operator.
* \return true if message arrays are equal in size and content, otherwise false.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__are_equal(const virtual_robot_prococol__msg__RobotCommand__Sequence * lhs, const virtual_robot_prococol__msg__RobotCommand__Sequence * rhs);
/// Copy an array of msg/RobotCommand messages.
/**
* This functions performs a deep copy, as opposed to the shallow copy that
* plain assignment yields.
*
* \param[in] input The source array pointer.
* \param[out] output The target array pointer, which must
* have been initialized before calling this function.
* \return true if successful, or false if either pointer
* is null or memory allocation fails.
*/
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
bool
virtual_robot_prococol__msg__RobotCommand__Sequence__copy(
const virtual_robot_prococol__msg__RobotCommand__Sequence * input,
virtual_robot_prococol__msg__RobotCommand__Sequence * output);
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__FUNCTIONS_H_

View File

@@ -0,0 +1,37 @@
// generated from rosidl_typesupport_fastrtps_c/resource/idl__rosidl_typesupport_fastrtps_c.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_C_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_C_H_
#include <stddef.h>
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/rosidl_typesupport_fastrtps_c__visibility_control.h"
#ifdef __cplusplus
extern "C"
{
#endif
ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_virtual_robot_prococol
size_t get_serialized_size_virtual_robot_prococol__msg__RobotCommand(
const void * untyped_ros_message,
size_t current_alignment);
ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_virtual_robot_prococol
size_t max_serialized_size_virtual_robot_prococol__msg__RobotCommand(
bool & full_bounded,
bool & is_plain,
size_t current_alignment);
ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_c, virtual_robot_prococol, msg, RobotCommand)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_C_H_

View File

@@ -0,0 +1,80 @@
// generated from rosidl_typesupport_fastrtps_cpp/resource/idl__rosidl_typesupport_fastrtps_cpp.hpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_CPP_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_CPP_HPP_
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/rosidl_typesupport_fastrtps_cpp__visibility_control.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.hpp"
#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# ifdef __clang__
# pragma clang diagnostic ignored "-Wdeprecated-register"
# pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
# endif
#endif
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
#include "fastcdr/Cdr.h"
namespace virtual_robot_prococol
{
namespace msg
{
namespace typesupport_fastrtps_cpp
{
bool
ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_virtual_robot_prococol
cdr_serialize(
const virtual_robot_prococol::msg::RobotCommand & ros_message,
eprosima::fastcdr::Cdr & cdr);
bool
ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_virtual_robot_prococol
cdr_deserialize(
eprosima::fastcdr::Cdr & cdr,
virtual_robot_prococol::msg::RobotCommand & ros_message);
size_t
ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_virtual_robot_prococol
get_serialized_size(
const virtual_robot_prococol::msg::RobotCommand & ros_message,
size_t current_alignment);
size_t
ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_virtual_robot_prococol
max_serialized_size_RobotCommand(
bool & full_bounded,
bool & is_plain,
size_t current_alignment);
} // namespace typesupport_fastrtps_cpp
} // namespace msg
} // namespace virtual_robot_prococol
#ifdef __cplusplus
extern "C"
{
#endif
ROSIDL_TYPESUPPORT_FASTRTPS_CPP_PUBLIC_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_cpp, virtual_robot_prococol, msg, RobotCommand)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_FASTRTPS_CPP_HPP_

View File

@@ -0,0 +1,26 @@
// generated from rosidl_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/rosidl_typesupport_introspection_c__visibility_control.h"
ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, virtual_robot_prococol, msg, RobotCommand)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_

View File

@@ -0,0 +1,27 @@
// generated from rosidl_typesupport_introspection_cpp/resource/idl__rosidl_typesupport_introspection_cpp.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_HPP_
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_typesupport_interface/macros.h"
#include "rosidl_typesupport_introspection_cpp/visibility_control.h"
#ifdef __cplusplus
extern "C"
{
#endif
// TODO(dirk-thomas) these visibility macros should be message package specific
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_cpp, virtual_robot_prococol, msg, RobotCommand)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_HPP_

View File

@@ -0,0 +1,45 @@
// NOLINT: This file starts with a BOM since it contain non-ASCII characters
// generated from rosidl_generator_c/resource/idl__struct.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// Constants defined in the message
/// Struct defined in msg/RobotCommand in the package virtual_robot_prococol.
/**
* 速度参数
*/
typedef struct virtual_robot_prococol__msg__RobotCommand
{
float speed_x;
float speed_y;
} virtual_robot_prococol__msg__RobotCommand;
// Struct for a sequence of virtual_robot_prococol__msg__RobotCommand.
typedef struct virtual_robot_prococol__msg__RobotCommand__Sequence
{
virtual_robot_prococol__msg__RobotCommand * data;
/// The number of valid items in data
size_t size;
/// The number of allocated items in data
size_t capacity;
} virtual_robot_prococol__msg__RobotCommand__Sequence;
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_H_

View File

@@ -0,0 +1,146 @@
// generated from rosidl_generator_cpp/resource/idl__struct.hpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_HPP_
#include <algorithm>
#include <array>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include "rosidl_runtime_cpp/bounded_vector.hpp"
#include "rosidl_runtime_cpp/message_initialization.hpp"
#ifndef _WIN32
# define DEPRECATED__virtual_robot_prococol__msg__RobotCommand __attribute__((deprecated))
#else
# define DEPRECATED__virtual_robot_prococol__msg__RobotCommand __declspec(deprecated)
#endif
namespace virtual_robot_prococol
{
namespace msg
{
// message struct
template<class ContainerAllocator>
struct RobotCommand_
{
using Type = RobotCommand_<ContainerAllocator>;
explicit RobotCommand_(rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL)
{
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::ZERO == _init)
{
this->speed_x = 0.0f;
this->speed_y = 0.0f;
}
}
explicit RobotCommand_(const ContainerAllocator & _alloc, rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL)
{
(void)_alloc;
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::ZERO == _init)
{
this->speed_x = 0.0f;
this->speed_y = 0.0f;
}
}
// field types and members
using _speed_x_type =
float;
_speed_x_type speed_x;
using _speed_y_type =
float;
_speed_y_type speed_y;
// setters for named parameter idiom
Type & set__speed_x(
const float & _arg)
{
this->speed_x = _arg;
return *this;
}
Type & set__speed_y(
const float & _arg)
{
this->speed_y = _arg;
return *this;
}
// constant declarations
// pointer types
using RawPtr =
virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> *;
using ConstRawPtr =
const virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> *;
using SharedPtr =
std::shared_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>>;
using ConstSharedPtr =
std::shared_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> const>;
template<typename Deleter = std::default_delete<
virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>>>
using UniquePtrWithDeleter =
std::unique_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>, Deleter>;
using UniquePtr = UniquePtrWithDeleter<>;
template<typename Deleter = std::default_delete<
virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>>>
using ConstUniquePtrWithDeleter =
std::unique_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> const, Deleter>;
using ConstUniquePtr = ConstUniquePtrWithDeleter<>;
using WeakPtr =
std::weak_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>>;
using ConstWeakPtr =
std::weak_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> const>;
// pointer types similar to ROS 1, use SharedPtr / ConstSharedPtr instead
// NOTE: Can't use 'using' here because GNU C++ can't parse attributes properly
typedef DEPRECATED__virtual_robot_prococol__msg__RobotCommand
std::shared_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator>>
Ptr;
typedef DEPRECATED__virtual_robot_prococol__msg__RobotCommand
std::shared_ptr<virtual_robot_prococol::msg::RobotCommand_<ContainerAllocator> const>
ConstPtr;
// comparison operators
bool operator==(const RobotCommand_ & other) const
{
if (this->speed_x != other.speed_x) {
return false;
}
if (this->speed_y != other.speed_y) {
return false;
}
return true;
}
bool operator!=(const RobotCommand_ & other) const
{
return !this->operator==(other);
}
}; // struct RobotCommand_
// alias to use template instance with default allocator
using RobotCommand =
virtual_robot_prococol::msg::RobotCommand_<std::allocator<void>>;
// constant definitions
} // namespace msg
} // namespace virtual_robot_prococol
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__STRUCT_HPP_

View File

@@ -0,0 +1,126 @@
// generated from rosidl_generator_cpp/resource/idl__traits.hpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TRAITS_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TRAITS_HPP_
#include <stdint.h>
#include <sstream>
#include <string>
#include <type_traits>
#include "virtual_robot_prococol/msg/detail/robot_command__struct.hpp"
#include "rosidl_runtime_cpp/traits.hpp"
namespace virtual_robot_prococol
{
namespace msg
{
inline void to_flow_style_yaml(
const RobotCommand & msg,
std::ostream & out)
{
out << "{";
// member: speed_x
{
out << "speed_x: ";
rosidl_generator_traits::value_to_yaml(msg.speed_x, out);
out << ", ";
}
// member: speed_y
{
out << "speed_y: ";
rosidl_generator_traits::value_to_yaml(msg.speed_y, out);
}
out << "}";
} // NOLINT(readability/fn_size)
inline void to_block_style_yaml(
const RobotCommand & msg,
std::ostream & out, size_t indentation = 0)
{
// member: speed_x
{
if (indentation > 0) {
out << std::string(indentation, ' ');
}
out << "speed_x: ";
rosidl_generator_traits::value_to_yaml(msg.speed_x, out);
out << "\n";
}
// member: speed_y
{
if (indentation > 0) {
out << std::string(indentation, ' ');
}
out << "speed_y: ";
rosidl_generator_traits::value_to_yaml(msg.speed_y, out);
out << "\n";
}
} // NOLINT(readability/fn_size)
inline std::string to_yaml(const RobotCommand & msg, bool use_flow_style = false)
{
std::ostringstream out;
if (use_flow_style) {
to_flow_style_yaml(msg, out);
} else {
to_block_style_yaml(msg, out);
}
return out.str();
}
} // namespace msg
} // namespace virtual_robot_prococol
namespace rosidl_generator_traits
{
[[deprecated("use virtual_robot_prococol::msg::to_block_style_yaml() instead")]]
inline void to_yaml(
const virtual_robot_prococol::msg::RobotCommand & msg,
std::ostream & out, size_t indentation = 0)
{
virtual_robot_prococol::msg::to_block_style_yaml(msg, out, indentation);
}
[[deprecated("use virtual_robot_prococol::msg::to_yaml() instead")]]
inline std::string to_yaml(const virtual_robot_prococol::msg::RobotCommand & msg)
{
return virtual_robot_prococol::msg::to_yaml(msg);
}
template<>
inline const char * data_type<virtual_robot_prococol::msg::RobotCommand>()
{
return "virtual_robot_prococol::msg::RobotCommand";
}
template<>
inline const char * name<virtual_robot_prococol::msg::RobotCommand>()
{
return "virtual_robot_prococol/msg/RobotCommand";
}
template<>
struct has_fixed_size<virtual_robot_prococol::msg::RobotCommand>
: std::integral_constant<bool, true> {};
template<>
struct has_bounded_size<virtual_robot_prococol::msg::RobotCommand>
: std::integral_constant<bool, true> {};
template<>
struct is_message<virtual_robot_prococol::msg::RobotCommand>
: std::true_type {};
} // namespace rosidl_generator_traits
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TRAITS_HPP_

View File

@@ -0,0 +1,100 @@
// generated from rosidl_typesupport_introspection_c/resource/idl__type_support.c.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#include <stddef.h>
#include "virtual_robot_prococol/msg/detail/robot_command__rosidl_typesupport_introspection_c.h"
#include "virtual_robot_prococol/msg/rosidl_typesupport_introspection_c__visibility_control.h"
#include "rosidl_typesupport_introspection_c/field_types.h"
#include "rosidl_typesupport_introspection_c/identifier.h"
#include "rosidl_typesupport_introspection_c/message_introspection.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#ifdef __cplusplus
extern "C"
{
#endif
void virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_init_function(
void * message_memory, enum rosidl_runtime_c__message_initialization _init)
{
// TODO(karsten1987): initializers are not yet implemented for typesupport c
// see https://github.com/ros2/ros2/issues/397
(void) _init;
virtual_robot_prococol__msg__RobotCommand__init(message_memory);
}
void virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_fini_function(void * message_memory)
{
virtual_robot_prococol__msg__RobotCommand__fini(message_memory);
}
static rosidl_typesupport_introspection_c__MessageMember virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_member_array[2] = {
{
"speed_x", // name
rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT, // type
0, // upper bound of string
NULL, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol__msg__RobotCommand, speed_x), // bytes offset in struct
NULL, // default value
NULL, // size() function pointer
NULL, // get_const(index) function pointer
NULL, // get(index) function pointer
NULL, // fetch(index, &value) function pointer
NULL, // assign(index, value) function pointer
NULL // resize(index) function pointer
},
{
"speed_y", // name
rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT, // type
0, // upper bound of string
NULL, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol__msg__RobotCommand, speed_y), // bytes offset in struct
NULL, // default value
NULL, // size() function pointer
NULL, // get_const(index) function pointer
NULL, // get(index) function pointer
NULL, // fetch(index, &value) function pointer
NULL, // assign(index, value) function pointer
NULL // resize(index) function pointer
}
};
static const rosidl_typesupport_introspection_c__MessageMembers virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_members = {
"virtual_robot_prococol__msg", // message namespace
"RobotCommand", // message name
2, // number of fields
sizeof(virtual_robot_prococol__msg__RobotCommand),
virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_member_array, // message members
virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_init_function, // function to initialize message memory (memory has to be allocated)
virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_fini_function // function to terminate message instance (will not free memory)
};
// this is not const since it must be initialized on first access
// since C does not allow non-integral compile-time constants
static rosidl_message_type_support_t virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_type_support_handle = {
0,
&virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_members,
get_message_typesupport_handle_function,
};
ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, virtual_robot_prococol, msg, RobotCommand)() {
if (!virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_type_support_handle.typesupport_identifier) {
virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_type_support_handle.typesupport_identifier =
rosidl_typesupport_introspection_c__identifier;
}
return &virtual_robot_prococol__msg__RobotCommand__rosidl_typesupport_introspection_c__RobotCommand_message_type_support_handle;
}
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,126 @@
// generated from rosidl_typesupport_introspection_cpp/resource/idl__type_support.cpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#include "array"
#include "cstddef"
#include "string"
#include "vector"
#include "rosidl_runtime_c/message_type_support_struct.h"
#include "rosidl_typesupport_cpp/message_type_support.hpp"
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/message_type_support_decl.hpp"
#include "rosidl_typesupport_introspection_cpp/visibility_control.h"
namespace virtual_robot_prococol
{
namespace msg
{
namespace rosidl_typesupport_introspection_cpp
{
void RobotCommand_init_function(
void * message_memory, rosidl_runtime_cpp::MessageInitialization _init)
{
new (message_memory) virtual_robot_prococol::msg::RobotCommand(_init);
}
void RobotCommand_fini_function(void * message_memory)
{
auto typed_message = static_cast<virtual_robot_prococol::msg::RobotCommand *>(message_memory);
typed_message->~RobotCommand();
}
static const ::rosidl_typesupport_introspection_cpp::MessageMember RobotCommand_message_member_array[2] = {
{
"speed_x", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_FLOAT, // type
0, // upper bound of string
nullptr, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol::msg::RobotCommand, speed_x), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr, // fetch(index, &value) function pointer
nullptr, // assign(index, value) function pointer
nullptr // resize(index) function pointer
},
{
"speed_y", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_FLOAT, // type
0, // upper bound of string
nullptr, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol::msg::RobotCommand, speed_y), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr, // fetch(index, &value) function pointer
nullptr, // assign(index, value) function pointer
nullptr // resize(index) function pointer
}
};
static const ::rosidl_typesupport_introspection_cpp::MessageMembers RobotCommand_message_members = {
"virtual_robot_prococol::msg", // message namespace
"RobotCommand", // message name
2, // number of fields
sizeof(virtual_robot_prococol::msg::RobotCommand),
RobotCommand_message_member_array, // message members
RobotCommand_init_function, // function to initialize message memory (memory has to be allocated)
RobotCommand_fini_function // function to terminate message instance (will not free memory)
};
static const rosidl_message_type_support_t RobotCommand_message_type_support_handle = {
::rosidl_typesupport_introspection_cpp::typesupport_identifier,
&RobotCommand_message_members,
get_message_typesupport_handle_function,
};
} // namespace rosidl_typesupport_introspection_cpp
} // namespace msg
} // namespace virtual_robot_prococol
namespace rosidl_typesupport_introspection_cpp
{
template<>
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t *
get_message_type_support_handle<virtual_robot_prococol::msg::RobotCommand>()
{
return &::virtual_robot_prococol::msg::rosidl_typesupport_introspection_cpp::RobotCommand_message_type_support_handle;
}
} // namespace rosidl_typesupport_introspection_cpp
#ifdef __cplusplus
extern "C"
{
#endif
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_cpp, virtual_robot_prococol, msg, RobotCommand)() {
return &::virtual_robot_prococol::msg::rosidl_typesupport_introspection_cpp::RobotCommand_message_type_support_handle;
}
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,33 @@
// generated from rosidl_generator_c/resource/idl__type_support.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_H_
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/rosidl_generator_c__visibility_control.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "rosidl_runtime_c/message_type_support_struct.h"
// Forward declare the get type support functions for this type.
ROSIDL_GENERATOR_C_PUBLIC_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
rosidl_typesupport_c,
virtual_robot_prococol,
msg,
RobotCommand
)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_H_

View File

@@ -0,0 +1,31 @@
// generated from rosidl_generator_cpp/resource/idl__type_support.hpp.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_HPP_
#include "rosidl_typesupport_interface/macros.h"
#include "virtual_robot_prococol/msg/rosidl_generator_cpp__visibility_control.hpp"
#include "rosidl_typesupport_cpp/message_type_support.hpp"
#ifdef __cplusplus
extern "C"
{
#endif
// Forward declare the get type support functions for this type.
ROSIDL_GENERATOR_CPP_PUBLIC_virtual_robot_prococol
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
rosidl_typesupport_cpp,
virtual_robot_prococol,
msg,
RobotCommand
)();
#ifdef __cplusplus
}
#endif
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__DETAIL__ROBOT_COMMAND__TYPE_SUPPORT_HPP_

View File

@@ -21,16 +21,32 @@ namespace msg
namespace builder
{
class Init_RobotStatus_now_time
{
public:
explicit Init_RobotStatus_now_time(::virtual_robot_prococol::msg::RobotStatus & msg)
: msg_(msg)
{}
::virtual_robot_prococol::msg::RobotStatus now_time(::virtual_robot_prococol::msg::RobotStatus::_now_time_type arg)
{
msg_.now_time = std::move(arg);
return std::move(msg_);
}
private:
::virtual_robot_prococol::msg::RobotStatus msg_;
};
class Init_RobotStatus_speed_y
{
public:
explicit Init_RobotStatus_speed_y(::virtual_robot_prococol::msg::RobotStatus & msg)
: msg_(msg)
{}
::virtual_robot_prococol::msg::RobotStatus speed_y(::virtual_robot_prococol::msg::RobotStatus::_speed_y_type arg)
Init_RobotStatus_now_time speed_y(::virtual_robot_prococol::msg::RobotStatus::_speed_y_type arg)
{
msg_.speed_y = std::move(arg);
return std::move(msg_);
return Init_RobotStatus_now_time(msg_);
}
private:

View File

@@ -11,6 +11,10 @@
#include "rcutils/allocator.h"
// Include directives for member types
// Member `now_time`
#include "rosidl_runtime_c/string_functions.h"
bool
virtual_robot_prococol__msg__RobotStatus__init(virtual_robot_prococol__msg__RobotStatus * msg)
{
@@ -21,6 +25,11 @@ virtual_robot_prococol__msg__RobotStatus__init(virtual_robot_prococol__msg__Robo
// pos_y
// speed_x
// speed_y
// now_time
if (!rosidl_runtime_c__String__init(&msg->now_time)) {
virtual_robot_prococol__msg__RobotStatus__fini(msg);
return false;
}
return true;
}
@@ -34,6 +43,8 @@ virtual_robot_prococol__msg__RobotStatus__fini(virtual_robot_prococol__msg__Robo
// pos_y
// speed_x
// speed_y
// now_time
rosidl_runtime_c__String__fini(&msg->now_time);
}
bool
@@ -58,6 +69,12 @@ virtual_robot_prococol__msg__RobotStatus__are_equal(const virtual_robot_prococol
if (lhs->speed_y != rhs->speed_y) {
return false;
}
// now_time
if (!rosidl_runtime_c__String__are_equal(
&(lhs->now_time), &(rhs->now_time)))
{
return false;
}
return true;
}
@@ -77,6 +94,12 @@ virtual_robot_prococol__msg__RobotStatus__copy(
output->speed_x = input->speed_x;
// speed_y
output->speed_y = input->speed_y;
// now_time
if (!rosidl_runtime_c__String__copy(
&(input->now_time), &(output->now_time)))
{
return false;
}
return true;
}

View File

@@ -18,6 +18,10 @@ extern "C"
// Constants defined in the message
// Include directives for member types
// Member 'now_time'
#include "rosidl_runtime_c/string.h"
/// Struct defined in msg/RobotStatus in the package virtual_robot_prococol.
/**
* 位置坐标
@@ -29,6 +33,8 @@ typedef struct virtual_robot_prococol__msg__RobotStatus
/// 速度参数
float speed_x;
float speed_y;
/// 时间戳
rosidl_runtime_c__String now_time;
} virtual_robot_prococol__msg__RobotStatus;
// Struct for a sequence of virtual_robot_prococol__msg__RobotStatus.

View File

@@ -43,12 +43,13 @@ struct RobotStatus_
this->pos_y = 0.0f;
this->speed_x = 0.0f;
this->speed_y = 0.0f;
this->now_time = "";
}
}
explicit RobotStatus_(const ContainerAllocator & _alloc, rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL)
: now_time(_alloc)
{
(void)_alloc;
if (rosidl_runtime_cpp::MessageInitialization::ALL == _init ||
rosidl_runtime_cpp::MessageInitialization::ZERO == _init)
{
@@ -56,6 +57,7 @@ struct RobotStatus_
this->pos_y = 0.0f;
this->speed_x = 0.0f;
this->speed_y = 0.0f;
this->now_time = "";
}
}
@@ -72,6 +74,9 @@ struct RobotStatus_
using _speed_y_type =
float;
_speed_y_type speed_y;
using _now_time_type =
std::basic_string<char, std::char_traits<char>, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<char>>;
_now_time_type now_time;
// setters for named parameter idiom
Type & set__pos_x(
@@ -98,6 +103,12 @@ struct RobotStatus_
this->speed_y = _arg;
return *this;
}
Type & set__now_time(
const std::basic_string<char, std::char_traits<char>, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<char>> & _arg)
{
this->now_time = _arg;
return *this;
}
// constant declarations
@@ -153,6 +164,9 @@ struct RobotStatus_
if (this->speed_y != other.speed_y) {
return false;
}
if (this->now_time != other.now_time) {
return false;
}
return true;
}
bool operator!=(const RobotStatus_ & other) const

View File

@@ -50,6 +50,13 @@ inline void to_flow_style_yaml(
{
out << "speed_y: ";
rosidl_generator_traits::value_to_yaml(msg.speed_y, out);
out << ", ";
}
// member: now_time
{
out << "now_time: ";
rosidl_generator_traits::value_to_yaml(msg.now_time, out);
}
out << "}";
} // NOLINT(readability/fn_size)
@@ -97,6 +104,16 @@ inline void to_block_style_yaml(
rosidl_generator_traits::value_to_yaml(msg.speed_y, out);
out << "\n";
}
// member: now_time
{
if (indentation > 0) {
out << std::string(indentation, ' ');
}
out << "now_time: ";
rosidl_generator_traits::value_to_yaml(msg.now_time, out);
out << "\n";
}
} // NOLINT(readability/fn_size)
inline std::string to_yaml(const RobotStatus & msg, bool use_flow_style = false)
@@ -145,11 +162,11 @@ inline const char * name<virtual_robot_prococol::msg::RobotStatus>()
template<>
struct has_fixed_size<virtual_robot_prococol::msg::RobotStatus>
: std::integral_constant<bool, true> {};
: std::integral_constant<bool, false> {};
template<>
struct has_bounded_size<virtual_robot_prococol::msg::RobotStatus>
: std::integral_constant<bool, true> {};
: std::integral_constant<bool, false> {};
template<>
struct is_message<virtual_robot_prococol::msg::RobotStatus>

View File

@@ -12,6 +12,10 @@
#include "virtual_robot_prococol/msg/detail/robot_status__struct.h"
// Include directives for member types
// Member `now_time`
#include "rosidl_runtime_c/string_functions.h"
#ifdef __cplusplus
extern "C"
{
@@ -31,7 +35,7 @@ void virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_
virtual_robot_prococol__msg__RobotStatus__fini(message_memory);
}
static rosidl_typesupport_introspection_c__MessageMember virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_c__RobotStatus_message_member_array[4] = {
static rosidl_typesupport_introspection_c__MessageMember virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_c__RobotStatus_message_member_array[5] = {
{
"pos_x", // name
rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT, // type
@@ -99,13 +103,30 @@ static rosidl_typesupport_introspection_c__MessageMember virtual_robot_prococol_
NULL, // fetch(index, &value) function pointer
NULL, // assign(index, value) function pointer
NULL // resize(index) function pointer
},
{
"now_time", // name
rosidl_typesupport_introspection_c__ROS_TYPE_STRING, // type
0, // upper bound of string
NULL, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol__msg__RobotStatus, now_time), // bytes offset in struct
NULL, // default value
NULL, // size() function pointer
NULL, // get_const(index) function pointer
NULL, // get(index) function pointer
NULL, // fetch(index, &value) function pointer
NULL, // assign(index, value) function pointer
NULL // resize(index) function pointer
}
};
static const rosidl_typesupport_introspection_c__MessageMembers virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_c__RobotStatus_message_members = {
"virtual_robot_prococol__msg", // message namespace
"RobotStatus", // message name
4, // number of fields
5, // number of fields
sizeof(virtual_robot_prococol__msg__RobotStatus),
virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_c__RobotStatus_message_member_array, // message members
virtual_robot_prococol__msg__RobotStatus__rosidl_typesupport_introspection_c__RobotStatus_init_function, // function to initialize message memory (memory has to be allocated)

View File

@@ -37,7 +37,7 @@ void RobotStatus_fini_function(void * message_memory)
typed_message->~RobotStatus();
}
static const ::rosidl_typesupport_introspection_cpp::MessageMember RobotStatus_message_member_array[4] = {
static const ::rosidl_typesupport_introspection_cpp::MessageMember RobotStatus_message_member_array[5] = {
{
"pos_x", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_FLOAT, // type
@@ -105,13 +105,30 @@ static const ::rosidl_typesupport_introspection_cpp::MessageMember RobotStatus_m
nullptr, // fetch(index, &value) function pointer
nullptr, // assign(index, value) function pointer
nullptr // resize(index) function pointer
},
{
"now_time", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_STRING, // type
0, // upper bound of string
nullptr, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(virtual_robot_prococol::msg::RobotStatus, now_time), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr, // fetch(index, &value) function pointer
nullptr, // assign(index, value) function pointer
nullptr // resize(index) function pointer
}
};
static const ::rosidl_typesupport_introspection_cpp::MessageMembers RobotStatus_message_members = {
"virtual_robot_prococol::msg", // message namespace
"RobotStatus", // message name
4, // number of fields
5, // number of fields
sizeof(virtual_robot_prococol::msg::RobotStatus),
RobotStatus_message_member_array, // message members
RobotStatus_init_function, // function to initialize message memory (memory has to be allocated)

View File

@@ -0,0 +1,12 @@
// generated from rosidl_generator_c/resource/idl.h.em
// with input from virtual_robot_prococol:msg/RobotCommand.idl
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_H_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_H_
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
#include "virtual_robot_prococol/msg/detail/robot_command__type_support.h"
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_H_

View File

@@ -0,0 +1,12 @@
// generated from rosidl_generator_cpp/resource/idl.hpp.em
// generated code does not contain a copyright notice
#ifndef VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_HPP_
#define VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_HPP_
#include "virtual_robot_prococol/msg/detail/robot_command__struct.hpp"
#include "virtual_robot_prococol/msg/detail/robot_command__builder.hpp"
#include "virtual_robot_prococol/msg/detail/robot_command__traits.hpp"
#include "virtual_robot_prococol/msg/detail/robot_command__type_support.hpp"
#endif // VIRTUAL_ROBOT_PROCOCOL__MSG__ROBOT_COMMAND_HPP_

View File

@@ -3,4 +3,9 @@ virtual_robot_prococol/__init__.py
virtual_robot_prococol.egg-info/PKG-INFO
virtual_robot_prococol.egg-info/SOURCES.txt
virtual_robot_prococol.egg-info/dependency_links.txt
virtual_robot_prococol.egg-info/top_level.txt
virtual_robot_prococol.egg-info/top_level.txt
virtual_robot_prococol/action/__init__.py
virtual_robot_prococol/action/_target_position.py
virtual_robot_prococol/msg/__init__.py
virtual_robot_prococol/msg/_robot_command.py
virtual_robot_prococol/msg/_robot_status.py

View File

@@ -151,6 +151,145 @@ _register_msg_type__msg__robot_status(PyObject * pymodule)
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 "virtual_robot_prococol/msg/detail/robot_command__type_support.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
static void * virtual_robot_prococol__msg__robot_command__create_ros_message(void)
{
return virtual_robot_prococol__msg__RobotCommand__create();
}
static void virtual_robot_prococol__msg__robot_command__destroy_ros_message(void * raw_ros_message)
{
virtual_robot_prococol__msg__RobotCommand * ros_message = (virtual_robot_prococol__msg__RobotCommand *)raw_ros_message;
virtual_robot_prococol__msg__RobotCommand__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool virtual_robot_prococol__msg__robot_command__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * virtual_robot_prococol__msg__robot_command__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(virtual_robot_prococol, msg, RobotCommand);
int8_t
_register_msg_type__msg__robot_command(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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(virtual_robot_prococol, msg, RobotCommand),
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__robot_command",
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
@@ -1384,6 +1523,12 @@ PyInit_virtual_robot_prococol_s__rosidl_typesupport_c(void)
return NULL;
}
err = _register_msg_type__msg__robot_command(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__action__target_position__goal(pymodule);
if (err) {
Py_XDECREF(pymodule);

View File

@@ -151,6 +151,145 @@ _register_msg_type__msg__robot_status(PyObject * pymodule)
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 "virtual_robot_prococol/msg/detail/robot_command__type_support.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
static void * virtual_robot_prococol__msg__robot_command__create_ros_message(void)
{
return virtual_robot_prococol__msg__RobotCommand__create();
}
static void virtual_robot_prococol__msg__robot_command__destroy_ros_message(void * raw_ros_message)
{
virtual_robot_prococol__msg__RobotCommand * ros_message = (virtual_robot_prococol__msg__RobotCommand *)raw_ros_message;
virtual_robot_prococol__msg__RobotCommand__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool virtual_robot_prococol__msg__robot_command__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * virtual_robot_prococol__msg__robot_command__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(virtual_robot_prococol, msg, RobotCommand);
int8_t
_register_msg_type__msg__robot_command(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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(virtual_robot_prococol, msg, RobotCommand),
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__robot_command",
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
@@ -1384,6 +1523,12 @@ PyInit_virtual_robot_prococol_s__rosidl_typesupport_fastrtps_c(void)
return NULL;
}
err = _register_msg_type__msg__robot_command(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__action__target_position__goal(pymodule);
if (err) {
Py_XDECREF(pymodule);

View File

@@ -151,6 +151,145 @@ _register_msg_type__msg__robot_status(PyObject * pymodule)
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 "virtual_robot_prococol/msg/detail/robot_command__type_support.h"
#include "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
static void * virtual_robot_prococol__msg__robot_command__create_ros_message(void)
{
return virtual_robot_prococol__msg__RobotCommand__create();
}
static void virtual_robot_prococol__msg__robot_command__destroy_ros_message(void * raw_ros_message)
{
virtual_robot_prococol__msg__RobotCommand * ros_message = (virtual_robot_prococol__msg__RobotCommand *)raw_ros_message;
virtual_robot_prococol__msg__RobotCommand__destroy(ros_message);
}
ROSIDL_GENERATOR_C_IMPORT
bool virtual_robot_prococol__msg__robot_command__convert_from_py(PyObject * _pymsg, void * ros_message);
ROSIDL_GENERATOR_C_IMPORT
PyObject * virtual_robot_prococol__msg__robot_command__convert_to_py(void * raw_ros_message);
ROSIDL_GENERATOR_C_IMPORT
const rosidl_message_type_support_t *
ROSIDL_GET_MSG_TYPE_SUPPORT(virtual_robot_prococol, msg, RobotCommand);
int8_t
_register_msg_type__msg__robot_command(PyObject * pymodule)
{
int8_t err;
PyObject * pyobject_create_ros_message = NULL;
pyobject_create_ros_message = PyCapsule_New(
(void *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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 *)&virtual_robot_prococol__msg__robot_command__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__robot_command",
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(virtual_robot_prococol, msg, RobotCommand),
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__robot_command",
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
@@ -1384,6 +1523,12 @@ PyInit_virtual_robot_prococol_s__rosidl_typesupport_introspection_c(void)
return NULL;
}
err = _register_msg_type__msg__robot_command(pymodule);
if (err) {
Py_XDECREF(pymodule);
return NULL;
}
err = _register_msg_type__action__target_position__goal(pymodule);
if (err) {
Py_XDECREF(pymodule);

View File

@@ -1 +1,2 @@
from virtual_robot_prococol.msg._robot_command import RobotCommand # noqa: F401
from virtual_robot_prococol.msg._robot_status import RobotStatus # noqa: F401

View File

@@ -0,0 +1,149 @@
# generated from rosidl_generator_py/resource/_idl.py.em
# with input from virtual_robot_prococol:msg/RobotCommand.idl
# generated code does not contain a copyright notice
# Import statements for member types
import builtins # noqa: E402, I100
import math # noqa: E402, I100
import rosidl_parser.definition # noqa: E402, I100
class Metaclass_RobotCommand(type):
"""Metaclass of message 'RobotCommand'."""
_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('virtual_robot_prococol')
except ImportError:
import logging
import traceback
logger = logging.getLogger(
'virtual_robot_prococol.msg.RobotCommand')
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__robot_command
cls._CONVERT_FROM_PY = module.convert_from_py_msg__msg__robot_command
cls._CONVERT_TO_PY = module.convert_to_py_msg__msg__robot_command
cls._TYPE_SUPPORT = module.type_support_msg__msg__robot_command
cls._DESTROY_ROS_MESSAGE = module.destroy_ros_message_msg__msg__robot_command
@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 RobotCommand(metaclass=Metaclass_RobotCommand):
"""Message class 'RobotCommand'."""
__slots__ = [
'_speed_x',
'_speed_y',
]
_fields_and_field_types = {
'speed_x': 'float',
'speed_y': 'float',
}
SLOT_TYPES = (
rosidl_parser.definition.BasicType('float'), # noqa: E501
rosidl_parser.definition.BasicType('float'), # noqa: E501
)
def __init__(self, **kwargs):
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.speed_x = kwargs.get('speed_x', float())
self.speed_y = kwargs.get('speed_y', float())
def __repr__(self):
typename = self.__class__.__module__.split('.')
typename.pop()
typename.append(self.__class__.__name__)
args = []
for s, t in zip(self.__slots__, 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:
assert fieldstr.startswith('array(')
prefix = "array('X', "
suffix = ')'
fieldstr = fieldstr[len(prefix):-len(suffix)]
args.append(s[1:] + '=' + fieldstr)
return '%s(%s)' % ('.'.join(typename), ', '.join(args))
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if self.speed_x != other.speed_x:
return False
if self.speed_y != other.speed_y:
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 speed_x(self):
"""Message field 'speed_x'."""
return self._speed_x
@speed_x.setter
def speed_x(self, value):
if __debug__:
assert \
isinstance(value, float), \
"The 'speed_x' field must be of type 'float'"
assert not (value < -3.402823466e+38 or value > 3.402823466e+38) or math.isinf(value), \
"The 'speed_x' field must be a float in [-3.402823466e+38, 3.402823466e+38]"
self._speed_x = value
@builtins.property
def speed_y(self):
"""Message field 'speed_y'."""
return self._speed_y
@speed_y.setter
def speed_y(self, value):
if __debug__:
assert \
isinstance(value, float), \
"The 'speed_y' field must be of type 'float'"
assert not (value < -3.402823466e+38 or value > 3.402823466e+38) or math.isinf(value), \
"The 'speed_y' field must be a float in [-3.402823466e+38, 3.402823466e+38]"
self._speed_y = value

View File

@@ -0,0 +1,118 @@
// generated from rosidl_generator_py/resource/_idl_support.c.em
// with input from virtual_robot_prococol:msg/RobotCommand.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 "virtual_robot_prococol/msg/detail/robot_command__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_command__functions.h"
ROSIDL_GENERATOR_C_EXPORT
bool virtual_robot_prococol__msg__robot_command__convert_from_py(PyObject * _pymsg, void * _ros_message)
{
// check that the passed message is of the expected Python class
{
char full_classname_dest[55];
{
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("virtual_robot_prococol.msg._robot_command.RobotCommand", full_classname_dest, 54) == 0);
}
virtual_robot_prococol__msg__RobotCommand * ros_message = _ros_message;
{ // speed_x
PyObject * field = PyObject_GetAttrString(_pymsg, "speed_x");
if (!field) {
return false;
}
assert(PyFloat_Check(field));
ros_message->speed_x = (float)PyFloat_AS_DOUBLE(field);
Py_DECREF(field);
}
{ // speed_y
PyObject * field = PyObject_GetAttrString(_pymsg, "speed_y");
if (!field) {
return false;
}
assert(PyFloat_Check(field));
ros_message->speed_y = (float)PyFloat_AS_DOUBLE(field);
Py_DECREF(field);
}
return true;
}
ROSIDL_GENERATOR_C_EXPORT
PyObject * virtual_robot_prococol__msg__robot_command__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of RobotCommand */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("virtual_robot_prococol.msg._robot_command");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "RobotCommand");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
virtual_robot_prococol__msg__RobotCommand * ros_message = (virtual_robot_prococol__msg__RobotCommand *)raw_ros_message;
{ // speed_x
PyObject * field = NULL;
field = PyFloat_FromDouble(ros_message->speed_x);
{
int rc = PyObject_SetAttrString(_pymessage, "speed_x", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
{ // speed_y
PyObject * field = NULL;
field = PyFloat_FromDouble(ros_message->speed_y);
{
int rc = PyObject_SetAttrString(_pymessage, "speed_y", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}

View File

@@ -61,6 +61,7 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
'_pos_y',
'_speed_x',
'_speed_y',
'_now_time',
]
_fields_and_field_types = {
@@ -68,6 +69,7 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
'pos_y': 'float',
'speed_x': 'float',
'speed_y': 'float',
'now_time': 'string',
}
SLOT_TYPES = (
@@ -75,6 +77,7 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
rosidl_parser.definition.BasicType('float'), # noqa: E501
rosidl_parser.definition.BasicType('float'), # noqa: E501
rosidl_parser.definition.BasicType('float'), # noqa: E501
rosidl_parser.definition.UnboundedString(), # noqa: E501
)
def __init__(self, **kwargs):
@@ -85,6 +88,7 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
self.pos_y = kwargs.get('pos_y', float())
self.speed_x = kwargs.get('speed_x', float())
self.speed_y = kwargs.get('speed_y', float())
self.now_time = kwargs.get('now_time', str())
def __repr__(self):
typename = self.__class__.__module__.split('.')
@@ -123,6 +127,8 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
return False
if self.speed_y != other.speed_y:
return False
if self.now_time != other.now_time:
return False
return True
@classmethod
@@ -189,3 +195,16 @@ class RobotStatus(metaclass=Metaclass_RobotStatus):
assert not (value < -3.402823466e+38 or value > 3.402823466e+38) or math.isinf(value), \
"The 'speed_y' field must be a float in [-3.402823466e+38, 3.402823466e+38]"
self._speed_y = value
@builtins.property
def now_time(self):
"""Message field 'now_time'."""
return self._now_time
@now_time.setter
def now_time(self, value):
if __debug__:
assert \
isinstance(value, str), \
"The 'now_time' field must be of type 'str'"
self._now_time = value

View File

@@ -16,6 +16,9 @@
#include "virtual_robot_prococol/msg/detail/robot_status__struct.h"
#include "virtual_robot_prococol/msg/detail/robot_status__functions.h"
#include "rosidl_runtime_c/string.h"
#include "rosidl_runtime_c/string_functions.h"
ROSIDL_GENERATOR_C_EXPORT
bool virtual_robot_prococol__msg__robot_status__convert_from_py(PyObject * _pymsg, void * _ros_message)
@@ -86,6 +89,21 @@ bool virtual_robot_prococol__msg__robot_status__convert_from_py(PyObject * _pyms
ros_message->speed_y = (float)PyFloat_AS_DOUBLE(field);
Py_DECREF(field);
}
{ // now_time
PyObject * field = PyObject_GetAttrString(_pymsg, "now_time");
if (!field) {
return false;
}
assert(PyUnicode_Check(field));
PyObject * encoded_field = PyUnicode_AsUTF8String(field);
if (!encoded_field) {
Py_DECREF(field);
return false;
}
rosidl_runtime_c__String__assign(&ros_message->now_time, PyBytes_AS_STRING(encoded_field));
Py_DECREF(encoded_field);
Py_DECREF(field);
}
return true;
}
@@ -152,6 +170,23 @@ PyObject * virtual_robot_prococol__msg__robot_status__convert_to_py(void * raw_r
}
}
}
{ // now_time
PyObject * field = NULL;
field = PyUnicode_DecodeUTF8(
ros_message->now_time.data,
strlen(ros_message->now_time.data),
"replace");
if (!field) {
return NULL;
}
{
int rc = PyObject_SetAttrString(_pymessage, "now_time", field);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;

View File

@@ -1 +1 @@
/home/quella/ROS2_WS/protocol_ws/cpp_prococol/install/cpp_prococol:/opt/ros/humble
/home/quella/ROS2_WS/protocol_ws/virtual_robot_prococol/install/virtual_robot_prococol:/opt/ros/humble

View File

@@ -1,4 +1,6 @@
action/TargetPosition.action
action/TargetPosition.idl
msg/RobotCommand.idl
msg/RobotCommand.msg
msg/RobotStatus.idl
msg/RobotStatus.msg

View File

@@ -1,4 +1,4 @@
# generated from rosidl_cmake/cmake/rosidl_cmake-extras.cmake.in
set(virtual_robot_prococol_IDL_FILES "msg/RobotStatus.idl;action/TargetPosition.idl")
set(virtual_robot_prococol_INTERFACE_FILES "msg/RobotStatus.msg;action/TargetPosition.action")
set(virtual_robot_prococol_IDL_FILES "msg/RobotStatus.idl;msg/RobotCommand.idl;action/TargetPosition.idl")
set(virtual_robot_prococol_INTERFACE_FILES "msg/RobotStatus.msg;msg/RobotCommand.msg;action/TargetPosition.action")

View File

@@ -0,0 +1,16 @@
// generated from rosidl_adapter/resource/msg.idl.em
// with input from virtual_robot_prococol/msg/RobotCommand.msg
// generated code does not contain a copyright notice
module virtual_robot_prococol {
module msg {
@verbatim (language="comment", text=
"速度参数")
struct RobotCommand {
float speed_x;
float speed_y;
};
};
};

View File

@@ -0,0 +1,3 @@
# 速度参数
float32 speed_x
float32 speed_y

View File

@@ -17,6 +17,10 @@ module virtual_robot_prococol {
float speed_x;
float speed_y;
@verbatim (language="comment", text=
"时间戳")
string now_time;
};
};
};

View File

@@ -4,4 +4,7 @@ float32 pos_y
# 速度参数
float32 speed_x
float32 speed_y
float32 speed_y
# 时间戳
string now_time