系统,工具,源码,语言组成的数字世界-2021-

举报
zhangrelay 发表于 2021/07/15 01:55:35 2021/07/15
1.7k+ 0 0
【摘要】 最近一些时间,主要阅读代码,包括题中所涉及的,常常思考“0”和“1”的奇妙之处,但无奈过于愚钝,未能开悟。 几乎所有现实中的人,沉溺于数字产品的时间越来越久,无论游戏,还是娱乐,或者购物,还有读书。 手机比电脑方便许多,闲暇时很少再看到发呆的现象,而多是被这屏幕勾去了魂魄,渐渐被数字产品所“奴役”。 系统:无非Computer和Phone,最近看Linux,工具:机器人...

最近一些时间,主要阅读代码,包括题中所涉及的,常常思考“0”和“1”的奇妙之处,但无奈过于愚钝,未能开悟。

几乎所有现实中的人,沉溺于数字产品的时间越来越久,无论游戏,还是娱乐,或者购物,还有读书。

手机比电脑方便许多,闲暇时很少再看到发呆的现象,而多是被这屏幕勾去了魂魄,渐渐被数字产品所“奴役”。

系统:无非Computer和Phone,最近看Linux,工具:机器人类ROS2,源码:Github,语言:C/C++

Linux内核:github.com/torvalds/linux

发现led是所有系统必备的部分呢。以Linux为例:

github.com/torvalds/linux/blob/master/drivers/leds/leds.h


      #ifndef __LEDS_H_INCLUDED
      #define __LEDS_H_INCLUDED
      #include <linux/rwsem.h>
      #include <linux/leds.h>
      static inline int led_get_brightness(struct led_classdev *led_cdev)
      {
     	return led_cdev->brightness;
      }
      void led_init_core(struct led_classdev *led_cdev);
      void led_stop_software_blink(struct led_classdev *led_cdev);
      void led_set_brightness_nopm(struct led_classdev *led_cdev,
      enum led_brightness value);
      void led_set_brightness_nosleep(struct led_classdev *led_cdev,
      enum led_brightness value);
      ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
       struct bin_attribute *attr, char *buf,
       loff_t pos, size_t count);
      ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
       struct bin_attribute *bin_attr, char *buf,
       loff_t pos, size_t count);
      extern struct rw_semaphore leds_list_lock;
      extern struct list_head leds_list;
      extern struct list_head trigger_list;
      extern const char * const led_colors[LED_COLOR_ID_MAX];
      #endif /* __LEDS_H_INCLUDED */
  
 

包含初始化核心,闪烁,亮度等一些功能。

当然在设备中还可看到看门狗,USB,I2C等。

工具中可以看到一些常用监测tools/leds/uledmon.c:


      #include <fcntl.h>
      #include <stdio.h>
      #include <string.h>
      #include <time.h>
      #include <unistd.h>
      #include <linux/uleds.h>
      int main(int argc, char const *argv[])
      {
     	struct uleds_user_dev uleds_dev;
     	int fd, ret;
     	int brightness;
     	struct timespec ts;
     	if (argc != 2) {
     		fprintf(stderr, "Requires <device-name> argument\n");
     		return 1;
      	}
     	strncpy(uleds_dev.name, argv[1], LED_MAX_NAME_SIZE);
      	uleds_dev.max_brightness = 100;
      	fd = open("/dev/uleds", O_RDWR);
     	if (fd == -1) {
      		perror("Failed to open /dev/uleds");
     		return 1;
      	}
      	ret = write(fd, &uleds_dev, sizeof(uleds_dev));
     	if (ret == -1) {
      		perror("Failed to write to /dev/uleds");
      		close(fd);
     		return 1;
      	}
     	while (1) {
      		ret = read(fd, &brightness, sizeof(brightness));
     		if (ret == -1) {
      			perror("Failed to read from /dev/uleds");
      			close(fd);
     			return 1;
      		}
      		clock_gettime(CLOCK_MONOTONIC, &ts);
     		printf("[%ld.%09ld] %u\n", ts.tv_sec, ts.tv_nsec, brightness);
      	}
      	close(fd);
     	return 0;
      }
  
 

比单片机程序的确复杂了许多。

工具:ros2-foxy

