-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
damiao motor on dart is on CAN2 and is working now. Enable damiao mot…
…or method modified.
- Loading branch information
1 parent
897bd3a
commit 165cee6
Showing
7 changed files
with
87 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Created by Wu Feiyang on 7/13/23. | ||
// | ||
|
||
#ifndef META_DAMIAO_MOTOR_CFG_H | ||
#define META_DAMIAO_MOTOR_CFG_H | ||
|
||
/** | ||
* Damiao 4310 motor. | ||
*/ | ||
#include "hal.h" | ||
#define can_channel_1 &CAND1 | ||
#define can_channel_2 &CAND2 | ||
|
||
typedef enum motor_mode{ | ||
MIT_MODE, | ||
POS_VEL_MODE, | ||
VEL_MODE, | ||
}motor_mode_t; | ||
|
||
class DamiaoMotorBase{ | ||
public: | ||
CANDriver* can_driver; | ||
int masterID; | ||
int slaveID; | ||
float mitKp; | ||
float mitKd; | ||
float V_max; // maximum rotation speed. Unit is Rad/s. | ||
float P_max; // maximum Position. Unit is Rad. | ||
float T_max; // maximum Torque. Unit is N*m. | ||
float initial_encoder_angle; | ||
motor_mode_t mode; | ||
float kp_min; | ||
float kp_max; | ||
float kd_min; | ||
float kd_max; | ||
}; | ||
|
||
class DamiaoMotorCFG{ | ||
public: | ||
enum MotorName{ | ||
DART_LOADER, | ||
MOTOR_COUNT, | ||
}motor_usage_t; | ||
/*** | ||
* @brief Motor Configuration | ||
* The unit of all velocity is Rad/s, unit of P_MAX must be exactly identical to the value with that of the Damiao Offical tool, | ||
* whose unit is by defualt Rad. All unit of torque is N * m. The unit of @param initial_encoder_angle is degree. | ||
*/ | ||
static constexpr DamiaoMotorBase motorCfg[MOTOR_COUNT] = { | ||
{can_channel_2,0x00,0x01,1.0,0.3,30,3.141953,10.0, | ||
-124.74,POS_VEL_MODE,0.0,500.0,0.0,5.0}, | ||
}; | ||
}; | ||
|
||
#endif //META_DAMIAO_MOTOR_CFG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165cee6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the file
dev/interface/damiao_motor/damiao_motor_interface.cpp
at lines 36-37, it appears that theinit
function registers components in the CAN network from SID 0x000 to 0x500 for thedamiao callback
. This range overlaps with other common components, specifically RM motors (0x200-0x20B). This means that if thedamiao interface
is initialized before thecan motor interface
, feedback frames from common RM motors such as M3508, M2006, and GM6020 will inadvertently trigger thedamiao interface
callback function, leading to unforeseen errors. Please ensure you thoroughly review the code before integrating damiao motors with other CAN components.