feat: update current device configuration and dependencies

This commit is contained in:
linbo 2026-09-22 13:49:23 +08:00
parent ed9df8fd31
commit 8051206d91
20 changed files with 328 additions and 64 deletions

View File

@ -3,16 +3,16 @@ arm {
id: "right_ethercat_arm" id: "right_ethercat_arm"
motor { motor {
motor_system_id: "right_arm_ethercat_motors" motor_system_id: "dual_arm_ethercat_motors"
motor_group_ids: "right_arm_ethercat_motors" motor_group_ids: "dual_arm_ethercat_motors"
dof: 7 dof: 7
joint_names: "R_SHOULDER_P" joint_names: "right_arm_J1"
joint_names: "R_SHOULDER_R" joint_names: "right_arm_J2"
joint_names: "R_SHOULDER_Y" joint_names: "right_arm_J3"
joint_names: "R_ELBOW_R" joint_names: "right_arm_J4"
joint_names: "R_WRIST_P" joint_names: "right_arm_J5"
joint_names: "R_WRIST_Y" joint_names: "right_arm_J6"
joint_names: "R_WRIST_R" joint_names: "right_arm_J7"
upd_freq: 1000 upd_freq: 1000
buffer_size: 50 buffer_size: 50
default_vel: 1.0 default_vel: 1.0
@ -21,10 +21,9 @@ arm {
kinematics { kinematics {
pinocchio_dls_ik_solver { pinocchio_dls_ik_solver {
urdf_path: "model/xiaoyan_description/dual_arm.urdf" urdf_path: "model/gen2/robot.urdf"
base_frame_name: "PELVIS_S" base_frame_name: "body_link"
flange_frame_name: "R_WRIST_R_S" flange_frame_name: "arm_link_7_2"
tcp_frame_name: "R_FINGER_TIP_FIXED"
max_iters: 100 max_iters: 100
pos_eps: 1e-6 pos_eps: 1e-6
rot_eps: 1e-6 rot_eps: 1e-6
@ -33,13 +32,13 @@ arm {
limits { limits {
enable: true enable: true
source: JOINT_LIMIT_SOURCE_CUSTOM 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: "right_arm_J1" 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: "right_arm_J2" q_lb: -0.64 q_ub: 1.64 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: "right_arm_J3" 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: "right_arm_J4" q_lb: -1.60 q_ub: 1.60 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: "right_arm_J5" 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: "right_arm_J6" q_lb: -0.37 q_ub: 0.79 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_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 }
} }
soft_limit { soft_limit {
enable: true enable: true
@ -166,13 +165,13 @@ arm {
motor_system_id: "dual_arm_ethercat_motors" motor_system_id: "dual_arm_ethercat_motors"
motor_group_ids: "dual_arm_ethercat_motors" motor_group_ids: "dual_arm_ethercat_motors"
dof: 7 dof: 7
joint_names: "L_SHOULDER_P" joint_names: "left_arm_J1"
joint_names: "L_SHOULDER_R" joint_names: "left_arm_J2"
joint_names: "L_SHOULDER_Y" joint_names: "left_arm_J3"
joint_names: "L_ELBOW_R" joint_names: "left_arm_J4"
joint_names: "L_WRIST_P" joint_names: "left_arm_J5"
joint_names: "L_WRIST_Y" joint_names: "left_arm_J6"
joint_names: "L_WRIST_R" joint_names: "left_arm_J7"
upd_freq: 1000 upd_freq: 1000
buffer_size: 50 buffer_size: 50
default_vel: 1.0 default_vel: 1.0
@ -181,10 +180,9 @@ arm {
kinematics { kinematics {
pinocchio_dls_ik_solver { pinocchio_dls_ik_solver {
urdf_path: "model/xiaoyan_description/dual_arm.urdf" urdf_path: "model/gen2/robot.urdf"
base_frame_name: "PELVIS_S" base_frame_name: "body_link"
flange_frame_name: "L_WRIST_R_S" flange_frame_name: "arm_link_7"
tcp_frame_name: "L_FINGER_TIP_FIXED"
max_iters: 100 max_iters: 100
pos_eps: 1e-6 pos_eps: 1e-6
rot_eps: 1e-6 rot_eps: 1e-6
@ -193,13 +191,13 @@ arm {
limits { limits {
enable: true enable: true
source: JOINT_LIMIT_SOURCE_CUSTOM 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: "left_arm_J1" 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: "left_arm_J2" q_lb: -0.64 q_ub: 1.64 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: "left_arm_J3" 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: "left_arm_J4" q_lb: -1.60 q_ub: 1.60 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: "left_arm_J5" 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: "left_arm_J6" q_lb: -0.37 q_ub: 0.79 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_J7" q_lb: -0.61 q_ub: 0.58 qd: 5.0 qdd: 10.0 }
} }
soft_limit { soft_limit {
enable: true enable: true

View File

@ -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 }
}
}
}

View File

@ -196,21 +196,21 @@ device_manager {
id: "dual_arm_ethercat_motors" id: "dual_arm_ethercat_motors"
type: DEVICE_TYPE_MOTOR_SYSTEM type: DEVICE_TYPE_MOTOR_SYSTEM
config_file: "devices/motor/dual_arm_ethercat_motors.pb.txt" config_file: "devices/motor/dual_arm_ethercat_motors.pb.txt"
enable: false enable: true
} }
devices { devices {
id: "right_ethercat_arm" id: "right_ethercat_arm"
type: DEVICE_TYPE_ROBOT_ARM type: DEVICE_TYPE_ROBOT_ARM
config_file: "devices/arm/ethercat_dual_arm.pb.txt" config_file: "devices/arm/ethercat_dual_arm.pb.txt"
enable: false enable: true
} }
devices { devices {
id: "left_ethercat_arm" id: "left_ethercat_arm"
type: DEVICE_TYPE_ROBOT_ARM type: DEVICE_TYPE_ROBOT_ARM
config_file: "devices/arm/ethercat_dual_arm.pb.txt" config_file: "devices/arm/ethercat_dual_arm.pb.txt"
enable: false enable: true
} }
} }

View File

@ -820,10 +820,18 @@ void RealsenseCamera::streaming_worker_() {
} }
CameraStreamEncodeOptions encode_options; CameraStreamEncodeOptions encode_options;
encode_options.draw_timestamp = enable_stream_timestamp_; 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_, success = CameraStreamEncoder::encode(rgbEncoder_,
rgb_to_encode, rgb_to_encode,
frame_data.rgbFrame, frame_data.rgbFrame,
frame_data.bKey, frame_data.bKey,
encode_intrinsics,
encode_options); encode_options);
} }
if (needs_depth && frame_data.depthFrame.empty()) if (needs_depth && frame_data.depthFrame.empty())

View File

@ -7,6 +7,7 @@
#include "common/base/logging/logger.h" #include "common/base/logging/logger.h"
#include "service/grpc/action/include/action_queue.h" #include "service/grpc/action/include/action_queue.h"
#include "service/grpc/action/include/control_command_arbiter.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::device;
using namespace cmvr::service; using namespace cmvr::service;
@ -126,6 +127,9 @@ grpc::Status gRPCSystemServiceImpl::StopAll(grpc::ServerContext* context,
} }
auto stop_lease = ControlCommandArbiter::instance().beginStop(); auto stop_lease = ControlCommandArbiter::instance().beginStop();
action_queue_->cancelAndClear(); action_queue_->cancelAndClear();
if (auto touch_screen_task = cmvr::task::TaskManager::getInstance().getTouchScreenTask()) {
touch_screen_task->stop();
}
dmgr_.stop(); dmgr_.stop();
response->mutable_header()->set_success(true); response->mutable_header()->set_success(true);
setCurrentTimestamp(response->mutable_header()->mutable_timestamp()); setCurrentTimestamp(response->mutable_header()->mutable_timestamp());

View File

@ -1,3 +1,3 @@
MASTER0_DEVICE="42:e6:6d:44:c1:0f" MASTER0_DEVICE="4a:33:3f:30:c1:1b"
DEVICE_MODULES="generic" DEVICE_MODULES="generic"
UPDOWN_INTERFACES="eno1" UPDOWN_INTERFACES="enp2s0"

View File

@ -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"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -36,6 +36,9 @@
* - Added ecrt_master_sii_caching() to set the SII caching method and added * - Added ecrt_master_sii_caching() to set the SII caching method and added
* the feature flag EC_HAVE_SII_CACHING and the enum type * the feature flag EC_HAVE_SII_CACHING and the enum type
* ec_sii_caching_fields_t. * 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: * Changes in version 1.6.0:
* *
@ -252,6 +255,11 @@
*/ */
#define EC_HAVE_SII_CACHING #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. /** Symbol visibility control macro.
@ -394,7 +402,7 @@ typedef struct {
- 8: \a OP - 8: \a OP
Note that each state is coded in a different Note that each state is coded in a different
bit! */ bit. */
} ec_slave_config_state_t; } 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. /** PDO entry configuration information.
* *
* This is the data type of the \a entries field in ec_pdo_info_t. * 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. */ 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. /** Add a PDO to a sync manager's PDO assignment.
* *
* This method has to be called in non-realtime context before * 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. * signals.
* *
* The AssignActivate word is vendor-specific and can be taken from the XML * The AssignActivate word is vendor-specific and can be taken from the XML
* device description file (Device -> Dc -> AssignActivate). Set this to zero, * device description file (ESI, Device -> Dc -> AssignActivate). Set this to
* if the slave shall be operated without distributed clocks (default). * 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 * This method has to be called in non-realtime context before
* ecrt_master_activate(). * ecrt_master_activate().

View File

@ -24,12 +24,12 @@
find_library(EtherCAT_LIBRARY find_library(EtherCAT_LIBRARY
NAMES ethercat 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 find_path(EtherCAT_INCLUDE_DIR
NAMES ecrt.h 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) mark_as_advanced(EtherCAT_LIBRARY EtherCAT_INCLUDE_DIR)

View File

@ -38,4 +38,4 @@ dlopen=''
dlpreopen='' dlpreopen=''
# Directory that this library needs to be installed in: # 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'

View File

@ -21,10 +21,10 @@
# vim: tw=78 noexpandtab # 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} exec_prefix=${prefix}
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
includedir=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/include includedir=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/include
Name: libethercat Name: libethercat
Description: Client support library for the EtherCAT Master Description: Client support library for the EtherCAT Master

View File

@ -31,8 +31,8 @@ Description=EtherCAT Master Kernel Modules
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/home/lgv/cmvr/0-workspace/cmvr-es/dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl start ExecStart=/home/cmvr/projects/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 ExecStop=/home/cmvr/projects/cmvr-es//dependency/x86/third_party/ethercat/v1.7.0/sbin/ethercatctl stop
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -31,7 +31,7 @@ RMMOD="/sbin/rmmod"
MODINFO="/sbin/modinfo" MODINFO="/sbin/modinfo"
IP="/sbin/ip" 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" ETHERCAT_CONFIG="$2"
COMMAND="$3" COMMAND="$3"
else 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" COMMAND="$1"
fi 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() { is_mac_address() {
local x='[0-9a-fA-F]' local x='[0-9a-fA-F]'
echo "$1" | grep -qE "^($x$x:){5}$x$x\$" - echo "$1" | grep -qE "^($x$x:){5}$x$x\$" -
@ -144,10 +153,11 @@ start)
continue # ec_* module not found continue # ec_* module not found
fi 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 # unload standard module and check if unloading was successful
${RMMOD} "${MODULE}" 2> /dev/null || true ${RMMOD} "${STDMODULE}" 2> /dev/null || true
if ${LSMOD} | grep "^${MODULE//-/_} " > /dev/null; then if ${LSMOD} | grep "^${STDMODULE//-/_} " > /dev/null; then
# could not unload module # could not unload module
${RMMOD} ${LOADED_MODULES} ${RMMOD} ${LOADED_MODULES}
exit 1 exit 1
@ -155,8 +165,8 @@ start)
fi fi
if ! ${MODPROBE} ${MODPROBE_FLAGS} "${ECMODULE}"; then if ! ${MODPROBE} ${MODPROBE_FLAGS} "${ECMODULE}"; then
if [ "${MODULE}" != "generic" ] && [ "${MODULE}" != "ccat" ]; then if [ "${MODULE}" != "generic" ]; then
${MODPROBE} ${MODPROBE_FLAGS} "${MODULE}" # try to restore ${MODPROBE} ${MODPROBE_FLAGS} "${STDMODULE}" # try to restore
fi fi
${RMMOD} ${LOADED_MODULES} ${RMMOD} ${LOADED_MODULES}
exit 1 exit 1
@ -186,10 +196,10 @@ stop)
# load standard modules again # load standard modules again
for MODULE in ${DEVICE_MODULES}; do for MODULE in ${DEVICE_MODULES}; do
if [ "${MODULE}" == "generic" ] || [ "${MODULE}" == "ccat" ]; then if [ "${MODULE}" == "generic" ]; then
continue continue
fi fi
${MODPROBE} ${MODPROBE_FLAGS} "${MODULE}" ${MODPROBE} ${MODPROBE_FLAGS} "$(std_module_name "${MODULE}")"
done done
# bring down all updown interfaces # bring down all updown interfaces