|
@@ -179,6 +179,9 @@ int Canbus::Start() {
|
|
|
|
|
|
ros::ServiceServer SftTxtService = node_handle_->advertiseService(robot::common::SftTxtService,
|
|
|
&Canbus::SftTxtReq,this);
|
|
|
+
|
|
|
+ ros::ServiceServer ActuatorLrnCrntLmtService = node_handle_->advertiseService(robot::common::ActuatorLrnCrntLmtService,
|
|
|
+ &Canbus::ActuatorLrnCrrntLimitReq,this);
|
|
|
//data receive
|
|
|
while(ros::ok())
|
|
|
{
|
|
@@ -200,7 +203,7 @@ void Canbus::OnTimer(const ros::TimerEvent &) {
|
|
|
heatbeat = 0;
|
|
|
}
|
|
|
icuMonitor.uiICUAlive = heatbeat++;
|
|
|
-
|
|
|
+//TODO dakai
|
|
|
try
|
|
|
{
|
|
|
canObdData_pub.publish(obd);
|
|
@@ -234,6 +237,7 @@ void Canbus::OnTimer(const ros::TimerEvent &) {
|
|
|
{
|
|
|
LOG(ERROR)<<Name()<< " OnTimer error. "<< ex.what();
|
|
|
}
|
|
|
+ //TODO
|
|
|
}
|
|
|
|
|
|
void Canbus::Stop() {
|
|
@@ -276,6 +280,7 @@ void Canbus::InitServiceAndMsg()
|
|
|
//read from CAN forever - until manual break
|
|
|
int Canbus::read_loop()
|
|
|
{
|
|
|
+ //TODO dakai
|
|
|
TPCANRdMsg msg;
|
|
|
__u32 status;
|
|
|
|
|
@@ -295,7 +300,7 @@ int Canbus::read_loop()
|
|
|
return errno;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+//TODO
|
|
|
return ROBOT_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -1989,7 +1994,35 @@ bool Canbus::IOMode(canbus::IOMode::Request &req,
|
|
|
}
|
|
|
|
|
|
|
|
|
+bool Canbus::ActuatorLrnCrrntLimitReq(canbus::ActuatorLearnCurrentLimit::Request &req,
|
|
|
+ canbus::ActuatorLearnCurrentLimit::Response &res)
|
|
|
+{
|
|
|
+ LOG(INFO)<< "controlservice start ActuatorLearnCurrentLimit";
|
|
|
+
|
|
|
+ TPCANMsg canLrnLimit;
|
|
|
+ try{
|
|
|
+ T_MOT_MAXCUR request;
|
|
|
+ request.uiAccMotMaxCur = req.uiAccMotMaxCur;
|
|
|
+ request.uiBrkMotMaxCur = req.uiBrkMotMaxCur;
|
|
|
+ request.uiStrMotMaxCur = req.uiStrMotMaxCur;
|
|
|
+
|
|
|
+ MessageCoder::CanMsgPackage((void*)&request, robot::common::ActuatorLearnCurrentLimit, &canLrnLimit);
|
|
|
|
|
|
+ if (write_data(&canLrnLimit) != ROBOT_SUCCESS)
|
|
|
+ {
|
|
|
+ res.uiReturn = 0; // =0
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ res.uiReturn = 1;
|
|
|
+ }
|
|
|
+ catch (ros::Exception ex)
|
|
|
+ {
|
|
|
+ res.uiReturn = 0;
|
|
|
+ LOG(ERROR)<< "controlservice ActuatorLearnCurrentLimit failed "<< ex.what();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
|
|
|
|
|
|
} // namespace canbus
|