学习源码,才能真正掌握ros2,在此处不过多说明了。


      repositories:
        ament/ament_cmake:
       type: git
       url: https://github.com/ament/ament_cmake.git
       version: 0.9.8
        ament/ament_index:
       type: git
       url: https://github.com/ament/ament_index.git
       version: 1.0.1
        ament/ament_lint:
       type: git
       url: https://github.com/ament/ament_lint.git
       version: 0.9.6
        ament/ament_package:
       type: git
       url: https://github.com/ament/ament_package.git
       version: 0.9.3
        ament/google_benchmark_vendor:
       type: git
       url: https://github.com/ament/google_benchmark_vendor.git
       version: 0.0.3
        ament/googletest:
       type: git
       url: https://github.com/ament/googletest.git
       version: 1.8.9000
        ament/uncrustify_vendor:
       type: git
       url: https://github.com/ament/uncrustify_vendor.git
       version: 1.4.0
        eProsima/Fast-CDR:
       type: git
       url: https://github.com/eProsima/Fast-CDR.git
       version: v1.0.13
        eProsima/Fast-DDS:
       type: git
       url: https://github.com/eProsima/Fast-DDS.git
       version: v2.0.2
        eProsima/foonathan_memory_vendor:
       type: git
       url: https://github.com/eProsima/foonathan_memory_vendor.git
       version: v1.0.0
        eclipse-cyclonedds/cyclonedds:
       type: git
       url: https://github.com/eclipse-cyclonedds/cyclonedds.git
       version: 0.7.0
        osrf/osrf_pycommon:
       type: git
       url: https://github.com/osrf/osrf_pycommon.git
       version: 0.1.10
        osrf/osrf_testing_tools_cpp:
       type: git
       url: https://github.com/osrf/osrf_testing_tools_cpp.git
       version: 1.3.2
        ros-perception/laser_geometry:
       type: git
       url: https://github.com/ros-perception/laser_geometry.git
       version: 2.2.0
        ros-planning/navigation_msgs:
       type: git
       url: https://github.com/ros-planning/navigation_msgs.git
       version: 2.0.2
        ros-tooling/libstatistics_collector:
       type: git
       url: https://github.com/ros-tooling/libstatistics_collector.git
       version: 1.0.1
        ros-tracing/ros2_tracing:
       type: git
       url: https://gitlab.com/ros-tracing/ros2_tracing.git
       version: 1.0.4
        ros-visualization/interactive_markers:
       type: git
       url: https://github.com/ros-visualization/interactive_markers.git
       version: 2.1.3
        ros-visualization/python_qt_binding:
       type: git
       url: https://github.com/ros-visualization/python_qt_binding.git
       version: 1.0.5
        ros-visualization/qt_gui_core:
       type: git
       url: https://github.com/ros-visualization/qt_gui_core.git
       version: 1.1.2
        ros-visualization/rqt:
       type: git
       url: https://github.com/ros-visualization/rqt.git
       version: 1.0.6
        ros-visualization/rqt_action:
       type: git
       url: https://github.com/ros-visualization/rqt_action.git
       version: 1.0.1
        ros-visualization/rqt_console:
       type: git
       url: https://github.com/ros-visualization/rqt_console.git
       version: 1.1.1
        ros-visualization/rqt_graph:
       type: git
       url: https://github.com/ros-visualization/rqt_graph.git
       version: 1.1.0
        ros-visualization/rqt_msg:
       type: git
       url: https://github.com/ros-visualization/rqt_msg.git
       version: 1.0.2
        ros-visualization/rqt_plot:
       type: git
       url: https://github.com/ros-visualization/rqt_plot.git
       version: 1.0.8
        ros-visualization/rqt_publisher:
       type: git
       url: https://github.com/ros-visualization/rqt_publisher.git
       version: 1.1.0
        ros-visualization/rqt_py_console:
       type: git
       url: https://github.com/ros-visualization/rqt_py_console.git
       version: 1.0.0
        ros-visualization/rqt_reconfigure:
       type: git
       url: https://github.com/ros-visualization/rqt_reconfigure.git
       version: 1.0.6
        ros-visualization/rqt_service_caller:
       type: git
       url: https://github.com/ros-visualization/rqt_service_caller.git
       version: 1.0.3
        ros-visualization/rqt_shell:
       type: git
       url: https://github.com/ros-visualization/rqt_shell.git
       version: 1.0.0
        ros-visualization/rqt_srv:
       type: git
       url: https://github.com/ros-visualization/rqt_srv.git
       version: 1.0.1
        ros-visualization/rqt_top:
       type: git
       url: https://github.com/ros-visualization/rqt_top.git
       version: 1.0.0
        ros-visualization/rqt_topic:
       type: git
       url: https://github.com/ros-visualization/rqt_topic.git
       version: 1.1.0
        ros-visualization/tango_icons_vendor:
       type: git
       url: https://github.com/ros-visualization/tango_icons_vendor.git
       version: 0.0.1
        ros/class_loader:
       type: git
       url: https://github.com/ros/class_loader.git
       version: 2.0.1
        ros/kdl_parser:
       type: git
       url: https://github.com/ros/kdl_parser.git
       version: 2.4.1
        ros/pluginlib:
       type: git
       url: https://github.com/ros/pluginlib.git
       version: 2.5.3
        ros/resource_retriever:
       type: git
       url: https://github.com/ros/resource_retriever.git
       version: 2.3.4
        ros/robot_state_publisher:
       type: git
       url: https://github.com/ros/robot_state_publisher.git
       version: 2.4.1
        ros/ros_environment:
       type: git
       url: https://github.com/ros/ros_environment.git
       version: 2.5.0
        ros/ros_tutorials:
       type: git
       url: https://github.com/ros/ros_tutorials.git
       version: 1.2.5
        ros/urdfdom:
       type: git
       url: https://github.com/ros/urdfdom.git
       version: 2.3.3
        ros/urdfdom_headers:
       type: git
       url: https://github.com/ros/urdfdom_headers.git
       version: 1.0.5
        ros2/ament_cmake_ros:
       type: git
       url: https://github.com/ros2/ament_cmake_ros.git
       version: 0.9.0
        ros2/common_interfaces:
       type: git
       url: https://github.com/ros2/common_interfaces.git
       version: 2.0.3
        ros2/console_bridge_vendor:
       type: git
       url: https://github.com/ros2/console_bridge_vendor.git
       version: 1.2.3
        ros2/demos:
       type: git
       url: https://github.com/ros2/demos.git
       version: 0.9.3
        ros2/eigen3_cmake_module:
       type: git
       url: https://github.com/ros2/eigen3_cmake_module.git
       version: 0.1.1
        ros2/example_interfaces:
       type: git
       url: https://github.com/ros2/example_interfaces.git
       version: 0.9.0
        ros2/examples:
       type: git
       url: https://github.com/ros2/examples.git
       version: 0.9.4
        ros2/geometry2:
       type: git
       url: https://github.com/ros2/geometry2.git
       version: 0.13.9
        ros2/launch:
       type: git
       url: https://github.com/ros2/launch.git
       version: 0.10.4
        ros2/launch_ros:
       type: git
       url: https://github.com/ros2/launch_ros.git
       version: 0.11.1
        ros2/libyaml_vendor:
       type: git
       url: https://github.com/ros2/libyaml_vendor.git
       version: 1.0.2
        ros2/message_filters:
       type: git
       url: https://github.com/ros2/message_filters.git
       version: 3.2.4
        ros2/mimick_vendor:
       type: git
       url: https://github.com/ros2/mimick_vendor.git
       version: 0.2.3
        ros2/orocos_kinematics_dynamics:
       type: git
       url: https://github.com/ros2/orocos_kinematics_dynamics.git
       version: 3.3.1
        ros2/performance_test_fixture:
       type: git
       url: https://github.com/ros2/performance_test_fixture.git
       version: 0.0.6
        ros2/python_cmake_module:
       type: git
       url: https://github.com/ros2/python_cmake_module.git
       version: 0.8.0
        ros2/rcl:
       type: git
       url: https://github.com/ros2/rcl.git
       version: 1.1.10
        ros2/rcl_interfaces:
       type: git
       url: https://github.com/ros2/rcl_interfaces.git
       version: 1.0.0
        ros2/rcl_logging:
       type: git
       url: https://github.com/ros2/rcl_logging.git
       version: 1.0.1
        ros2/rclcpp:
       type: git
       url: https://github.com/ros2/rclcpp.git
       version: 2.3.0
        ros2/rclpy:
       type: git
       url: https://github.com/ros2/rclpy.git
       version: 1.0.4
        ros2/rcpputils:
       type: git
       url: https://github.com/ros2/rcpputils.git
       version: 1.3.1
        ros2/rcutils:
       type: git
       url: https://github.com/ros2/rcutils.git
       version: 1.1.2
        ros2/realtime_support:
       type: git
       url: https://github.com/ros2/realtime_support.git
       version: 0.9.0
        ros2/rmw:
       type: git
       url: https://github.com/ros2/rmw.git
       version: 1.0.2
        ros2/rmw_connext:
       type: git
       url: https://github.com/ros2/rmw_connext.git
       version: 1.0.3
        ros2/rmw_cyclonedds:
       type: git
       url: https://github.com/ros2/rmw_cyclonedds.git
       version: 0.7.6
        ros2/rmw_dds_common:
       type: git
       url: https://github.com/ros2/rmw_dds_common.git
       version: 1.0.2
        ros2/rmw_fastrtps:
       type: git
       url: https://github.com/ros2/rmw_fastrtps.git
       version: 1.2.4
        ros2/rmw_implementation:
       type: git
       url: https://github.com/ros2/rmw_implementation.git
       version: 1.0.1
        ros2/ros1_bridge:
       type: git
       url: https://github.com/ros2/ros1_bridge.git
       version: 0.9.6
        ros2/ros2cli:
       type: git
       url: https://github.com/ros2/ros2cli.git
       version: 0.9.8
        ros2/ros2cli_common_extensions:
       type: git
       url: https://github.com/ros2/ros2cli_common_extensions.git
       version: 0.1.0
        ros2/ros_testing:
       type: git
       url: https://github.com/ros2/ros_testing.git
       version: 0.2.1
        ros2/rosbag2:
       type: git
       url: https://github.com/ros2/rosbag2.git
       version: 0.3.5
        ros2/rosidl:
       type: git
       url: https://github.com/ros2/rosidl.git
       version: 1.2.0
        ros2/rosidl_dds:
       type: git
       url: https://github.com/ros2/rosidl_dds.git
       version: 0.7.1
        ros2/rosidl_defaults:
       type: git
       url: https://github.com/ros2/rosidl_defaults.git
       version: 1.0.0
        ros2/rosidl_python:
       type: git
       url: https://github.com/ros2/rosidl_python.git
       version: 0.9.4
        ros2/rosidl_runtime_py:
       type: git
       url: https://github.com/ros2/rosidl_runtime_py.git
       version: 0.9.0
        ros2/rosidl_typesupport:
       type: git
       url: https://github.com/ros2/rosidl_typesupport.git
       version: 1.0.1
        ros2/rosidl_typesupport_connext:
       type: git
       url: https://github.com/ros2/rosidl_typesupport_connext.git
       version: 1.0.2
        ros2/rosidl_typesupport_fastrtps:
       type: git
       url: https://github.com/ros2/rosidl_typesupport_fastrtps.git
       version: 1.0.2
        ros2/rpyutils:
       type: git
       url: https://github.com/ros2/rpyutils.git
       version: 0.2.0
        ros2/rviz:
       type: git
       url: https://github.com/ros2/rviz.git
       version: 8.2.1
        ros2/spdlog_vendor:
       type: git
       url: https://github.com/ros2/spdlog_vendor.git
       version: 1.1.2
        ros2/sros2:
       type: git
       url: https://github.com/ros2/sros2.git
       version: 0.9.4
        ros2/system_tests:
       type: git
       url: https://github.com/ros2/system_tests.git
       version: 0.9.1
        ros2/test_interface_files:
       type: git
       url: https://github.com/ros2/test_interface_files.git
       version: 0.8.0
        ros2/tinyxml2_vendor:
       type: git
       url: https://github.com/ros2/tinyxml2_vendor.git
       version: 0.7.3
        ros2/tinyxml_vendor:
       type: git
       url: https://github.com/ros2/tinyxml_vendor.git
       version: 0.8.0
        ros2/tlsf:
       type: git
       url: https://github.com/ros2/tlsf.git
       version: 0.5.0
        ros2/unique_identifier_msgs:
       type: git
       url: https://github.com/ros2/unique_identifier_msgs.git
       version: 2.1.2
        ros2/urdf:
       type: git
       url: https://github.com/ros2/urdf.git
       version: 2.4.0
        ros2/yaml_cpp_vendor:
       type: git
       url: https://github.com/ros2/yaml_cpp_vendor.git
       version: 7.0.2
  
 

系统内核还是C为主,工具以C++和Python等为主。

当然上述系统只涉及信息处理,如果需要和现实交互,需要再装备传感器和执行器{物联网机器人操作系统}。

  • 现实-传感器-{数字世界-处理-数字世界}-执行器-现实

如何以此为基础构建“自动驾驶系统”,持续学习中{Apex.Autonomy}


文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。

原文链接:zhangrelay.blog.csdn.net/article/details/113358571

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

作者其他文章

评论(0

抱歉,系统识别当前为高风险访问,暂不支持该操作

    全部回复

    上滑加载中

    设置昵称

    在此一键设置昵称,即可参与社区互动!

    *长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

    *长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。