diff --git a/cmvr-es/config/devices/arm/ethercat_dual_arm.pb.txt b/cmvr-es/config/devices/arm/ethercat_dual_arm.pb.txt index ef6171c4..287fce1e 100644 --- a/cmvr-es/config/devices/arm/ethercat_dual_arm.pb.txt +++ b/cmvr-es/config/devices/arm/ethercat_dual_arm.pb.txt @@ -3,16 +3,16 @@ arm { id: "right_ethercat_arm" motor { - motor_system_id: "right_arm_ethercat_motors" - motor_group_ids: "right_arm_ethercat_motors" + motor_system_id: "dual_arm_ethercat_motors" + motor_group_ids: "dual_arm_ethercat_motors" dof: 7 - joint_names: "R_SHOULDER_P" - joint_names: "R_SHOULDER_R" - joint_names: "R_SHOULDER_Y" - joint_names: "R_ELBOW_R" - joint_names: "R_WRIST_P" - joint_names: "R_WRIST_Y" - joint_names: "R_WRIST_R" + joint_names: "right_arm_J1" + joint_names: "right_arm_J2" + joint_names: "right_arm_J3" + joint_names: "right_arm_J4" + joint_names: "right_arm_J5" + joint_names: "right_arm_J6" + joint_names: "right_arm_J7" upd_freq: 1000 buffer_size: 50 default_vel: 1.0 @@ -21,10 +21,9 @@ arm { kinematics { pinocchio_dls_ik_solver { - urdf_path: "model/xiaoyan_description/dual_arm.urdf" - base_frame_name: "PELVIS_S" - flange_frame_name: "R_WRIST_R_S" - tcp_frame_name: "R_FINGER_TIP_FIXED" + urdf_path: "model/gen2/robot.urdf" + base_frame_name: "body_link" + flange_frame_name: "arm_link_7_2" max_iters: 100 pos_eps: 1e-6 rot_eps: 1e-6 @@ -33,13 +32,13 @@ arm { limits { enable: true source: JOINT_LIMIT_SOURCE_CUSTOM - joints { joint_name: "R_SHOULDER_P" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_SHOULDER_R" q_lb: -0.78 q_ub: 1.57 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_SHOULDER_Y" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_ELBOW_R" q_lb: 0 q_ub: 2.05 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_WRIST_P" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_WRIST_Y" q_lb: -0.78 q_ub: 0.78 qd: 5.0 qdd: 10.0 } - joints { joint_name: "R_WRIST_R" q_lb: -0.57 q_ub: 1.57 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J1" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J2" q_lb: -0.64 q_ub: 1.64 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J3" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J4" q_lb: -1.60 q_ub: 1.60 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J5" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J6" q_lb: -0.37 q_ub: 0.79 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 } } soft_limit { enable: true @@ -166,13 +165,13 @@ arm { motor_system_id: "dual_arm_ethercat_motors" motor_group_ids: "dual_arm_ethercat_motors" dof: 7 - joint_names: "L_SHOULDER_P" - joint_names: "L_SHOULDER_R" - joint_names: "L_SHOULDER_Y" - joint_names: "L_ELBOW_R" - joint_names: "L_WRIST_P" - joint_names: "L_WRIST_Y" - joint_names: "L_WRIST_R" + joint_names: "left_arm_J1" + joint_names: "left_arm_J2" + joint_names: "left_arm_J3" + joint_names: "left_arm_J4" + joint_names: "left_arm_J5" + joint_names: "left_arm_J6" + joint_names: "left_arm_J7" upd_freq: 1000 buffer_size: 50 default_vel: 1.0 @@ -181,10 +180,9 @@ arm { kinematics { pinocchio_dls_ik_solver { - urdf_path: "model/xiaoyan_description/dual_arm.urdf" - base_frame_name: "PELVIS_S" - flange_frame_name: "L_WRIST_R_S" - tcp_frame_name: "L_FINGER_TIP_FIXED" + urdf_path: "model/gen2/robot.urdf" + base_frame_name: "body_link" + flange_frame_name: "arm_link_7" max_iters: 100 pos_eps: 1e-6 rot_eps: 1e-6 @@ -193,13 +191,13 @@ arm { limits { enable: true source: JOINT_LIMIT_SOURCE_CUSTOM - joints { joint_name: "L_SHOULDER_P" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_SHOULDER_R" q_lb: -0.78 q_ub: 1.57 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_SHOULDER_Y" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_ELBOW_R" q_lb: 0 q_ub: 2.05 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_WRIST_P" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_WRIST_Y" q_lb: -0.78 q_ub: 0.78 qd: 5.0 qdd: 10.0 } - joints { joint_name: "L_WRIST_R" q_lb: -0.57 q_ub: 1.57 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J1" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J2" q_lb: -0.64 q_ub: 1.64 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J3" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J4" q_lb: -1.60 q_ub: 1.60 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J5" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J6" q_lb: -0.37 q_ub: 0.79 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 } } soft_limit { enable: true diff --git a/cmvr-es/config/devices/motor/dual_arm_ethercat_motors.pb.txt b/cmvr-es/config/devices/motor/dual_arm_ethercat_motors.pb.txt new file mode 100644 index 00000000..d064369e --- /dev/null +++ b/cmvr-es/config/devices/motor/dual_arm_ethercat_motors.pb.txt @@ -0,0 +1,93 @@ +motor { + id: "dual_arm_ethercat_motors" + + motor_groups { + id: "dual_arm_ethercat_motors" + bus_type: MOTOR_BUS_ETHERCAT + vendor: MOTOR_VENDOR_EYOU + protocol: MOTOR_PROTOCOL_ETHERCAT_CIA402 + + ethercat { + master_index: 0 + cycle_us: 1000 + slave_op_timeout_ms: 12000 + slave_state_poll_period_ms: 10 + + cia402 { + state_transition_timeout_ms: 1200 + velocity_stop_timeout_ms: 2000 + status_poll_period_ms: 10 + stopped_velocity_tolerance_rad_s: 0.001 + } + + zero_calibration { + timeout_ms: 2000 + poll_period_ms: 10 + stable_sample_count: 5 + position_tolerance_counts: 10000 + stable_delta_counts: 1000 + } + + dc { + enable: true + reference_motor_id: 1 + sync0_cycle_us: 1000 + sync0_shift_us: 0 + sync_reference_clock_period: 1 + assign_activate: 768 + sync_monitor_period_ms: 1000 + } + + slaves { motor_id: 1 alias: 0 position: 1 } + slaves { motor_id: 2 alias: 0 position: 2 } + slaves { motor_id: 3 alias: 0 position: 3 } + slaves { motor_id: 4 alias: 0 position: 4 } + slaves { motor_id: 5 alias: 0 position: 5 } + slaves { motor_id: 6 alias: 0 position: 6 } + slaves { motor_id: 7 alias: 0 position: 7 } + slaves { motor_id: 8 alias: 0 position: 8 } + slaves { motor_id: 9 alias: 0 position: 9 } + slaves { motor_id: 10 alias: 0 position: 10 } + slaves { motor_id: 11 alias: 0 position: 11 } + slaves { motor_id: 12 alias: 0 position: 12 } + slaves { motor_id: 13 alias: 0 position: 13 } + slaves { motor_id: 14 alias: 0 position: 14 } + } + + joint_limits { + enable: true + source: JOINT_LIMIT_SOURCE_CUSTOM + joints { joint_name: "right_arm_J1" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J2" q_lb: -0.64 q_ub: 1.64 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J3" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J4" q_lb: -1.60 q_ub: 1.60 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J5" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J6" q_lb: -0.37 q_ub: 0.79 qd: 5.0 qdd: 10.0 } + joints { joint_name: "right_arm_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J1" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J2" q_lb: -0.64 q_ub: 1.64 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J3" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J4" q_lb: -1.60 q_ub: 1.60 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J5" q_lb: -3.14 q_ub: 3.14 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J6" q_lb: -0.37 q_ub: 0.79 qd: 5.0 qdd: 10.0 } + joints { joint_name: "left_arm_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 } + } + + motors { + motors { id: 1 joint_name: "right_arm_J1" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 2 joint_name: "right_arm_J2" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 3 joint_name: "right_arm_J3" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 4 joint_name: "right_arm_J4" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 5 joint_name: "right_arm_J5" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 6 joint_name: "right_arm_J6" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 7 joint_name: "right_arm_J7" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 8 joint_name: "left_arm_J1" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 9 joint_name: "left_arm_J2" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 10 joint_name: "left_arm_J3" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 11 joint_name: "left_arm_J4" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 12 joint_name: "left_arm_J5" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 13 joint_name: "left_arm_J6" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + motors { id: 14 joint_name: "left_arm_J7" encoder_counts_per_rev: 65536 gear_ratio: 101.0 } + } + } +} diff --git a/cmvr-es/config/manager/device_manager.pb.txt b/cmvr-es/config/manager/device_manager.pb.txt index 49439ea8..31147f1f 100644 --- a/cmvr-es/config/manager/device_manager.pb.txt +++ b/cmvr-es/config/manager/device_manager.pb.txt @@ -196,21 +196,21 @@ device_manager { id: "dual_arm_ethercat_motors" type: DEVICE_TYPE_MOTOR_SYSTEM config_file: "devices/motor/dual_arm_ethercat_motors.pb.txt" - enable: false + enable: true } devices { id: "right_ethercat_arm" type: DEVICE_TYPE_ROBOT_ARM config_file: "devices/arm/ethercat_dual_arm.pb.txt" - enable: false + enable: true } devices { id: "left_ethercat_arm" type: DEVICE_TYPE_ROBOT_ARM config_file: "devices/arm/ethercat_dual_arm.pb.txt" - enable: false + enable: true } } diff --git a/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp b/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp index a22918c1..e9effae3 100644 --- a/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp +++ b/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp @@ -820,10 +820,18 @@ void RealsenseCamera::streaming_worker_() { } CameraStreamEncodeOptions encode_options; encode_options.draw_timestamp = enable_stream_timestamp_; + encode_options.overlay = streamOverlay(); + const Rs2Intrinsics encode_intrinsics = scaleIntrinsics( + frame_data.intrinsics, + frame_data.rgbImage.cols, + frame_data.rgbImage.rows, + rgb_to_encode.cols, + rgb_to_encode.rows); success = CameraStreamEncoder::encode(rgbEncoder_, rgb_to_encode, frame_data.rgbFrame, frame_data.bKey, + encode_intrinsics, encode_options); } if (needs_depth && frame_data.depthFrame.empty()) diff --git a/cmvr-es/service/grpc/src/grpc_system_service.cpp b/cmvr-es/service/grpc/src/grpc_system_service.cpp index b79c036f..d202e920 100644 --- a/cmvr-es/service/grpc/src/grpc_system_service.cpp +++ b/cmvr-es/service/grpc/src/grpc_system_service.cpp @@ -7,6 +7,7 @@ #include "common/base/logging/logger.h" #include "service/grpc/action/include/action_queue.h" #include "service/grpc/action/include/control_command_arbiter.h" +#include "manager/task_manager/include/task_manager.h" using namespace cmvr::device; using namespace cmvr::service; @@ -126,6 +127,9 @@ grpc::Status gRPCSystemServiceImpl::StopAll(grpc::ServerContext* context, } auto stop_lease = ControlCommandArbiter::instance().beginStop(); action_queue_->cancelAndClear(); + if (auto touch_screen_task = cmvr::task::TaskManager::getInstance().getTouchScreenTask()) { + touch_screen_task->stop(); + } dmgr_.stop(); response->mutable_header()->set_success(true); setCurrentTimestamp(response->mutable_header()->mutable_timestamp()); diff --git a/dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat b/dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat index 340807b9..08d357d7 100755 Binary files a/dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat and b/dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf b/dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf index 21dc7c70..ed5f4656 100644 --- a/dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf +++ b/dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf @@ -1,3 +1,3 @@ -MASTER0_DEVICE="42:e6:6d:44:c1:0f" +MASTER0_DEVICE="4a:33:3f:30:c1:1b" DEVICE_MODULES="generic" -UPDOWN_INTERFACES="eno1" +UPDOWN_INTERFACES="enp2s0" diff --git a/dependency/x86/third_party/ethercat/v1.7.0/etc/init.d/ethercat b/dependency/x86/third_party/ethercat/v1.7.0/etc/init.d/ethercat index 63498a9f..7a9a2dec 100755 --- a/dependency/x86/third_party/ethercat/v1.7.0/etc/init.d/ethercat +++ b/dependency/x86/third_party/ethercat/v1.7.0/etc/init.d/ethercat @@ -40,7 +40,7 @@ #------------------------------------------------------------------------------ -ETHERCATCTL="/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl -c /home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/etc/sysconfig/ethercat" +ETHERCATCTL="/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl -c /home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/etc/sysconfig/ethercat" #------------------------------------------------------------------------------ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/include/ecrt.h b/dependency/x86/third_party/ethercat/v1.7.0/include/ecrt.h index 64a43ec3..899e5c6a 100644 --- a/dependency/x86/third_party/ethercat/v1.7.0/include/ecrt.h +++ b/dependency/x86/third_party/ethercat/v1.7.0/include/ecrt.h @@ -36,6 +36,9 @@ * - Added ecrt_master_sii_caching() to set the SII caching method and added * the feature flag EC_HAVE_SII_CACHING and the enum type * ec_sii_caching_fields_t. + * - Added ecrt_slave_config_pdo_mode() to select whether a slave's PDO + * assignment and PDO configuration are read from resp. written to it via + * CoE, the enum type ec_pdo_mode_t and the feature flag EC_HAVE_PDO_MODE. * * Changes in version 1.6.0: * @@ -252,6 +255,11 @@ */ #define EC_HAVE_SII_CACHING +/** Defined, if the method ecrt_slave_config_pdo_mode() and the enum type + * ec_pdo_mode_t are available. + */ +#define EC_HAVE_PDO_MODE + /****************************************************************************/ /** Symbol visibility control macro. @@ -394,7 +402,7 @@ typedef struct { - 8: \a OP Note that each state is coded in a different - bit! */ + bit. */ } ec_slave_config_state_t; /****************************************************************************/ @@ -532,6 +540,42 @@ typedef enum { /****************************************************************************/ +/** PDO handling mode. + * + * Used for the \a assign_mode and \a config_mode parameters of + * ecrt_slave_config_pdo_mode() to select whether a slave's PDO assignment + * (which PDOs are mapped into a sync manager, CoE objects 0x1C10-0x1C13) + * resp. its PDO configuration (the entries mapped into an assigned PDO) are + * read from resp. written to the slave via CoE. + */ +typedef enum { + EC_PDO_MODE_FIXED, /**< Neither read nor write via CoE. Trust that the + slave already matches the layout given via + ecrt_slave_config_pdos() and friends. */ + EC_PDO_MODE_WRITE, /**< Write the configured state via CoE every time + the slave is configured, without reading the + current state first ("blind write"). */ + EC_PDO_MODE_READ_WRITE, /**< Read the current state via CoE while + scanning the slave, and unconditionally + (re-)write it every time the slave is + configured. This is the default. */ + EC_PDO_MODE_WRITE_IF_DIFFERENT, /**< Read the current state via CoE + while scanning the slave, and write + it back only if it differs from the + configured state. */ +} ec_pdo_mode_t; + +/** Default PDO handling mode: read via CoE while scanning, and + * unconditionally (re-)write via CoE every time the slave is configured. + * This is the behavior in effect if ecrt_slave_config_pdo_mode() is never + * called. + * + * \see ec_pdo_mode_t + */ +#define EC_PDO_MODE_DEFAULT EC_PDO_MODE_READ_WRITE + +/****************************************************************************/ + /** PDO entry configuration information. * * This is the data type of the \a entries field in ec_pdo_info_t. @@ -1444,6 +1488,58 @@ EC_PUBLIC_API int ecrt_slave_config_watchdog( so the default is used. */ ); +/** Selects how a slave's PDO assignment and PDO configuration are read + * from resp. written to it via CoE. + * + * By default (i. e. if this method is not called), a slave's PDO + * assignment and PDO configuration are both read via CoE while the bus is + * scanned, and are both unconditionally (re-)written via CoE every time + * the slave is configured (e. g. after a state change or reconnect). For + * slaves with a fixed or otherwise well-known PDO structure, this can be + * relaxed independently for the assignment and the configuration, to save + * mailbox round trips during bus scanning and/or slave configuration. + * + * If \a assign_mode resp. \a config_mode is EC_PDO_MODE_FIXED or + * EC_PDO_MODE_WRITE, the corresponding aspect is not read from the slave + * while scanning; the master then relies solely on the PDO configuration + * made available through ecrt_slave_config_pdos(), + * ecrt_slave_config_sync_manager(), ecrt_slave_config_pdo_assign_add() + * and ecrt_slave_config_pdo_mapping_add(). The application is responsible + * for making sure this matches the slave's actual capabilities in that + * case. + * + * \note Reading the PDO configuration requires first discovering the PDO + * assignment (which PDOs exist), since the master must know a PDO's index + * before it can query its entries. Therefore, whenever \a config_mode is + * EC_PDO_MODE_READ_WRITE or EC_PDO_MODE_WRITE_IF_DIFFERENT, the PDO + * assignment is read while scanning the bus as well, regardless of \a + * assign_mode. This is harmless, but means that the mailbox traffic saved + * by choosing EC_PDO_MODE_FIXED or EC_PDO_MODE_WRITE for \a assign_mode is + * not realized in that particular combination. + * + * \attention Because bus scanning happens before slave configurations are + * attached to their slaves, a non-default \a assign_mode or \a + * config_mode is only guaranteed to take effect for the scanning of a + * slave if this method is called (i. e. the slave configuration is + * created via ecrt_master_slave_config()) before that slave is scanned + * for the first time. Otherwise, the scan falls back to the default + * (reading) behavior for that particular scan; a subsequent bus rescan + * (e. g. via the "ethercat rescan" command) will pick up the configured + * mode. + * + * This method has to be called in non-realtime context before + * ecrt_master_activate(). + * + * \apiusage{master_idle,blocking} + * + * \return 0 on success, otherwise negative error code. + */ +EC_PUBLIC_API int ecrt_slave_config_pdo_mode( + ec_slave_config_t *sc, /**< Slave configuration. */ + ec_pdo_mode_t assign_mode, /**< Mode for the PDO assignment. */ + ec_pdo_mode_t config_mode /**< Mode for the PDO configuration. */ + ); + /** Add a PDO to a sync manager's PDO assignment. * * This method has to be called in non-realtime context before @@ -1660,8 +1756,63 @@ EC_PUBLIC_API int ecrt_slave_config_reg_pdo_entry_pos( * signals. * * The AssignActivate word is vendor-specific and can be taken from the XML - * device description file (Device -> Dc -> AssignActivate). Set this to zero, - * if the slave shall be operated without distributed clocks (default). + * device description file (ESI, Device -> Dc -> AssignActivate). Set this to + * zero, if the slave shall be operated without distributed clocks (default). + * + * The \a sync0_cycle and \a sync1_cycle parameters correspond to the + * \c CycleTimeSync0 and \c CycleTimeSync1 elements of the slave's XML device + * description (ESI) file, respectively, but have to be given here as + * absolute values in nanoseconds instead of relying on the \c Factor + * elements offered by the ESI. If the ESI only specifies a + * \c CycleTimeSync0Factor (and no \c CycleTimeSync0), the actual cycle time + * has to be derived from the application's own cycle time \a T (i. e. the + * period at which the application calls ecrt_master_application_time() / + * ecrt_master_send(), in nanoseconds) as follows: + * + * \code + * if CycleTimeSync0 != 0: + * sync0_cycle = CycleTimeSync0 + * else if CycleTimeSync0Factor > 0: + * sync0_cycle = T * CycleTimeSync0Factor + * else if CycleTimeSync0Factor < 0: + * sync0_cycle = T / -CycleTimeSync0Factor + * else: + * sync0_cycle = 0 + * \endcode + * + * A negative \c CycleTimeSync0Factor therefore selects a SYNC0 cycle time + * shorter than the application's cycle time (typically used for + * oversampling), while a positive factor selects a multiple of it (a factor + * greater than 1 is unusual). \a sync1_cycle is derived similarly, but + * additionally depends on the already calculated \a sync0_cycle: + * + * \code + * if CycleTimeSync1 != 0: + * T1 = CycleTimeSync1 + * else if CycleTimeSync1Factor > 0: + * T1 = sync0_cycle * CycleTimeSync1Factor + * else if CycleTimeSync1Factor < 0: + * T1 = T * -CycleTimeSync1Factor + * else: + * T1 = max(T, sync0_cycle) + * + * sync1_cycle = T1 - sync0_cycle + ShiftTimeSync1 + * \endcode + * + * Note how the sign of \c CycleTimeSync1Factor chooses between the + * application's cycle time and \a sync0_cycle as the base value. Usually, + * \c CycleTimeSync1Factor is set to -1 (thus selecting the application's + * cycle time) whenever \c CycleTimeSync0Factor is negative (oversampling), + * and to 1 whenever \c CycleTimeSync0Factor is 1. If + * \c CycleTimeSync1Factor is left at zero, a value is chosen automatically + * as shown above. In any case, make sure that + * \a sync0_cycle + \a sync1_cycle is greater than zero. + * + * \a sync0_shift can be taken directly from the ESI's \c ShiftTimeSync0 + * element. If you get PLL errors, start with zero shift time, then try one + * third and two thirds of the application cycle time. Make sure that the + * application time is passed like in the dc_user example (only cyclic, fixed + * phase). * * This method has to be called in non-realtime context before * ecrt_master_activate(). diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/cmake/ethercat/ethercat-config.cmake b/dependency/x86/third_party/ethercat/v1.7.0/lib/cmake/ethercat/ethercat-config.cmake index 49f8e81c..a8825eba 100644 --- a/dependency/x86/third_party/ethercat/v1.7.0/lib/cmake/ethercat/ethercat-config.cmake +++ b/dependency/x86/third_party/ethercat/v1.7.0/lib/cmake/ethercat/ethercat-config.cmake @@ -24,12 +24,12 @@ find_library(EtherCAT_LIBRARY NAMES ethercat - PATHS /home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/lib + PATHS /home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/lib ) find_path(EtherCAT_INCLUDE_DIR NAMES ecrt.h - PATHS /home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/include + PATHS /home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/include ) mark_as_advanced(EtherCAT_LIBRARY EtherCAT_INCLUDE_DIR) diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.a b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.a index 6ee310dc..3bcd7489 100644 Binary files a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.a and b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.a differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.la b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.la index 056b3b88..1ac9919c 100755 --- a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.la +++ b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.la @@ -38,4 +38,4 @@ dlopen='' dlpreopen='' # Directory that this library needs to be installed in: -libdir='/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/lib' +libdir='/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/lib' diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.so.1.2.0 b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.so.1.2.0 index 58bf28d2..bc6096a4 100755 Binary files a/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.so.1.2.0 and b/dependency/x86/third_party/ethercat/v1.7.0/lib/libethercat.so.1.2.0 differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/ec_generic.ko b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/ec_generic.ko new file mode 100644 index 00000000..0bc2130b Binary files /dev/null and b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/ec_generic.ko differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/igc/ec_igc.ko b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/igc/ec_igc.ko new file mode 100644 index 00000000..5297aeb7 Binary files /dev/null and b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/devices/igc/ec_igc.ko differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/examples/mini/ec_mini.ko b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/examples/mini/ec_mini.ko new file mode 100644 index 00000000..8db03da6 Binary files /dev/null and b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/examples/mini/ec_mini.ko differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/master/ec_master.ko b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/master/ec_master.ko new file mode 100644 index 00000000..4912c7bf Binary files /dev/null and b/dependency/x86/third_party/ethercat/v1.7.0/lib/modules/6.8.0-40-generic/ethercat/master/ec_master.ko differ diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/pkgconfig/libethercat.pc b/dependency/x86/third_party/ethercat/v1.7.0/lib/pkgconfig/libethercat.pc index de20cf9f..e13d9dbd 100644 --- a/dependency/x86/third_party/ethercat/v1.7.0/lib/pkgconfig/libethercat.pc +++ b/dependency/x86/third_party/ethercat/v1.7.0/lib/pkgconfig/libethercat.pc @@ -21,10 +21,10 @@ # vim: tw=78 noexpandtab # -prefix=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0 +prefix=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0 exec_prefix=${prefix} -libdir=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/lib -includedir=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/include +libdir=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/lib +includedir=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/include Name: libethercat Description: Client support library for the EtherCAT Master diff --git a/dependency/x86/third_party/ethercat/v1.7.0/lib/systemd/system/ethercat.service b/dependency/x86/third_party/ethercat/v1.7.0/lib/systemd/system/ethercat.service index 116b36cf..955e1ab0 100644 --- a/dependency/x86/third_party/ethercat/v1.7.0/lib/systemd/system/ethercat.service +++ b/dependency/x86/third_party/ethercat/v1.7.0/lib/systemd/system/ethercat.service @@ -31,8 +31,8 @@ Description=EtherCAT Master Kernel Modules [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl start -ExecStop=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl stop +ExecStart=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl start +ExecStop=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl stop [Install] WantedBy=multi-user.target diff --git a/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl b/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl index b455d52b..585cfc05 100755 --- a/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl +++ b/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl @@ -31,7 +31,7 @@ RMMOD="/sbin/rmmod" MODINFO="/sbin/modinfo" IP="/sbin/ip" -ETHERCAT="/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat" +ETHERCAT="/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/bin/ethercat" #------------------------------------------------------------------------------ @@ -39,7 +39,7 @@ if [ "$1" = "-c" ]; then ETHERCAT_CONFIG="$2" COMMAND="$3" else - ETHERCAT_CONFIG="/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf" + ETHERCAT_CONFIG="/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/etc/ethercat.conf" COMMAND="$1" fi @@ -55,6 +55,15 @@ fi #------------------------------------------------------------------------------ +std_module_name() { + case "${1}" in + ccat) echo "ec_bhf" ;; # standard driver has a different name + *) echo "${1}" ;; + esac +} + +#------------------------------------------------------------------------------ + is_mac_address() { local x='[0-9a-fA-F]' echo "$1" | grep -qE "^($x$x:){5}$x$x\$" - @@ -144,10 +153,11 @@ start) continue # ec_* module not found fi - if [ "${MODULE}" != "generic" ] && [ "${MODULE}" != "ccat" ]; then + if [ "${MODULE}" != "generic" ]; then + STDMODULE=$(std_module_name "${MODULE}") # unload standard module and check if unloading was successful - ${RMMOD} "${MODULE}" 2> /dev/null || true - if ${LSMOD} | grep "^${MODULE//-/_} " > /dev/null; then + ${RMMOD} "${STDMODULE}" 2> /dev/null || true + if ${LSMOD} | grep "^${STDMODULE//-/_} " > /dev/null; then # could not unload module ${RMMOD} ${LOADED_MODULES} exit 1 @@ -155,8 +165,8 @@ start) fi if ! ${MODPROBE} ${MODPROBE_FLAGS} "${ECMODULE}"; then - if [ "${MODULE}" != "generic" ] && [ "${MODULE}" != "ccat" ]; then - ${MODPROBE} ${MODPROBE_FLAGS} "${MODULE}" # try to restore + if [ "${MODULE}" != "generic" ]; then + ${MODPROBE} ${MODPROBE_FLAGS} "${STDMODULE}" # try to restore fi ${RMMOD} ${LOADED_MODULES} exit 1 @@ -186,10 +196,10 @@ stop) # load standard modules again for MODULE in ${DEVICE_MODULES}; do - if [ "${MODULE}" == "generic" ] || [ "${MODULE}" == "ccat" ]; then + if [ "${MODULE}" == "generic" ]; then continue fi - ${MODPROBE} ${MODPROBE_FLAGS} "${MODULE}" + ${MODPROBE} ${MODPROBE_FLAGS} "$(std_module_name "${MODULE}")" done # bring down all updown interfaces