diff --git a/CMakeLists.txt b/CMakeLists.txt index 54c545e3..e0c79146 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,20 +6,33 @@ project(pico_micro_ros_example C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) +set(PICO_BOARD pico_w CACHE STRING "Board type") + pico_sdk_init() link_directories(libmicroros) add_executable(pico_micro_ros_example pico_micro_ros_example.c - pico_uart_transport.c + pico_wifi_transport.c + librobot/motor.c + librobot/robot.c + librobot/sensor.c ) target_link_libraries(pico_micro_ros_example pico_stdlib + hardware_pwm microros ) target_include_directories(pico_micro_ros_example PUBLIC libmicroros/include + librobot + ${CMAKE_CURRENT_LIST_DIR} + ${CMAKE_CURRENT_LIST_DIR}/.. +) + +target_link_libraries(pico_micro_ros_example + pico_cyw43_arch_lwip_threadsafe_background ) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") diff --git a/README.md b/README.md index 6db02acd..05d3e1f4 100755 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ source ~/.bashrc Once the Pico SDK is ready, compile the example: ```bash -cd micro_ros_raspberrypi_pico_sdk +cd uros_pico_w mkdir build cd build cmake .. @@ -54,13 +54,34 @@ cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2 Micro-ROS follows the client-server architecture, so you need to start the Micro-ROS Agent. You can do so using the [micro-ros-agent Docker](https://hub.docker.com/r/microros/micro-ros-agent): ```bash -docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble serial --dev /dev/ttyACM0 -b 115200 +docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble upd4 --port 4444 +``` + +Or using the snap agent: +```bash +#Install +sudo snap install micro-ros-agent +#Run +micro-ros-agent udp4 --port 4444 # add -v[1-6] to specify verbosity +``` + +Or directly in your ros ecosystem running the micro-ros-agent node [micro-ros-agent node](https://micro.ros.org/docs/tutorials/core/first_application_linux/): +```bash +# Download micro-ROS-Agent packages +ros2 run micro_ros_setup create_agent_ws.sh + +# Build step +ros2 run micro_ros_setup build_agent.sh +. install/local_setup.bash + +# Run a micro-ROS agent +ros2 run micro_ros_agent micro_ros_agent udp4 --port 4444 ``` ## What files are relevant? -- `pico_uart_transport.c`: Contains the board specific implementation of the serial transport (no change needed). +- `pico_wifi_transport.c`: Contains the board specific implementation of the wifi transport (no change needed). - `CMakeLists.txt`: CMake file. -- `pico_micro_ros_example.c`: The actual ROS 2 publisher. +- `pico_micro_ros_example.c`: The Picobot ROS 2 exemple. ## How to build the precompiled library @@ -73,6 +94,7 @@ docker run -it --rm -v $(pwd):/project microros/micro_ros_static_library_builder ``` Note that folders added to `microros_static_library/library_generation/extra_packages` and entries added to `microros_static_library/library_generation/extra_packages/extra_packages.repos` will be taken into account by this build system. + ## How to use Pico SDK? Here is a Raspberry Pi Pico C/C++ SDK documentation: diff --git a/available_ros2_types b/available_ros2_types index a11eaabe..25f81bdd 100755 --- a/available_ros2_types +++ b/available_ros2_types @@ -1,245 +1,242 @@ -action_msgs/CancelGoal.srv -action_msgs/GoalInfo.msg -action_msgs/GoalStatus.msg -action_msgs/GoalStatusArray.msg -actionlib_msgs/GoalID.msg -actionlib_msgs/GoalStatus.msg -actionlib_msgs/GoalStatusArray.msg -builtin_interfaces/Duration.msg -builtin_interfaces/Time.msg +test_interface_files/Constants.msg +test_interface_files/Empty.msg +test_interface_files/MultiNested.msg +test_interface_files/UnboundedSequences.msg +test_interface_files/BoundedSequences.msg +test_interface_files/WStrings.msg +test_interface_files/Nested.msg +test_interface_files/BoundedPlainSequences.msg +test_interface_files/BasicTypes.msg +test_interface_files/Defaults.msg +test_interface_files/Strings.msg +test_interface_files/Arrays.msg +test_interface_files/Fibonacci.action +test_interface_files/Arrays.srv +test_interface_files/BasicTypes.srv +test_interface_files/Empty.srv +unique_identifier_msgs/UUID.msg +tf2_msgs/TFMessage.msg +tf2_msgs/TF2Error.msg +tf2_msgs/LookupTransform.action +tf2_msgs/FrameGraph.srv +rosgraph_msgs/Clock.msg +rcl_interfaces/Parameter.msg +rcl_interfaces/FloatingPointRange.msg +rcl_interfaces/ListParametersResult.msg +rcl_interfaces/ParameterDescriptor.msg +rcl_interfaces/IntegerRange.msg +rcl_interfaces/ParameterEvent.msg +rcl_interfaces/ParameterType.msg +rcl_interfaces/ParameterEventDescriptors.msg +rcl_interfaces/Log.msg +rcl_interfaces/ParameterValue.msg +rcl_interfaces/SetParametersResult.msg +rcl_interfaces/GetParameters.srv +rcl_interfaces/GetParameterTypes.srv +rcl_interfaces/SetParameters.srv +rcl_interfaces/SetParametersAtomically.srv +rcl_interfaces/ListParameters.srv +rcl_interfaces/DescribeParameters.srv composition_interfaces/ListNodes.srv composition_interfaces/LoadNode.srv composition_interfaces/UnloadNode.srv -control_msgs/AdmittanceControllerState.msg -control_msgs/DynamicJointState.msg -control_msgs/FollowJointTrajectory.action -control_msgs/GripperCommand.action -control_msgs/GripperCommand.msg -control_msgs/InterfaceValue.msg -control_msgs/JointComponentTolerance.msg -control_msgs/JointControllerState.msg -control_msgs/JointJog.msg -control_msgs/JointTolerance.msg -control_msgs/JointTrajectory.action -control_msgs/JointTrajectoryControllerState.msg -control_msgs/MecanumDriveControllerState.msg -control_msgs/PidState.msg -control_msgs/PointHead.action -control_msgs/QueryCalibrationState.srv -control_msgs/QueryTrajectoryState.srv -control_msgs/SingleJointPosition.action -control_msgs/SteeringControllerStatus.msg -data/Test.action -data/Test.msg -data/Test.srv -diagnostic_msgs/AddDiagnostics.srv -diagnostic_msgs/DiagnosticArray.msg -diagnostic_msgs/DiagnosticStatus.msg -diagnostic_msgs/KeyValue.msg -diagnostic_msgs/SelfTest.srv -example_interfaces/AddTwoInts.srv -example_interfaces/Bool.msg -example_interfaces/Byte.msg +statistics_msgs/StatisticDataType.msg +statistics_msgs/MetricsMessage.msg +statistics_msgs/StatisticDataPoint.msg +action_msgs/GoalStatusArray.msg +action_msgs/GoalInfo.msg +action_msgs/GoalStatus.msg +action_msgs/CancelGoal.srv +test_msgs/Builtins.msg +test_msgs/NestedMessage.action +builtin_interfaces/Time.msg +builtin_interfaces/Duration.msg +lifecycle_msgs/TransitionEvent.msg +lifecycle_msgs/Transition.msg +lifecycle_msgs/TransitionDescription.msg +lifecycle_msgs/State.msg +lifecycle_msgs/GetAvailableTransitions.srv +lifecycle_msgs/GetState.srv +lifecycle_msgs/ChangeState.srv +lifecycle_msgs/GetAvailableStates.srv +example_interfaces/UInt32.msg +example_interfaces/Int8.msg example_interfaces/ByteMultiArray.msg -example_interfaces/Char.msg -example_interfaces/Empty.msg -example_interfaces/Fibonacci.action -example_interfaces/Float32.msg -example_interfaces/Float32MultiArray.msg example_interfaces/Float64.msg -example_interfaces/Float64MultiArray.msg -example_interfaces/Int16.msg +example_interfaces/UInt8MultiArray.msg +example_interfaces/Int64.msg +example_interfaces/Int32MultiArray.msg +example_interfaces/UInt8.msg +example_interfaces/Byte.msg +example_interfaces/Empty.msg +example_interfaces/UInt16MultiArray.msg +example_interfaces/UInt64.msg +example_interfaces/Int8MultiArray.msg example_interfaces/Int16MultiArray.msg +example_interfaces/Int16.msg +example_interfaces/UInt16.msg +example_interfaces/WString.msg +example_interfaces/MultiArrayLayout.msg +example_interfaces/UInt64MultiArray.msg +example_interfaces/UInt32MultiArray.msg example_interfaces/Int32.msg -example_interfaces/Int32MultiArray.msg -example_interfaces/Int64.msg example_interfaces/Int64MultiArray.msg -example_interfaces/Int8.msg -example_interfaces/Int8MultiArray.msg +example_interfaces/Float64MultiArray.msg example_interfaces/MultiArrayDimension.msg -example_interfaces/MultiArrayLayout.msg -example_interfaces/SetBool.srv +example_interfaces/Float32.msg +example_interfaces/Bool.msg example_interfaces/String.msg +example_interfaces/Float32MultiArray.msg +example_interfaces/Char.msg +example_interfaces/Fibonacci.action example_interfaces/Trigger.srv -example_interfaces/UInt16.msg -example_interfaces/UInt16MultiArray.msg -example_interfaces/UInt32.msg -example_interfaces/UInt32MultiArray.msg -example_interfaces/UInt64.msg -example_interfaces/UInt64MultiArray.msg -example_interfaces/UInt8.msg -example_interfaces/UInt8MultiArray.msg -example_interfaces/WString.msg -geometry_msgs/Accel.msg +example_interfaces/AddTwoInts.srv +example_interfaces/SetBool.srv +shape_msgs/MeshTriangle.msg +shape_msgs/Plane.msg +shape_msgs/SolidPrimitive.msg +shape_msgs/Mesh.msg geometry_msgs/AccelStamped.msg -geometry_msgs/AccelWithCovariance.msg -geometry_msgs/AccelWithCovarianceStamped.msg -geometry_msgs/Inertia.msg +geometry_msgs/Accel.msg +geometry_msgs/Pose.msg +geometry_msgs/Transform.msg +geometry_msgs/PointStamped.msg +geometry_msgs/WrenchStamped.msg +geometry_msgs/PoseWithCovarianceStamped.msg geometry_msgs/InertiaStamped.msg -geometry_msgs/Point.msg geometry_msgs/Point32.msg -geometry_msgs/PointStamped.msg -geometry_msgs/Polygon.msg -geometry_msgs/PolygonStamped.msg -geometry_msgs/Pose.msg +geometry_msgs/AccelWithCovarianceStamped.msg geometry_msgs/Pose2D.msg -geometry_msgs/PoseArray.msg -geometry_msgs/PoseStamped.msg -geometry_msgs/PoseWithCovariance.msg -geometry_msgs/PoseWithCovarianceStamped.msg -geometry_msgs/Quaternion.msg -geometry_msgs/QuaternionStamped.msg -geometry_msgs/Transform.msg -geometry_msgs/TransformStamped.msg geometry_msgs/Twist.msg -geometry_msgs/TwistStamped.msg geometry_msgs/TwistWithCovariance.msg -geometry_msgs/TwistWithCovarianceStamped.msg +geometry_msgs/Quaternion.msg +geometry_msgs/PoseWithCovariance.msg geometry_msgs/Vector3.msg +geometry_msgs/PolygonStamped.msg geometry_msgs/Vector3Stamped.msg geometry_msgs/Wrench.msg -geometry_msgs/WrenchStamped.msg -lifecycle_msgs/ChangeState.srv -lifecycle_msgs/GetAvailableStates.srv -lifecycle_msgs/GetAvailableTransitions.srv -lifecycle_msgs/GetState.srv -lifecycle_msgs/State.msg -lifecycle_msgs/Transition.msg -lifecycle_msgs/TransitionDescription.msg -lifecycle_msgs/TransitionEvent.msg -nav_msgs/GetMap.srv -nav_msgs/GetPlan.srv -nav_msgs/GridCells.msg -nav_msgs/LoadMap.srv -nav_msgs/MapMetaData.msg -nav_msgs/OccupancyGrid.msg -nav_msgs/Odometry.msg -nav_msgs/Path.msg -nav_msgs/SetMap.srv -rcl_interfaces/DescribeParameters.srv -rcl_interfaces/FloatingPointRange.msg -rcl_interfaces/GetParameterTypes.srv -rcl_interfaces/GetParameters.srv -rcl_interfaces/IntegerRange.msg -rcl_interfaces/ListParameters.srv -rcl_interfaces/ListParametersResult.msg -rcl_interfaces/Log.msg -rcl_interfaces/Parameter.msg -rcl_interfaces/ParameterDescriptor.msg -rcl_interfaces/ParameterEvent.msg -rcl_interfaces/ParameterEventDescriptors.msg -rcl_interfaces/ParameterType.msg -rcl_interfaces/ParameterValue.msg -rcl_interfaces/SetParameters.srv -rcl_interfaces/SetParametersAtomically.srv -rcl_interfaces/SetParametersResult.msg -rosgraph_msgs/Clock.msg -sensor_msgs/BatteryState.msg -sensor_msgs/CameraInfo.msg +geometry_msgs/TwistWithCovarianceStamped.msg +geometry_msgs/Polygon.msg +geometry_msgs/PoseStamped.msg +geometry_msgs/Inertia.msg +geometry_msgs/TwistStamped.msg +geometry_msgs/AccelWithCovariance.msg +geometry_msgs/Point.msg +geometry_msgs/TransformStamped.msg +geometry_msgs/QuaternionStamped.msg +geometry_msgs/PoseArray.msg +actionlib_msgs/GoalStatusArray.msg +actionlib_msgs/GoalID.msg +actionlib_msgs/GoalStatus.msg +diagnostic_msgs/KeyValue.msg +diagnostic_msgs/DiagnosticStatus.msg +diagnostic_msgs/DiagnosticArray.msg +diagnostic_msgs/SelfTest.srv +diagnostic_msgs/AddDiagnostics.srv +std_msgs/UInt32.msg +std_msgs/Int8.msg +std_msgs/ByteMultiArray.msg +std_msgs/Float64.msg +std_msgs/UInt8MultiArray.msg +std_msgs/Int64.msg +std_msgs/Int32MultiArray.msg +std_msgs/UInt8.msg +std_msgs/Byte.msg +std_msgs/Empty.msg +std_msgs/UInt16MultiArray.msg +std_msgs/ColorRGBA.msg +std_msgs/UInt64.msg +std_msgs/Int8MultiArray.msg +std_msgs/Int16MultiArray.msg +std_msgs/Int16.msg +std_msgs/Header.msg +std_msgs/UInt16.msg +std_msgs/MultiArrayLayout.msg +std_msgs/UInt64MultiArray.msg +std_msgs/UInt32MultiArray.msg +std_msgs/Int32.msg +std_msgs/Int64MultiArray.msg +std_msgs/Float64MultiArray.msg +std_msgs/MultiArrayDimension.msg +std_msgs/Float32.msg +std_msgs/Bool.msg +std_msgs/String.msg +std_msgs/Float32MultiArray.msg +std_msgs/Char.msg +sensor_msgs/LaserScan.msg +sensor_msgs/PointCloud.msg +sensor_msgs/Temperature.msg +sensor_msgs/Imu.msg +sensor_msgs/Joy.msg sensor_msgs/ChannelFloat32.msg +sensor_msgs/NavSatStatus.msg +sensor_msgs/JointState.msg sensor_msgs/CompressedImage.msg +sensor_msgs/MultiEchoLaserScan.msg +sensor_msgs/TimeReference.msg +sensor_msgs/RelativeHumidity.msg sensor_msgs/FluidPressure.msg +sensor_msgs/LaserEcho.msg +sensor_msgs/PointCloud2.msg +sensor_msgs/NavSatFix.msg +sensor_msgs/RegionOfInterest.msg sensor_msgs/Illuminance.msg +sensor_msgs/MagneticField.msg +sensor_msgs/CameraInfo.msg +sensor_msgs/PointField.msg +sensor_msgs/JoyFeedbackArray.msg sensor_msgs/Image.msg -sensor_msgs/Imu.msg -sensor_msgs/JointState.msg -sensor_msgs/Joy.msg sensor_msgs/JoyFeedback.msg -sensor_msgs/JoyFeedbackArray.msg -sensor_msgs/LaserEcho.msg -sensor_msgs/LaserScan.msg -sensor_msgs/MagneticField.msg sensor_msgs/MultiDOFJointState.msg -sensor_msgs/MultiEchoLaserScan.msg -sensor_msgs/NavSatFix.msg -sensor_msgs/NavSatStatus.msg -sensor_msgs/PointCloud.msg -sensor_msgs/PointCloud2.msg -sensor_msgs/PointField.msg sensor_msgs/Range.msg -sensor_msgs/RegionOfInterest.msg -sensor_msgs/RelativeHumidity.msg +sensor_msgs/BatteryState.msg sensor_msgs/SetCameraInfo.srv -sensor_msgs/Temperature.msg -sensor_msgs/TimeReference.msg -shape_msgs/Mesh.msg -shape_msgs/MeshTriangle.msg -shape_msgs/Plane.msg -shape_msgs/SolidPrimitive.msg -statistics_msgs/MetricsMessage.msg -statistics_msgs/StatisticDataPoint.msg -statistics_msgs/StatisticDataType.msg -std_msgs/Bool.msg -std_msgs/Byte.msg -std_msgs/ByteMultiArray.msg -std_msgs/Char.msg -std_msgs/ColorRGBA.msg -std_msgs/Empty.msg -std_msgs/Float32.msg -std_msgs/Float32MultiArray.msg -std_msgs/Float64.msg -std_msgs/Float64MultiArray.msg -std_msgs/Header.msg -std_msgs/Int16.msg -std_msgs/Int16MultiArray.msg -std_msgs/Int32.msg -std_msgs/Int32MultiArray.msg -std_msgs/Int64.msg -std_msgs/Int64MultiArray.msg -std_msgs/Int8.msg -std_msgs/Int8MultiArray.msg -std_msgs/MultiArrayDimension.msg -std_msgs/MultiArrayLayout.msg -std_msgs/String.msg -std_msgs/UInt16.msg -std_msgs/UInt16MultiArray.msg -std_msgs/UInt32.msg -std_msgs/UInt32MultiArray.msg -std_msgs/UInt64.msg -std_msgs/UInt64MultiArray.msg -std_msgs/UInt8.msg -std_msgs/UInt8MultiArray.msg -std_srvs/Empty.srv -std_srvs/SetBool.srv std_srvs/Trigger.srv -stereo_msgs/DisparityImage.msg -test_interface_files/Arrays.msg -test_interface_files/Arrays.srv -test_interface_files/BasicTypes.msg -test_interface_files/BasicTypes.srv -test_interface_files/BoundedPlainSequences.msg -test_interface_files/BoundedSequences.msg -test_interface_files/Constants.msg -test_interface_files/Defaults.msg -test_interface_files/Empty.msg -test_interface_files/Empty.srv -test_interface_files/Fibonacci.action -test_interface_files/MultiNested.msg -test_interface_files/Nested.msg -test_interface_files/Strings.msg -test_interface_files/UnboundedSequences.msg -test_interface_files/WStrings.msg -test_msgs/Builtins.msg -test_msgs/NestedMessage.action -tf2_msgs/FrameGraph.srv -tf2_msgs/LookupTransform.action -tf2_msgs/TF2Error.msg -tf2_msgs/TFMessage.msg +std_srvs/SetBool.srv +std_srvs/Empty.srv trajectory_msgs/JointTrajectory.msg -trajectory_msgs/JointTrajectoryPoint.msg trajectory_msgs/MultiDOFJointTrajectory.msg +trajectory_msgs/JointTrajectoryPoint.msg trajectory_msgs/MultiDOFJointTrajectoryPoint.msg -unique_identifier_msgs/UUID.msg -visualization_msgs/GetInteractiveMarkers.srv -visualization_msgs/ImageMarker.msg -visualization_msgs/InteractiveMarker.msg -visualization_msgs/InteractiveMarkerControl.msg -visualization_msgs/InteractiveMarkerFeedback.msg visualization_msgs/InteractiveMarkerInit.msg visualization_msgs/InteractiveMarkerPose.msg -visualization_msgs/InteractiveMarkerUpdate.msg -visualization_msgs/Marker.msg +visualization_msgs/UVCoordinate.msg visualization_msgs/MarkerArray.msg visualization_msgs/MenuEntry.msg visualization_msgs/MeshFile.msg -visualization_msgs/UVCoordinate.msg +visualization_msgs/InteractiveMarkerUpdate.msg +visualization_msgs/InteractiveMarkerFeedback.msg +visualization_msgs/InteractiveMarker.msg +visualization_msgs/Marker.msg +visualization_msgs/ImageMarker.msg +visualization_msgs/InteractiveMarkerControl.msg +visualization_msgs/GetInteractiveMarkers.srv +stereo_msgs/DisparityImage.msg +nav_msgs/Odometry.msg +nav_msgs/GridCells.msg +nav_msgs/Path.msg +nav_msgs/MapMetaData.msg +nav_msgs/OccupancyGrid.msg +nav_msgs/GetMap.srv +nav_msgs/LoadMap.srv +nav_msgs/SetMap.srv +nav_msgs/GetPlan.srv +data/Test.msg +data/Test.action +data/Test.srv +control_msgs/PidState.msg +control_msgs/InterfaceValue.msg +control_msgs/JointTrajectoryControllerState.msg +control_msgs/JointComponentTolerance.msg +control_msgs/JointTolerance.msg +control_msgs/JointControllerState.msg +control_msgs/DynamicJointState.msg +control_msgs/GripperCommand.msg +control_msgs/JointJog.msg +control_msgs/GripperCommand.action +control_msgs/JointTrajectory.action +control_msgs/FollowJointTrajectory.action +control_msgs/PointHead.action +control_msgs/SingleJointPosition.action +control_msgs/QueryTrajectoryState.srv +control_msgs/QueryCalibrationState.srv diff --git a/built_packages b/built_packages index 72a34a1f..7419329f 100755 --- a/built_packages +++ b/built_packages @@ -1,29 +1,29 @@ -https://github.com/ament/ament_cmake.git 6105a1f7e7e896f45677184570495b3c6b534097 +https://github.com/ament/ament_cmake.git 15ea54ad541f367a76fd491f028e2659ec712ef5 https://github.com/ament/ament_index.git f019d6c40991799a13b18c9c3dcc583e3fde0381 -https://github.com/ament/ament_lint.git 65a0b1cf7d1c950869609b624b7797ab5e4677b1 +https://github.com/ament/ament_lint.git 4f4bf85fcc117ee6ccd19b62551f77f3163105c1 https://github.com/ament/ament_package.git f8ea958fd02cff6f4192425e28566369c92b5e34 -https://github.com/ament/googletest.git 0acc5196ddd5364fe24b729185c81746573835dd +https://github.com/ament/googletest.git 6df7425fdcbd368d2d1b99ffd89b9168014abb07 https://github.com/ament/uncrustify_vendor.git ec8f8b4d03483671e8ea2b3039f1015f92b0ef89 https://github.com/eProsima/Micro-CDR.git ed4fd513a24a53b93d548d342cb7aa0a18716f04 -https://github.com/eProsima/Micro-XRCE-DDS-Client.git 5cd43eb0ba97c7ec21949492344b8bf05e04572c +https://github.com/eProsima/Micro-XRCE-DDS-Client.git c28bf96f6e93ad1e01b8f0d74ea255e6bd8b07d2 https://github.com/micro-ROS/micro_ros_msgs.git e3664463e78ae5d0c34d86be92d707b3d9dfd27d https://github.com/micro-ROS/micro_ros_utilities 008b94ab857c72a4e79239cb1d5b80e80ed268bc -https://github.com/micro-ROS/rcl a11ba25bd022a885daa8e19a5f042cebae52d399 -https://github.com/micro-ROS/rcutils 00229f3085984f27cf32dbf95f09a0be6aa05998 +https://github.com/micro-ROS/rcl e8033a2a22e28a2da6d605bf467b1856813f8fa7 +https://github.com/micro-ROS/rcutils ffa1eccb31d1a8d4aaf405f41962c799efc51d57 https://github.com/micro-ROS/rmw-microxrcedds.git 7886a89312ec4787d9ff94d30a7b4e47e0bb3b8c https://github.com/micro-ROS/rosidl_typesupport.git d21bde140e1a4b413f6725888470b758a739171d https://github.com/micro-ROS/rosidl_typesupport_microxrcedds.git 106fda6a43a912e09480d7b705f3ca4a31a1803c -https://github.com/ros-controls/control_msgs aa46047b27b8b034d526760f92f62cfc4dbe873e +https://github.com/ros-controls/control_msgs 1416954c31432c192ff95a06559847e87386cf60 https://github.com/ros2/ament_cmake_ros.git 60572fa1bec50b9e6fbe64e1b23640d21c15e9d0 https://github.com/ros2/common_interfaces.git f4eac72f0bbd70f7955a5f709d4a6705eb6ca7e8 https://github.com/ros2/example_interfaces.git f8deb566a1facf91bd38b9f00c4cf684c5007d85 https://github.com/ros2/libyaml_vendor.git 239f695ceaa0820255f3d0fe02ec8c2bd41b8e78 -https://github.com/ros2/rcl.git 7bf1f07ae2ecf60a30e931be126ae73b727be41c +https://github.com/ros2/rcl.git 48c6e4c0d7c870f90c773161d3856f868fb0e65f https://github.com/ros2/rcl_interfaces.git 5e01a28f9866a564491480e12d8659a134678741 https://github.com/ros2/rcl_logging.git 1b7a4e34884005f28eeb04065b5d94565c67b11d https://github.com/ros2/rclc 27703c2ea0f869a6b0ddc0a7bdee4f7ec00c073c -https://github.com/ros2/rcpputils.git 3eb281afdc891855b5feb367c79ede1e2fbb0acb +https://github.com/ros2/rcpputils.git a93b1d4dbcac45b639e3468ba5d54d582689b3c6 https://github.com/ros2/rmw.git 2a4ee718d0da004d5629f50afd2896fbd1f4aedd https://github.com/ros2/rmw_implementation.git 413eb313f7e128c6977cd453818e1a39bf70da40 https://github.com/ros2/rosidl.git 81e90074ad5a36d63affabf966c71914660c417f diff --git a/libmicroros/include/control_msgs/msg/admittance_controller_state.h b/libmicroros/include/control_msgs/msg/admittance_controller_state.h deleted file mode 100755 index 7075041d..00000000 --- a/libmicroros/include/control_msgs/msg/admittance_controller_state.h +++ /dev/null @@ -1,12 +0,0 @@ -// generated from rosidl_generator_c/resource/idl.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE_H_ -#define CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE_H_ - -#include "control_msgs/msg/detail/admittance_controller_state__struct.h" -#include "control_msgs/msg/detail/admittance_controller_state__functions.h" -#include "control_msgs/msg/detail/admittance_controller_state__type_support.h" - -#endif // CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__functions.h b/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__functions.h deleted file mode 100755 index 29affb45..00000000 --- a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__functions.h +++ /dev/null @@ -1,177 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__functions.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__FUNCTIONS_H_ -#define CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include - -#include "rosidl_runtime_c/visibility_control.h" -#include "control_msgs/msg/rosidl_generator_c__visibility_control.h" - -#include "control_msgs/msg/detail/admittance_controller_state__struct.h" - -/// Initialize msg/AdmittanceControllerState 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( - * control_msgs__msg__AdmittanceControllerState - * )) before or use - * control_msgs__msg__AdmittanceControllerState__create() - * to allocate and initialize the message. - * \return true if initialization was successful, otherwise false - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__init(control_msgs__msg__AdmittanceControllerState * msg); - -/// Finalize msg/AdmittanceControllerState message. -/** - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__AdmittanceControllerState__fini(control_msgs__msg__AdmittanceControllerState * msg); - -/// Create msg/AdmittanceControllerState message. -/** - * It allocates the memory for the message, sets the memory to zero, and - * calls - * control_msgs__msg__AdmittanceControllerState__init(). - * \return The pointer to the initialized message if successful, - * otherwise NULL - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -control_msgs__msg__AdmittanceControllerState * -control_msgs__msg__AdmittanceControllerState__create(); - -/// Destroy msg/AdmittanceControllerState message. -/** - * It calls - * control_msgs__msg__AdmittanceControllerState__fini() - * and frees the memory of the message. - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__AdmittanceControllerState__destroy(control_msgs__msg__AdmittanceControllerState * msg); - -/// Check for msg/AdmittanceControllerState 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_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__are_equal(const control_msgs__msg__AdmittanceControllerState * lhs, const control_msgs__msg__AdmittanceControllerState * rhs); - -/// Copy a msg/AdmittanceControllerState 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_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__copy( - const control_msgs__msg__AdmittanceControllerState * input, - control_msgs__msg__AdmittanceControllerState * output); - -/// Initialize array of msg/AdmittanceControllerState messages. -/** - * It allocates the memory for the number of elements and calls - * control_msgs__msg__AdmittanceControllerState__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_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__Sequence__init(control_msgs__msg__AdmittanceControllerState__Sequence * array, size_t size); - -/// Finalize array of msg/AdmittanceControllerState messages. -/** - * It calls - * control_msgs__msg__AdmittanceControllerState__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_control_msgs -void -control_msgs__msg__AdmittanceControllerState__Sequence__fini(control_msgs__msg__AdmittanceControllerState__Sequence * array); - -/// Create array of msg/AdmittanceControllerState messages. -/** - * It allocates the memory for the array and calls - * control_msgs__msg__AdmittanceControllerState__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_control_msgs -control_msgs__msg__AdmittanceControllerState__Sequence * -control_msgs__msg__AdmittanceControllerState__Sequence__create(size_t size); - -/// Destroy array of msg/AdmittanceControllerState messages. -/** - * It calls - * control_msgs__msg__AdmittanceControllerState__Sequence__fini() - * on the array, - * and frees the memory of the array. - * \param[in,out] array The initialized array pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__AdmittanceControllerState__Sequence__destroy(control_msgs__msg__AdmittanceControllerState__Sequence * array); - -/// Check for msg/AdmittanceControllerState 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_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__Sequence__are_equal(const control_msgs__msg__AdmittanceControllerState__Sequence * lhs, const control_msgs__msg__AdmittanceControllerState__Sequence * rhs); - -/// Copy an array of msg/AdmittanceControllerState 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_control_msgs -bool -control_msgs__msg__AdmittanceControllerState__Sequence__copy( - const control_msgs__msg__AdmittanceControllerState__Sequence * input, - control_msgs__msg__AdmittanceControllerState__Sequence * output); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__FUNCTIONS_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_introspection_c.h b/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_introspection_c.h deleted file mode 100755 index 45a47bbd..00000000 --- a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_introspection_c.h +++ /dev/null @@ -1,26 +0,0 @@ -// generated from rosidl_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ -#define CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__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 "control_msgs/msg/rosidl_typesupport_introspection_c__visibility_control.h" - -ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, control_msgs, msg, AdmittanceControllerState)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_microxrcedds_c.h b/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_microxrcedds_c.h deleted file mode 100755 index 82cc7aba..00000000 --- a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__rosidl_typesupport_microxrcedds_c.h +++ /dev/null @@ -1,39 +0,0 @@ -// generated from rosidl_typesupport_microxrcedds_c/resource/idl__rosidl_typesupport_c.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice -#ifndef CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ -#define CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ - - -#include -#include -#include -#include "rosidl_runtime_c/message_type_support_struct.h" -#include "rosidl_typesupport_interface/macros.h" -#include "control_msgs/msg/rosidl_typesupport_microxrcedds_c__visibility_control.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t get_serialized_size_control_msgs__msg__AdmittanceControllerState( - const void * untyped_ros_message, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t max_serialized_size_control_msgs__msg__AdmittanceControllerState( - bool * full_bounded, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_c, control_msgs, msg, AdmittanceControllerState)(); - -#ifdef __cplusplus -} -#endif - - -#endif // CONTROL_MSGS__MSG__ADMITTANCE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__struct.h b/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__struct.h deleted file mode 100755 index d6fca9b2..00000000 --- a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__struct.h +++ /dev/null @@ -1,90 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__struct.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__STRUCT_H_ -#define CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__STRUCT_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include -#include - - -// Constants defined in the message - -// Include directives for member types -// Member 'mass' -// Member 'damping' -// Member 'stiffness' -#include "std_msgs/msg/detail/float64_multi_array__struct.h" -// Member 'rot_base_control' -#include "geometry_msgs/msg/detail/quaternion__struct.h" -// Member 'ref_trans_base_ft' -// Member 'admittance_position' -#include "geometry_msgs/msg/detail/transform_stamped__struct.h" -// Member 'selected_axes' -#include "std_msgs/msg/detail/int8_multi_array__struct.h" -// Member 'ft_sensor_frame' -#include "std_msgs/msg/detail/string__struct.h" -// Member 'admittance_acceleration' -// Member 'admittance_velocity' -#include "geometry_msgs/msg/detail/twist_stamped__struct.h" -// Member 'wrench_base' -#include "geometry_msgs/msg/detail/wrench_stamped__struct.h" -// Member 'joint_state' -#include "sensor_msgs/msg/detail/joint_state__struct.h" - -/// Struct defined in msg/AdmittanceControllerState in the package control_msgs. -/** - * Admittance parameters - */ -typedef struct control_msgs__msg__AdmittanceControllerState -{ - /// 6-vector of mass terms used in the admittance calculation - std_msgs__msg__Float64MultiArray mass; - /// 6-vector of damping terms used in the admittance calculation - std_msgs__msg__Float64MultiArray damping; - /// 6-vector of stiffness terms used in the admittance calculation - std_msgs__msg__Float64MultiArray stiffness; - /// Frame information - /// quaternion describing the orientation of the control frame - geometry_msgs__msg__Quaternion rot_base_control; - /// force torque sensor transform at the reference joint configuration - geometry_msgs__msg__TransformStamped ref_trans_base_ft; - /// 6-vector of 0/1 describing if admittance is enable in the corresponding control frame axis - std_msgs__msg__Int8MultiArray selected_axes; - /// name of the force torque frame - std_msgs__msg__String ft_sensor_frame; - /// State information - /// calculated admittance position in cartesian space - geometry_msgs__msg__TransformStamped admittance_position; - /// calculated admittance acceleration in cartesian space - geometry_msgs__msg__TwistStamped admittance_acceleration; - /// calculated admittance velocity in cartesian space - geometry_msgs__msg__TwistStamped admittance_velocity; - /// wrench used in the admittance calculation - geometry_msgs__msg__WrenchStamped wrench_base; - /// calculated admittance offsets in joint space - sensor_msgs__msg__JointState joint_state; -} control_msgs__msg__AdmittanceControllerState; - -// Struct for a sequence of control_msgs__msg__AdmittanceControllerState. -typedef struct control_msgs__msg__AdmittanceControllerState__Sequence -{ - control_msgs__msg__AdmittanceControllerState * data; - /// The number of valid items in data - size_t size; - /// The number of allocated items in data - size_t capacity; -} control_msgs__msg__AdmittanceControllerState__Sequence; - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__STRUCT_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__type_support.h b/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__type_support.h deleted file mode 100755 index 0ad585bb..00000000 --- a/libmicroros/include/control_msgs/msg/detail/admittance_controller_state__type_support.h +++ /dev/null @@ -1,33 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__type_support.h.em -// with input from control_msgs:msg/AdmittanceControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__TYPE_SUPPORT_H_ -#define CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__TYPE_SUPPORT_H_ - -#include "rosidl_typesupport_interface/macros.h" - -#include "control_msgs/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_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( - rosidl_typesupport_c, - control_msgs, - msg, - AdmittanceControllerState -)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__ADMITTANCE_CONTROLLER_STATE__TYPE_SUPPORT_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/joint_trajectory_controller_state__struct.h b/libmicroros/include/control_msgs/msg/detail/joint_trajectory_controller_state__struct.h index 2b108b26..d78257c7 100755 --- a/libmicroros/include/control_msgs/msg/detail/joint_trajectory_controller_state__struct.h +++ b/libmicroros/include/control_msgs/msg/detail/joint_trajectory_controller_state__struct.h @@ -21,55 +21,21 @@ extern "C" // Member 'header' #include "std_msgs/msg/detail/header__struct.h" // Member 'joint_names' -// Member 'multi_dof_joint_names' #include "rosidl_runtime_c/string.h" -// Member 'reference' -// Member 'feedback' -// Member 'error' -// Member 'output' // Member 'desired' // Member 'actual' +// Member 'error' #include "trajectory_msgs/msg/detail/joint_trajectory_point__struct.h" -// Member 'multi_dof_reference' -// Member 'multi_dof_feedback' -// Member 'multi_dof_error' -// Member 'multi_dof_output' -// Member 'multi_dof_desired' -// Member 'multi_dof_actual' -#include "trajectory_msgs/msg/detail/multi_dof_joint_trajectory_point__struct.h" /// Struct defined in msg/JointTrajectoryControllerState in the package control_msgs. -/** - * This message presents current controller state of JTC - */ typedef struct control_msgs__msg__JointTrajectoryControllerState { - /// Header timestamp should be update time of controller state std_msgs__msg__Header header; rosidl_runtime_c__String__Sequence joint_names; - /// The set point, that is, desired state. - trajectory_msgs__msg__JointTrajectoryPoint reference; - /// Current value of the process (ie: latest sensor measurement on the controlled value). - trajectory_msgs__msg__JointTrajectoryPoint feedback; - /// The error of the controlled value, essentially reference - feedback (for a regular PID implementation). - trajectory_msgs__msg__JointTrajectoryPoint error; - /// Current output of the controller. - trajectory_msgs__msg__JointTrajectoryPoint output; - /// -- deprecated -- trajectory_msgs__msg__JointTrajectoryPoint desired; trajectory_msgs__msg__JointTrajectoryPoint actual; - rosidl_runtime_c__String__Sequence multi_dof_joint_names; - /// The set point, that is, desired state. - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_reference; - /// Current value of the process (ie: latest sensor measurement on the controlled value). - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_feedback; - /// The error of the controlled value, essentially reference - feedback (for a regular PID implementation). - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_error; - /// Current output of the controller. - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_output; - /// -- deprecated -- - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_desired; - trajectory_msgs__msg__MultiDOFJointTrajectoryPoint multi_dof_actual; + /// Redundant, but useful + trajectory_msgs__msg__JointTrajectoryPoint error; } control_msgs__msg__JointTrajectoryControllerState; // Struct for a sequence of control_msgs__msg__JointTrajectoryControllerState. diff --git a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__functions.h b/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__functions.h deleted file mode 100755 index 9e6c244e..00000000 --- a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__functions.h +++ /dev/null @@ -1,177 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__functions.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__FUNCTIONS_H_ -#define CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include - -#include "rosidl_runtime_c/visibility_control.h" -#include "control_msgs/msg/rosidl_generator_c__visibility_control.h" - -#include "control_msgs/msg/detail/mecanum_drive_controller_state__struct.h" - -/// Initialize msg/MecanumDriveControllerState 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( - * control_msgs__msg__MecanumDriveControllerState - * )) before or use - * control_msgs__msg__MecanumDriveControllerState__create() - * to allocate and initialize the message. - * \return true if initialization was successful, otherwise false - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__init(control_msgs__msg__MecanumDriveControllerState * msg); - -/// Finalize msg/MecanumDriveControllerState message. -/** - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__MecanumDriveControllerState__fini(control_msgs__msg__MecanumDriveControllerState * msg); - -/// Create msg/MecanumDriveControllerState message. -/** - * It allocates the memory for the message, sets the memory to zero, and - * calls - * control_msgs__msg__MecanumDriveControllerState__init(). - * \return The pointer to the initialized message if successful, - * otherwise NULL - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -control_msgs__msg__MecanumDriveControllerState * -control_msgs__msg__MecanumDriveControllerState__create(); - -/// Destroy msg/MecanumDriveControllerState message. -/** - * It calls - * control_msgs__msg__MecanumDriveControllerState__fini() - * and frees the memory of the message. - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__MecanumDriveControllerState__destroy(control_msgs__msg__MecanumDriveControllerState * msg); - -/// Check for msg/MecanumDriveControllerState 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_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__are_equal(const control_msgs__msg__MecanumDriveControllerState * lhs, const control_msgs__msg__MecanumDriveControllerState * rhs); - -/// Copy a msg/MecanumDriveControllerState 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_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__copy( - const control_msgs__msg__MecanumDriveControllerState * input, - control_msgs__msg__MecanumDriveControllerState * output); - -/// Initialize array of msg/MecanumDriveControllerState messages. -/** - * It allocates the memory for the number of elements and calls - * control_msgs__msg__MecanumDriveControllerState__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_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__Sequence__init(control_msgs__msg__MecanumDriveControllerState__Sequence * array, size_t size); - -/// Finalize array of msg/MecanumDriveControllerState messages. -/** - * It calls - * control_msgs__msg__MecanumDriveControllerState__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_control_msgs -void -control_msgs__msg__MecanumDriveControllerState__Sequence__fini(control_msgs__msg__MecanumDriveControllerState__Sequence * array); - -/// Create array of msg/MecanumDriveControllerState messages. -/** - * It allocates the memory for the array and calls - * control_msgs__msg__MecanumDriveControllerState__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_control_msgs -control_msgs__msg__MecanumDriveControllerState__Sequence * -control_msgs__msg__MecanumDriveControllerState__Sequence__create(size_t size); - -/// Destroy array of msg/MecanumDriveControllerState messages. -/** - * It calls - * control_msgs__msg__MecanumDriveControllerState__Sequence__fini() - * on the array, - * and frees the memory of the array. - * \param[in,out] array The initialized array pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__MecanumDriveControllerState__Sequence__destroy(control_msgs__msg__MecanumDriveControllerState__Sequence * array); - -/// Check for msg/MecanumDriveControllerState 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_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__Sequence__are_equal(const control_msgs__msg__MecanumDriveControllerState__Sequence * lhs, const control_msgs__msg__MecanumDriveControllerState__Sequence * rhs); - -/// Copy an array of msg/MecanumDriveControllerState 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_control_msgs -bool -control_msgs__msg__MecanumDriveControllerState__Sequence__copy( - const control_msgs__msg__MecanumDriveControllerState__Sequence * input, - control_msgs__msg__MecanumDriveControllerState__Sequence * output); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__FUNCTIONS_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_introspection_c.h b/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_introspection_c.h deleted file mode 100755 index 7e2ccbcf..00000000 --- a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_introspection_c.h +++ /dev/null @@ -1,26 +0,0 @@ -// generated from rosidl_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ -#define CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__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 "control_msgs/msg/rosidl_typesupport_introspection_c__visibility_control.h" - -ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, control_msgs, msg, MecanumDriveControllerState)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_microxrcedds_c.h b/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_microxrcedds_c.h deleted file mode 100755 index b9ef0320..00000000 --- a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__rosidl_typesupport_microxrcedds_c.h +++ /dev/null @@ -1,39 +0,0 @@ -// generated from rosidl_typesupport_microxrcedds_c/resource/idl__rosidl_typesupport_c.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice -#ifndef CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ -#define CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ - - -#include -#include -#include -#include "rosidl_runtime_c/message_type_support_struct.h" -#include "rosidl_typesupport_interface/macros.h" -#include "control_msgs/msg/rosidl_typesupport_microxrcedds_c__visibility_control.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t get_serialized_size_control_msgs__msg__MecanumDriveControllerState( - const void * untyped_ros_message, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t max_serialized_size_control_msgs__msg__MecanumDriveControllerState( - bool * full_bounded, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_c, control_msgs, msg, MecanumDriveControllerState)(); - -#ifdef __cplusplus -} -#endif - - -#endif // CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__struct.h b/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__struct.h deleted file mode 100755 index f321bcd8..00000000 --- a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__struct.h +++ /dev/null @@ -1,51 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__struct.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__STRUCT_H_ -#define CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__STRUCT_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include -#include - - -// Constants defined in the message - -// Include directives for member types -// Member 'header' -#include "std_msgs/msg/detail/header__struct.h" -// Member 'reference_velocity' -#include "geometry_msgs/msg/detail/twist__struct.h" - -/// Struct defined in msg/MecanumDriveControllerState in the package control_msgs. -typedef struct control_msgs__msg__MecanumDriveControllerState -{ - std_msgs__msg__Header header; - double front_left_wheel_velocity; - double back_left_wheel_velocity; - double back_right_wheel_velocity; - double front_right_wheel_velocity; - geometry_msgs__msg__Twist reference_velocity; -} control_msgs__msg__MecanumDriveControllerState; - -// Struct for a sequence of control_msgs__msg__MecanumDriveControllerState. -typedef struct control_msgs__msg__MecanumDriveControllerState__Sequence -{ - control_msgs__msg__MecanumDriveControllerState * data; - /// The number of valid items in data - size_t size; - /// The number of allocated items in data - size_t capacity; -} control_msgs__msg__MecanumDriveControllerState__Sequence; - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__STRUCT_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__type_support.h b/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__type_support.h deleted file mode 100755 index e1ad91eb..00000000 --- a/libmicroros/include/control_msgs/msg/detail/mecanum_drive_controller_state__type_support.h +++ /dev/null @@ -1,33 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__type_support.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__TYPE_SUPPORT_H_ -#define CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__TYPE_SUPPORT_H_ - -#include "rosidl_typesupport_interface/macros.h" - -#include "control_msgs/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_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( - rosidl_typesupport_c, - control_msgs, - msg, - MecanumDriveControllerState -)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__MECANUM_DRIVE_CONTROLLER_STATE__TYPE_SUPPORT_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__functions.h b/libmicroros/include/control_msgs/msg/detail/steering_controller_status__functions.h deleted file mode 100755 index 4a28e092..00000000 --- a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__functions.h +++ /dev/null @@ -1,177 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__functions.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__FUNCTIONS_H_ -#define CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include - -#include "rosidl_runtime_c/visibility_control.h" -#include "control_msgs/msg/rosidl_generator_c__visibility_control.h" - -#include "control_msgs/msg/detail/steering_controller_status__struct.h" - -/// Initialize msg/SteeringControllerStatus 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( - * control_msgs__msg__SteeringControllerStatus - * )) before or use - * control_msgs__msg__SteeringControllerStatus__create() - * to allocate and initialize the message. - * \return true if initialization was successful, otherwise false - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__init(control_msgs__msg__SteeringControllerStatus * msg); - -/// Finalize msg/SteeringControllerStatus message. -/** - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__SteeringControllerStatus__fini(control_msgs__msg__SteeringControllerStatus * msg); - -/// Create msg/SteeringControllerStatus message. -/** - * It allocates the memory for the message, sets the memory to zero, and - * calls - * control_msgs__msg__SteeringControllerStatus__init(). - * \return The pointer to the initialized message if successful, - * otherwise NULL - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -control_msgs__msg__SteeringControllerStatus * -control_msgs__msg__SteeringControllerStatus__create(); - -/// Destroy msg/SteeringControllerStatus message. -/** - * It calls - * control_msgs__msg__SteeringControllerStatus__fini() - * and frees the memory of the message. - * \param[in,out] msg The allocated message pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__SteeringControllerStatus__destroy(control_msgs__msg__SteeringControllerStatus * msg); - -/// Check for msg/SteeringControllerStatus 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_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__are_equal(const control_msgs__msg__SteeringControllerStatus * lhs, const control_msgs__msg__SteeringControllerStatus * rhs); - -/// Copy a msg/SteeringControllerStatus 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_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__copy( - const control_msgs__msg__SteeringControllerStatus * input, - control_msgs__msg__SteeringControllerStatus * output); - -/// Initialize array of msg/SteeringControllerStatus messages. -/** - * It allocates the memory for the number of elements and calls - * control_msgs__msg__SteeringControllerStatus__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_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__Sequence__init(control_msgs__msg__SteeringControllerStatus__Sequence * array, size_t size); - -/// Finalize array of msg/SteeringControllerStatus messages. -/** - * It calls - * control_msgs__msg__SteeringControllerStatus__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_control_msgs -void -control_msgs__msg__SteeringControllerStatus__Sequence__fini(control_msgs__msg__SteeringControllerStatus__Sequence * array); - -/// Create array of msg/SteeringControllerStatus messages. -/** - * It allocates the memory for the array and calls - * control_msgs__msg__SteeringControllerStatus__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_control_msgs -control_msgs__msg__SteeringControllerStatus__Sequence * -control_msgs__msg__SteeringControllerStatus__Sequence__create(size_t size); - -/// Destroy array of msg/SteeringControllerStatus messages. -/** - * It calls - * control_msgs__msg__SteeringControllerStatus__Sequence__fini() - * on the array, - * and frees the memory of the array. - * \param[in,out] array The initialized array pointer. - */ -ROSIDL_GENERATOR_C_PUBLIC_control_msgs -void -control_msgs__msg__SteeringControllerStatus__Sequence__destroy(control_msgs__msg__SteeringControllerStatus__Sequence * array); - -/// Check for msg/SteeringControllerStatus 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_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__Sequence__are_equal(const control_msgs__msg__SteeringControllerStatus__Sequence * lhs, const control_msgs__msg__SteeringControllerStatus__Sequence * rhs); - -/// Copy an array of msg/SteeringControllerStatus 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_control_msgs -bool -control_msgs__msg__SteeringControllerStatus__Sequence__copy( - const control_msgs__msg__SteeringControllerStatus__Sequence * input, - control_msgs__msg__SteeringControllerStatus__Sequence * output); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__FUNCTIONS_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_introspection_c.h b/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_introspection_c.h deleted file mode 100755 index 943904a0..00000000 --- a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_introspection_c.h +++ /dev/null @@ -1,26 +0,0 @@ -// generated from rosidl_typesupport_introspection_c/resource/idl__rosidl_typesupport_introspection_c.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ -#define CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__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 "control_msgs/msg/rosidl_typesupport_introspection_c__visibility_control.h" - -ROSIDL_TYPESUPPORT_INTROSPECTION_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, control_msgs, msg, SteeringControllerStatus)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__ROSIDL_TYPESUPPORT_INTROSPECTION_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_microxrcedds_c.h b/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_microxrcedds_c.h deleted file mode 100755 index cc19c13f..00000000 --- a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__rosidl_typesupport_microxrcedds_c.h +++ /dev/null @@ -1,39 +0,0 @@ -// generated from rosidl_typesupport_microxrcedds_c/resource/idl__rosidl_typesupport_c.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice -#ifndef CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ -#define CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ - - -#include -#include -#include -#include "rosidl_runtime_c/message_type_support_struct.h" -#include "rosidl_typesupport_interface/macros.h" -#include "control_msgs/msg/rosidl_typesupport_microxrcedds_c__visibility_control.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t get_serialized_size_control_msgs__msg__SteeringControllerStatus( - const void * untyped_ros_message, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -size_t max_serialized_size_control_msgs__msg__SteeringControllerStatus( - bool * full_bounded, - size_t current_alignment); - -ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_PUBLIC_control_msgs -const rosidl_message_type_support_t * - ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_c, control_msgs, msg, SteeringControllerStatus)(); - -#ifdef __cplusplus -} -#endif - - -#endif // CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS__ROSIDL_TYPESUPPORT_MICROXRCEDDS_C_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__struct.h b/libmicroros/include/control_msgs/msg/detail/steering_controller_status__struct.h deleted file mode 100755 index cdba027f..00000000 --- a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__struct.h +++ /dev/null @@ -1,60 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__struct.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__STRUCT_H_ -#define CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__STRUCT_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include -#include - - -// Constants defined in the message - -// Include directives for member types -// Member 'header' -#include "std_msgs/msg/detail/header__struct.h" -// Member 'traction_wheels_position' -// Member 'traction_wheels_velocity' -// Member 'steer_positions' -// Member 'linear_velocity_command' -// Member 'steering_angle_command' -#include "rosidl_runtime_c/primitives_sequence.h" - -/// Struct defined in msg/SteeringControllerStatus in the package control_msgs. -typedef struct control_msgs__msg__SteeringControllerStatus -{ - std_msgs__msg__Header header; - /// positions of traction wheels if the robot is controlled by position - rosidl_runtime_c__double__Sequence traction_wheels_position; - /// velocities of traction wheels if the robot is controlled by velocity - rosidl_runtime_c__double__Sequence traction_wheels_velocity; - /// positions of steering joints - rosidl_runtime_c__double__Sequence steer_positions; - /// value commanded to tractions joint - rosidl_runtime_c__double__Sequence linear_velocity_command; - /// values commanded to steering joints - rosidl_runtime_c__double__Sequence steering_angle_command; -} control_msgs__msg__SteeringControllerStatus; - -// Struct for a sequence of control_msgs__msg__SteeringControllerStatus. -typedef struct control_msgs__msg__SteeringControllerStatus__Sequence -{ - control_msgs__msg__SteeringControllerStatus * data; - /// The number of valid items in data - size_t size; - /// The number of allocated items in data - size_t capacity; -} control_msgs__msg__SteeringControllerStatus__Sequence; - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__STRUCT_H_ diff --git a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__type_support.h b/libmicroros/include/control_msgs/msg/detail/steering_controller_status__type_support.h deleted file mode 100755 index 8ca0e428..00000000 --- a/libmicroros/include/control_msgs/msg/detail/steering_controller_status__type_support.h +++ /dev/null @@ -1,33 +0,0 @@ -// generated from rosidl_generator_c/resource/idl__type_support.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__TYPE_SUPPORT_H_ -#define CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__TYPE_SUPPORT_H_ - -#include "rosidl_typesupport_interface/macros.h" - -#include "control_msgs/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_control_msgs -const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( - rosidl_typesupport_c, - control_msgs, - msg, - SteeringControllerStatus -)(); - -#ifdef __cplusplus -} -#endif - -#endif // CONTROL_MSGS__MSG__DETAIL__STEERING_CONTROLLER_STATUS__TYPE_SUPPORT_H_ diff --git a/libmicroros/include/control_msgs/msg/mecanum_drive_controller_state.h b/libmicroros/include/control_msgs/msg/mecanum_drive_controller_state.h deleted file mode 100755 index 487b6e1c..00000000 --- a/libmicroros/include/control_msgs/msg/mecanum_drive_controller_state.h +++ /dev/null @@ -1,12 +0,0 @@ -// generated from rosidl_generator_c/resource/idl.h.em -// with input from control_msgs:msg/MecanumDriveControllerState.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE_H_ -#define CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE_H_ - -#include "control_msgs/msg/detail/mecanum_drive_controller_state__struct.h" -#include "control_msgs/msg/detail/mecanum_drive_controller_state__functions.h" -#include "control_msgs/msg/detail/mecanum_drive_controller_state__type_support.h" - -#endif // CONTROL_MSGS__MSG__MECANUM_DRIVE_CONTROLLER_STATE_H_ diff --git a/libmicroros/include/control_msgs/msg/steering_controller_status.h b/libmicroros/include/control_msgs/msg/steering_controller_status.h deleted file mode 100755 index 44799e63..00000000 --- a/libmicroros/include/control_msgs/msg/steering_controller_status.h +++ /dev/null @@ -1,12 +0,0 @@ -// generated from rosidl_generator_c/resource/idl.h.em -// with input from control_msgs:msg/SteeringControllerStatus.idl -// generated code does not contain a copyright notice - -#ifndef CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS_H_ -#define CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS_H_ - -#include "control_msgs/msg/detail/steering_controller_status__struct.h" -#include "control_msgs/msg/detail/steering_controller_status__functions.h" -#include "control_msgs/msg/detail/steering_controller_status__type_support.h" - -#endif // CONTROL_MSGS__MSG__STEERING_CONTROLLER_STATUS_H_ diff --git a/libmicroros/include/uxr/client/config.h b/libmicroros/include/uxr/client/config.h index 38501bc6..ad674092 100755 --- a/libmicroros/include/uxr/client/config.h +++ b/libmicroros/include/uxr/client/config.h @@ -16,9 +16,9 @@ #define _UXR_CLIENT_CONFIG_H_ #define UXR_CLIENT_VERSION_MAJOR 2 -#define UXR_CLIENT_VERSION_MINOR 4 +#define UXR_CLIENT_VERSION_MINOR 3 #define UXR_CLIENT_VERSION_MICRO 0 -#define UXR_CLIENT_VERSION_STR "2.4.0" +#define UXR_CLIENT_VERSION_STR "2.3.0" /* #undef UCLIENT_PROFILE_DISCOVERY */ diff --git a/libmicroros/include/uxr/client/core/session/create_entities_ref.h b/libmicroros/include/uxr/client/core/session/create_entities_ref.h index 4049e5d6..7b4afd35 100755 --- a/libmicroros/include/uxr/client/core/session/create_entities_ref.h +++ b/libmicroros/include/uxr/client/core/session/create_entities_ref.h @@ -51,7 +51,7 @@ UXRDLLAPI uint16_t uxr_buffer_create_participant_ref( uxrSession* session, uxrStreamId stream_id, uxrObjectId object_id, - uint16_t domain_id, + int16_t domain_id, const char* ref, uint8_t mode); diff --git a/libmicroros/libmicroros.a b/libmicroros/libmicroros.a index 8ffc5421..e3138c3f 100755 Binary files a/libmicroros/libmicroros.a and b/libmicroros/libmicroros.a differ diff --git a/librobot/motor.c b/librobot/motor.c new file mode 100644 index 00000000..73f625ea --- /dev/null +++ b/librobot/motor.c @@ -0,0 +1,52 @@ +#include "motor.h" + +void init_motor(motor *motor, int clockwise_pin, + int counterclockwise_pin, int pwm_pin) +{ + motor->clockwise_pin = clockwise_pin; + motor->counterclockwise_pin = counterclockwise_pin; + motor->pwm_pin = pwm_pin; + + gpio_init(motor->clockwise_pin); + gpio_set_dir(motor->clockwise_pin, GPIO_OUT); + gpio_pull_up(motor->clockwise_pin); + + gpio_init(motor->counterclockwise_pin); + gpio_set_dir(motor->counterclockwise_pin, GPIO_OUT); + gpio_pull_up(motor->counterclockwise_pin); + + gpio_set_function(motor->pwm_pin, GPIO_FUNC_PWM); + gpio_pull_up(motor->pwm_pin); + uint slice_num = pwm_gpio_to_slice_num(motor->pwm_pin); + pwm_set_wrap(slice_num, MAX_CYCLES); + pwm_set_gpio_level(motor->pwm_pin, 0); + pwm_set_enabled(slice_num, 1); +} + +void forward_motor(motor *motor, int speed) +{ + gpio_put(motor->clockwise_pin, 1); + gpio_put(motor->counterclockwise_pin, 0); + pwm_set_gpio_level(motor->pwm_pin, speed <= MAX_CYCLES - 1 ? speed : MAX_CYCLES - 1); +} + +void backward_motor(motor *motor, int speed) +{ + gpio_put(motor->clockwise_pin, 0); + gpio_put(motor->counterclockwise_pin, 1); + pwm_set_gpio_level(motor->pwm_pin, speed <= MAX_CYCLES - 1 ? speed : MAX_CYCLES - 1); +} + +void stop_motor(motor *motor) +{ + gpio_put(motor->clockwise_pin, 0); + gpio_put(motor->counterclockwise_pin, 0); + pwm_set_gpio_level(motor->pwm_pin, 0); +} + +void brake_motor(motor *motor) +{ + gpio_put(motor->clockwise_pin, 1); + gpio_put(motor->counterclockwise_pin, 1); + pwm_set_gpio_level(motor->pwm_pin, 0); +} \ No newline at end of file diff --git a/librobot/motor.h b/librobot/motor.h new file mode 100644 index 00000000..eb6a7e25 --- /dev/null +++ b/librobot/motor.h @@ -0,0 +1,27 @@ +#ifndef __MOTOR_H__ +#define __MOTOR_H__ + +#include "pico/stdlib.h" +#include "hardware/pwm.h" + +#define MAX_CYCLES 256 + +typedef struct +{ + uint8_t clockwise_pin; + uint8_t counterclockwise_pin; + uint8_t pwm_pin; +} motor; + +void init_motor(motor *motor, int clockwise_pin, + int counterclockwise_pin, int pwm_pin); + +void forward_motor(motor *motor, int speed); + +void backward_motor(motor *motor, int speed); + +void stop_motor(motor *motor); + +void brake_motor(motor *motor); + +#endif \ No newline at end of file diff --git a/librobot/robot.c b/librobot/robot.c new file mode 100644 index 00000000..8e62416d --- /dev/null +++ b/librobot/robot.c @@ -0,0 +1,53 @@ +#include "robot.h" +#include + +void forward_robot(robot *robot, int speed) +{ + forward_motor(&robot->motor_left, speed); + forward_motor(&robot->motor_right, speed); +} + +void backward_robot(robot *robot, int speed) +{ + backward_motor(&robot->motor_left, speed); + backward_motor(&robot->motor_right, speed); +} + +void left_robot(robot *robot, int speed) +{ + backward_motor(&robot->motor_left, speed); + forward_motor(&robot->motor_right, speed); +} + +void duck_left_robot(robot *robot, int speed) +{ + stop_motor(&robot->motor_left); + forward_motor(&robot->motor_right, speed); +} + +void right_robot(robot *robot, int speed) +{ + forward_motor(&robot->motor_left, speed); + backward_motor(&robot->motor_right, speed); +} + +void duck_right_robot(robot *robot, int speed) +{ + forward_motor(&robot->motor_left, speed); + stop_motor(&robot->motor_right); +} + +void brake_robot(robot *robot) +{ + brake_motor(&robot->motor_left); + brake_motor(&robot->motor_right); +} + +uint8_t read_sensors(sensor *wall, sensor *ground) +{ + uint8_t wall_data = read_sensor(wall); + uint8_t ground_data = read_sensor(ground); + printf("m: %d - g: %d ", wall_data, ground_data); + + return (wall_data << 3) + ground_data; +} \ No newline at end of file diff --git a/librobot/robot.h b/librobot/robot.h new file mode 100644 index 00000000..e870c51c --- /dev/null +++ b/librobot/robot.h @@ -0,0 +1,45 @@ +#ifndef __ROBOT_H__ +#define __ROBOT_H__ + +#include "pico/stdlib.h" +#include "hardware/pwm.h" +#include "librobot/motor.h" +#include "librobot/sensor.h" + +typedef enum +{ + STOP, + FORWARD, + RIGHT, + BACKWARD, + LEFT, + DUCK_LEFT, + DUCK_RIGHT +} action; + +typedef struct +{ + action state; + motor motor_left; + motor motor_right; + sensor wall; + sensor ground; +} robot; + +void forward_robot(robot *robot, int speed); + +void backward_robot(robot *robot, int speed); + +void left_robot(robot *robot, int speed); + +void duck_left_robot(robot *robot, int speed); + +void right_robot(robot *robot, int speed); + +void duck_right_robot(robot *robot, int speed); + +void brake_robot(robot *robot); + +uint8_t read_sensors(sensor *wall, sensor *ground); + +#endif \ No newline at end of file diff --git a/librobot/sensor.c b/librobot/sensor.c new file mode 100644 index 00000000..8684a312 --- /dev/null +++ b/librobot/sensor.c @@ -0,0 +1,27 @@ +#include "sensor.h" + +void init_sensor(sensor *sensor, uint8_t left, uint8_t middle, uint8_t right) +{ + sensor->left = left; + sensor->middle = middle; + sensor->right = right; + + gpio_init(sensor->left); + gpio_set_dir(sensor->left, GPIO_IN); + gpio_pull_up(sensor->left); + gpio_init(sensor->middle); + gpio_set_dir(sensor->middle, GPIO_IN); + gpio_pull_up(sensor->middle); + gpio_init(sensor->right); + gpio_set_dir(sensor->right, GPIO_IN); + gpio_pull_up(sensor->right); +} + +uint8_t read_sensor(sensor *sensor) +{ + uint8_t left = gpio_get(sensor->left); + uint8_t middle = gpio_get(sensor->middle); + uint8_t right = gpio_get(sensor->right); + + return (left << 2) + (middle << 1) + (right); +} \ No newline at end of file diff --git a/librobot/sensor.h b/librobot/sensor.h new file mode 100644 index 00000000..91e9b014 --- /dev/null +++ b/librobot/sensor.h @@ -0,0 +1,17 @@ +#ifndef __SENSOR_H__ +#define __SENSOR_H__ + +#include "hardware/gpio.h" + +typedef struct +{ + uint8_t left; + uint8_t middle; + uint8_t right; +} sensor; + +void init_sensor(sensor *sensor, uint8_t left, uint8_t middle, uint8_t right); + +uint8_t read_sensor(sensor* sensor); + +#endif \ No newline at end of file diff --git a/lwipopts.h b/lwipopts.h new file mode 100644 index 00000000..997ed7b7 --- /dev/null +++ b/lwipopts.h @@ -0,0 +1,89 @@ +#ifndef __LWIPOPTS_H__ +#define __LWIPOPTS_H__ + +// Common settings used in most of the pico_w examples +// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) + +// allow override in some examples +#ifndef NO_SYS +#define NO_SYS 1 +#endif +// allow override in some examples +#ifndef LWIP_SOCKET +#define LWIP_SOCKET 0 +#endif +#if PICO_CYW43_ARCH_POLL +#define MEM_LIBC_MALLOC 1 +#else +// MEM_LIBC_MALLOC is incompatible with non polling versions +#define MEM_LIBC_MALLOC 0 +#endif +#define MEM_ALIGNMENT 4 +#define MEM_SIZE 4000 +#define MEMP_NUM_TCP_SEG 32 +#define MEMP_NUM_ARP_QUEUE 10 +#define PBUF_POOL_SIZE 24 +#define LWIP_ARP 1 +#define LWIP_ETHERNET 1 +#define LWIP_ICMP 1 +#define LWIP_RAW 1 +#define TCP_WND (8 * TCP_MSS) +#define TCP_MSS 1460 +#define TCP_SND_BUF (8 * TCP_MSS) +#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) +#define LWIP_NETIF_STATUS_CALLBACK 1 +#define LWIP_NETIF_LINK_CALLBACK 1 +#define LWIP_NETIF_HOSTNAME 1 +#define LWIP_NETCONN 0 +#define MEM_STATS 0 +#define SYS_STATS 0 +#define MEMP_STATS 0 +#define LINK_STATS 0 +// #define ETH_PAD_SIZE 2 +#define LWIP_CHKSUM_ALGORITHM 3 +#define LWIP_DHCP 1 +#define LWIP_IPV4 1 +#define LWIP_TCP 1 +#define LWIP_UDP 1 +#define LWIP_DNS 1 +#define LWIP_TCP_KEEPALIVE 1 +#define LWIP_NETIF_TX_SINGLE_PBUF 1 +#define DHCP_DOES_ARP_CHECK 0 +#define LWIP_DHCP_DOES_ACD_CHECK 0 + +#ifndef NDEBUG +#define LWIP_DEBUG 1 +#define LWIP_STATS 1 +#define LWIP_STATS_DISPLAY 1 +#endif + +#define ETHARP_DEBUG LWIP_DBG_OFF +#define NETIF_DEBUG LWIP_DBG_OFF +#define PBUF_DEBUG LWIP_DBG_OFF +#define API_LIB_DEBUG LWIP_DBG_OFF +#define API_MSG_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define ICMP_DEBUG LWIP_DBG_OFF +#define INET_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_OFF +#define IP_REASS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define TCP_DEBUG LWIP_DBG_OFF +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#define TCP_WND_DEBUG LWIP_DBG_OFF +#define TCP_FR_DEBUG LWIP_DBG_OFF +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#define TCP_RST_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define PPP_DEBUG LWIP_DBG_OFF +#define SLIP_DEBUG LWIP_DBG_OFF +#define DHCP_DEBUG LWIP_DBG_OFF + +#endif /* __LWIPOPTS_H__ */ diff --git a/microros_static_library/library_generation/colcon.meta b/microros_static_library/library_generation/colcon.meta old mode 100755 new mode 100644 diff --git a/microros_static_library/library_generation/extra_packages/extra_packages.repos b/microros_static_library/library_generation/extra_packages/extra_packages.repos old mode 100755 new mode 100644 index 724270ef..1deca123 --- a/microros_static_library/library_generation/extra_packages/extra_packages.repos +++ b/microros_static_library/library_generation/extra_packages/extra_packages.repos @@ -2,4 +2,4 @@ repositories: control_msgs: type: git url: https://github.com/ros-controls/control_msgs - version: humble \ No newline at end of file + version: galactic-devel \ No newline at end of file diff --git a/microros_static_library/library_generation/library_generation.sh b/microros_static_library/library_generation/library_generation.sh old mode 100755 new mode 100644 index 7ae4c93d..bc44535e --- a/microros_static_library/library_generation/library_generation.sh +++ b/microros_static_library/library_generation/library_generation.sh @@ -63,8 +63,6 @@ done ######## Generate extra files ######## find firmware/mcu_ws/ros2 \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' > /project/available_ros2_types find firmware/mcu_ws/extra_packages \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' >> /project/available_ros2_types -# sort it so that the result order is reproducible -sort -o /project/available_ros2_types /project/available_ros2_types cd firmware echo "" > /project/built_packages diff --git a/microros_static_library/library_generation/toolchain.cmake b/microros_static_library/library_generation/toolchain.cmake old mode 100755 new mode 100644 diff --git a/pico_micro_ros_example.c b/pico_micro_ros_example.c index 4eb0e422..3c767dfb 100755 --- a/pico_micro_ros_example.c +++ b/pico_micro_ros_example.c @@ -4,36 +4,76 @@ #include #include #include -#include + +#include + #include #include "pico/stdlib.h" -#include "pico_uart_transports.h" +#include "pico_wifi_transport.h" +#include "librobot/robot.h" -const uint LED_PIN = 25; +robot picobot; +action current_state = STOP; rcl_publisher_t publisher; -std_msgs__msg__Int32 msg; +rcl_subscription_t subscriber; + +std_msgs__msg__Int8 msg_pub; +std_msgs__msg__Int8 msg_sub; void timer_callback(rcl_timer_t *timer, int64_t last_call_time) { - rcl_ret_t ret = rcl_publish(&publisher, &msg, NULL); - msg.data++; + msg_pub.data = read_sensors(&picobot.wall, &picobot.ground); + char buf[3]; + sprintf(buf, "%d", msg_pub.data); + printf("%s ", buf); + rcl_ret_t ret = rcl_publish(&publisher, &msg_pub, NULL); + + switch (current_state) + { + case STOP: + brake_robot(&picobot); + break; + case FORWARD: + forward_robot(&picobot, 50); + break; + case RIGHT: + right_robot(&picobot, 45); + break; + case BACKWARD: + backward_robot(&picobot, 50); + break; + case LEFT: + left_robot(&picobot, 45); + break; + case DUCK_LEFT: + duck_left_robot(&picobot, 50); + break; + case DUCK_RIGHT: + duck_right_robot(&picobot, 50); + break; + default: + break; + } +} + +void subscription_callback(const void *msgin) +{ + const std_msgs__msg__Int8 *msg = (const std_msgs__msg__Int8 *)msgin; + + current_state = msg->data; } int main() { - rmw_uros_set_custom_transport( - true, - NULL, - pico_serial_transport_open, - pico_serial_transport_close, - pico_serial_transport_write, - pico_serial_transport_read - ); - - gpio_init(LED_PIN); - gpio_set_dir(LED_PIN, GPIO_OUT); + set_microros_wifi_transports("SSID", "PASSWORD", "PC IP ADDRESS", 4444); + + picobot.state = STOP; + init_motor(&picobot.motor_left, 20, 19, 21); + init_motor(&picobot.motor_right, 17, 18, 16); + init_sensor(&picobot.wall, 26, 27, 28); + init_sensor(&picobot.ground, 13, 12, 11); rcl_timer_t timer; rcl_node_t node; @@ -44,7 +84,7 @@ int main() allocator = rcl_get_default_allocator(); // Wait for agent successful ping for 2 minutes. - const int timeout_ms = 1000; + const int timeout_ms = 1000; const uint8_t attempts = 120; rcl_ret_t ret = rmw_uros_ping_agent(timeout_ms, attempts); @@ -52,33 +92,39 @@ int main() if (ret != RCL_RET_OK) { // Unreachable agent, exiting program. + printf("Agent unreachable. Exiting..."); return ret; } rclc_support_init(&support, 0, NULL, &allocator); - rclc_node_init_default(&node, "pico_node", "", &support); - rclc_publisher_init_default( + rclc_node_init_default(&node, "picobot_node", "", &support); + + rclc_subscription_init_best_effort( + &subscriber, + &node, + ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int8), + "picobot/cmd_vel"); + + rclc_publisher_init_best_effort( &publisher, &node, - ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), - "pico_publisher"); + ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int8), + "picobot/sensors"); rclc_timer_init_default( &timer, &support, - RCL_MS_TO_NS(1000), + RCL_MS_TO_NS(100), timer_callback); - rclc_executor_init(&executor, &support.context, 1, &allocator); + rclc_executor_init(&executor, &support.context, 2, &allocator); rclc_executor_add_timer(&executor, &timer); + rclc_executor_add_subscription(&executor, &subscriber, &msg_sub, &subscription_callback, ON_NEW_DATA); - gpio_put(LED_PIN, 1); - - msg.data = 0; while (true) { - rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)); + rcl_ret_t ret = rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)); } return 0; -} +} \ No newline at end of file diff --git a/pico_uart_transport.c b/pico_uart_transport.c deleted file mode 100755 index 84f784ac..00000000 --- a/pico_uart_transport.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include "pico/stdlib.h" - -#include - -void usleep(uint64_t us) -{ - sleep_us(us); -} - -int clock_gettime(clockid_t unused, struct timespec *tp) -{ - uint64_t m = time_us_64(); - tp->tv_sec = m / 1000000; - tp->tv_nsec = (m % 1000000) * 1000; - return 0; -} - -bool pico_serial_transport_open(struct uxrCustomTransport * transport) -{ - stdio_init_all(); - return true; -} - -bool pico_serial_transport_close(struct uxrCustomTransport * transport) -{ - return true; -} - -size_t pico_serial_transport_write(struct uxrCustomTransport * transport, uint8_t *buf, size_t len, uint8_t *errcode) -{ - for (size_t i = 0; i < len; i++) - { - if (buf[i] != putchar(buf[i])) - { - *errcode = 1; - return i; - } - } - return len; -} - -size_t pico_serial_transport_read(struct uxrCustomTransport * transport, uint8_t *buf, size_t len, int timeout, uint8_t *errcode) -{ - uint64_t start_time_us = time_us_64(); - for (size_t i = 0; i < len; i++) - { - int64_t elapsed_time_us = timeout * 1000 - (time_us_64() - start_time_us); - if (elapsed_time_us < 0) - { - *errcode = 1; - return i; - } - - int character = getchar_timeout_us(elapsed_time_us); - if (character == PICO_ERROR_TIMEOUT) - { - *errcode = 1; - return i; - } - buf[i] = character; - } - return len; -} diff --git a/pico_uart_transports.h b/pico_uart_transports.h deleted file mode 100755 index 124e02f9..00000000 --- a/pico_uart_transports.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MICRO_ROS_PICOSDK -#define MICRO_ROS_PICOSDK - -#include -#include - -#include - -bool pico_serial_transport_open(struct uxrCustomTransport * transport); -bool pico_serial_transport_close(struct uxrCustomTransport * transport); -size_t pico_serial_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err); -size_t pico_serial_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err); - -#endif //MICRO_ROS_PICOSDK diff --git a/pico_wifi_transport.c b/pico_wifi_transport.c new file mode 100755 index 00000000..47255ded --- /dev/null +++ b/pico_wifi_transport.c @@ -0,0 +1,108 @@ +#include +#include +#include + +#include "pico/stdlib.h" +#include "pico/cyw43_arch.h" + +#include "lwip/pbuf.h" +#include "lwip/udp.h" + +#include + +struct micro_ros_agent_locator +{ + ip_addr_t address; + int port; +}; + +struct transport_buffer +{ + uint8_t *buf; + bool packet_received; +}; + +void usleep(uint64_t us) +{ + sleep_us(us); +} + +int clock_gettime(clockid_t unused, struct timespec *tp) +{ + uint64_t m = time_us_64(); + tp->tv_sec = m / 1000000; + tp->tv_nsec = (m % 1000000) * 1000; + return 0; +} + +static struct udp_pcb *pcb; + +bool pico_wifi_transport_open(struct uxrCustomTransport *transport) +{ + struct micro_ros_agent_locator *locator = (struct micro_ros_agent_locator *)transport->args; + + pcb = udp_new(); + + err_t bind_error = udp_bind(pcb, IP_ADDR_ANY, locator->port); + + bind_error = udp_connect(pcb, &locator->address, locator->port); + + return bind_error == ERR_OK; +} + +bool pico_wifi_transport_close(struct uxrCustomTransport *transport) +{ + udp_disconnect(pcb); + return true; +} + +size_t pico_wifi_transport_write(struct uxrCustomTransport *transport, const uint8_t *buf, size_t len, uint8_t *errcode) +{ + + struct micro_ros_agent_locator *locator = (struct micro_ros_agent_locator *)transport->args; + + struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM); + + memcpy(p->payload, buf, p->len); + + err_t er = udp_send(pcb, p); + + pbuf_free(p); + + if (er != ERR_OK) + { + printf("Writing error"); + return 0; + } + + return len; +} + +static void udp_recv_callback(void *arg, struct udp_pcb *pcb, + struct pbuf *p, const ip_addr_t *addr, u16_t port) +{ + struct transport_buffer *transport_buffer = (struct transport_buffer *)arg; + memcpy(transport_buffer->buf, p->payload, p->len); + pbuf_free(p); + transport_buffer->packet_received = true; +} + +size_t pico_wifi_transport_read(struct uxrCustomTransport *transport, uint8_t *buf, size_t len, int timeout, uint8_t *errcode) +{ + (void)errcode; + + struct transport_buffer transport_buffer = {buf, false}; + + + uint64_t start_time_us = time_us_64(); + int64_t elapsed_time_us = timeout * 1000 - (time_us_64() - start_time_us); + + while (!transport_buffer.packet_received && elapsed_time_us > 0) + { + udp_recv(pcb, udp_recv_callback, &transport_buffer); + sleep_ms(1); + elapsed_time_us = timeout * 1000 - (time_us_64() - start_time_us); + } + + return (elapsed_time_us < 0) ? 0 : len; +} \ No newline at end of file diff --git a/pico_wifi_transport.h b/pico_wifi_transport.h new file mode 100755 index 00000000..e9a754b9 --- /dev/null +++ b/pico_wifi_transport.h @@ -0,0 +1,69 @@ +#ifndef MICRO_ROS_PICOSDK +#define MICRO_ROS_PICOSDK + +#include +#include +#include +#include + +#include "pico/stdlib.h" +#include "pico/cyw43_arch.h" + +#include "lwip/pbuf.h" +#include "lwip/udp.h" + +#include + +bool pico_wifi_transport_open(struct uxrCustomTransport *transport); +bool pico_wifi_transport_close(struct uxrCustomTransport *transport); +size_t pico_wifi_transport_write(struct uxrCustomTransport *transport, const uint8_t *buf, size_t len, uint8_t *err); +size_t pico_wifi_transport_read(struct uxrCustomTransport *transport, uint8_t *buf, size_t len, int timeout, uint8_t *err); + +struct micro_ros_agent_locator +{ + ip_addr_t address; + int port; +}; + +static inline bool set_microros_wifi_transports(char *ssid, char *pass, char *agent_ip, uint agent_port) +{ + + stdio_init_all(); + + if (cyw43_arch_init()) + { + printf("failed to initialise\n"); + return 1; + } + + cyw43_arch_enable_sta_mode(); + + sleep_ms(1000); + + printf("Connecting to Wi-Fi...\n"); + if (cyw43_arch_wifi_connect_timeout_ms(ssid, pass, CYW43_AUTH_WPA2_AES_PSK, 20000)) + { + printf("failed to connect.\n"); + return 1; + } + else + { + printf("Connected.\n"); + } + + static struct micro_ros_agent_locator locator; + ipaddr_aton(agent_ip, &locator.address); + locator.port = agent_port; + + rmw_uros_set_custom_transport( + false, + (void *)&locator, + pico_wifi_transport_open, + pico_wifi_transport_close, + pico_wifi_transport_write, + pico_wifi_transport_read); + + return 0; +} + +#endif // MICRO_ROS_PICOSDK \ No newline at end of file