Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit 40fee22

Browse files
authored
Merge pull request #173 from project-march/develop
Update master
2 parents d0434ff + 6a9da45 commit 40fee22

File tree

155 files changed

+19855
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+19855
-42
lines changed

march_hardware/src/EtherCAT/EthercatMaster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ int EthercatMaster::receiveProcessData()
183183
int wkc = ec_receive_processdata(EC_TIMEOUTRET);
184184
if (wkc < this->expectedWKC)
185185
{
186-
ROS_WARN("Working counter lower than expected. EtherCAT connection may not be optimal");
186+
ROS_WARN_THROTTLE(1, "Working counter lower than expected. EtherCAT connection may not be optimal");
187187
}
188188
return wkc;
189189
}

march_hardware/src/IMotionCube.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,23 +461,23 @@ std::string IMotionCube::parseDetailedError(uint16 detailedError)
461461

462462
bool IMotionCube::goToTargetState(IMotionCubeTargetState targetState)
463463
{
464-
ROS_INFO("\tTry to go to '%s'", targetState.getDescription().c_str());
464+
ROS_DEBUG("\tTry to go to '%s'", targetState.getDescription().c_str());
465465
while (!targetState.isReached(this->getStatusWord()))
466466
{
467467
this->setControlWord(targetState.getControlWord());
468-
ROS_INFO_THROTTLE(0.5, "\tWaiting for '%s': %s", targetState.getDescription().c_str(),
468+
ROS_INFO_DELAYED_THROTTLE(2, "\tWaiting for '%s': %s", targetState.getDescription().c_str(),
469469
std::bitset<16>(this->getStatusWord()).to_string().c_str());
470470
if (targetState.getState() == IMotionCubeTargetState::OPERATION_ENABLED.getState() &&
471471
this->getState(this->getStatusWord()) == IMCState::fault)
472472
{
473-
ROS_FATAL("IMotionCube went to fault state while attempting to go to %s. Shutting down.",
473+
ROS_FATAL("IMotionCube went to fault state while attempting to go to '%s'. Shutting down.",
474474
targetState.getDescription().c_str());
475475
ROS_FATAL("Detailed Error: %s", this->parseDetailedError(this->getDetailedError()).c_str());
476476
ROS_FATAL("Motion Error: %s", this->parseMotionError(this->getMotionError()).c_str());
477477
throw std::domain_error("IMC to fault state");
478478
}
479479
}
480-
ROS_INFO("\tReached '%s'!", targetState.getDescription().c_str());
480+
ROS_DEBUG("\tReached '%s'!", targetState.getDescription().c_str());
481481
}
482482

483483
bool IMotionCube::goToOperationEnabled()

march_hardware/src/Joint.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ void Joint::prepareActuation()
2525
this->name.c_str(), this->getActuationMode().toString().c_str());
2626
if (this->allowActuation)
2727
{
28-
ROS_INFO("Preparing joint %s for actuation", this->name.c_str());
28+
ROS_INFO("[%s] Preparing for actuation", this->name.c_str());
2929
this->iMotionCube.goToOperationEnabled();
30-
ROS_INFO("\tJoint %s successfully prepared for actuation", this->name.c_str());
30+
ROS_INFO("[%s] Successfully prepared for actuation", this->name.c_str());
3131
}
3232
else
3333
{
34-
ROS_ERROR("Trying to prepare joint %s for actuation while it is not "
34+
ROS_ERROR("[%s] Trying to prepare for actuation while it is not "
3535
"allowed to actuate",
3636
this->name.c_str());
3737
}
@@ -44,9 +44,9 @@ void Joint::resetIMotionCube()
4444

4545
void Joint::actuateRad(float targetPositionRad)
4646
{
47-
ROS_ASSERT_MSG(this->allowActuation, "Joint %s is not allowed to actuate, "
48-
"yet its actuate method has been "
49-
"called.",
47+
ROS_ASSERT_MSG(this->allowActuation,
48+
"Joint %s is not allowed to actuate, "
49+
"yet its actuate method has been called",
5050
this->name.c_str());
5151
// TODO(BaCo) check that the position is allowed and does not exceed (torque)
5252
// limits.
@@ -57,17 +57,17 @@ float Joint::getAngleRad()
5757
{
5858
if (!hasIMotionCube())
5959
{
60-
ROS_WARN("Joint %s has no iMotionCube", this->name.c_str());
60+
ROS_WARN("[%s] Has no iMotionCube", this->name.c_str());
6161
return -1;
6262
}
6363
return this->iMotionCube.getAngleRad();
6464
}
6565

6666
void Joint::actuateTorque(int targetTorque)
6767
{
68-
ROS_ASSERT_MSG(this->allowActuation, "Joint %s is not allowed to actuate, "
69-
"yet its actuate method has been "
70-
"called.",
68+
ROS_ASSERT_MSG(this->allowActuation,
69+
"Joint %s is not allowed to actuate, "
70+
"yet its actuate method has been called",
7171
this->name.c_str());
7272
this->iMotionCube.actuateTorque(targetTorque);
7373
}
@@ -76,7 +76,7 @@ float Joint::getTorque()
7676
{
7777
if (!hasIMotionCube())
7878
{
79-
ROS_WARN("Joint %s has no iMotionCube", this->name.c_str());
79+
ROS_WARN("[%s] Has no iMotionCube", this->name.c_str());
8080
return -1;
8181
}
8282
return this->iMotionCube.getTorque();
@@ -86,7 +86,7 @@ int Joint::getAngleIU()
8686
{
8787
if (!hasIMotionCube())
8888
{
89-
ROS_WARN("Joint %s has no iMotionCube", this->name.c_str());
89+
ROS_WARN("[%s] Has no iMotionCube", this->name.c_str());
9090
return -1;
9191
}
9292
return this->iMotionCube.getAngleIU();
@@ -96,7 +96,7 @@ float Joint::getTemperature()
9696
{
9797
if (!hasTemperatureGES())
9898
{
99-
ROS_WARN("Joint %s has no temperature sensor", this->name.c_str());
99+
ROS_WARN("[%s] Has no temperature sensor", this->name.c_str());
100100
return -1;
101101
}
102102
return this->temperatureGES.getTemperature();

march_hardware/test/TestJoint.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ TEST_F(JointDeathTest, ActuateDisableActuation)
4545
joint.setAllowActuation(false);
4646
joint.setName("actuate_false");
4747
ASSERT_FALSE(joint.canActuate());
48-
ASSERT_DEATH(joint.actuateRad(0.3), "Joint actuate_false is not allowed to actuate, yet its actuate method has been called.");
48+
ASSERT_DEATH(joint.actuateRad(0.3), "Joint actuate_false is not allowed to actuate, "
49+
"yet its actuate method has been called");
4950
}
5051

5152
TEST_F(JointTest, NoActuationMode)
5253
{
5354
march4cpp::Joint joint;
5455
joint.setName("test_joint");
55-
ASSERT_DEATH(joint.actuateRad(1), "Joint test_joint is not allowed to actuate, yet its actuate method has been called.");
56+
ASSERT_DEATH(joint.actuateRad(1), "Joint test_joint is not allowed to actuate, "
57+
"yet its actuate method has been called");
5658
}
5759

5860
TEST_F(JointTest, ChangeActuationModeToUnknown)

march_hardware_builder/robots/march4.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ march4:
1818
temperatureges: {slaveIndex: 7, byteOffset: 0}
1919
imotioncube:
2020
slaveIndex: 8
21-
encoder: {resolution: 12, minPositionIU: 1010, maxPositionIU: 1401, zeroPositionIU: 1211, safetyMarginRad: 0.05}
21+
encoder: {resolution: 12, minPositionIU: 1035, maxPositionIU: 1438, zeroPositionIU: 1242, safetyMarginRad: 0.05}
2222

2323
- right_hip_fe:
2424
actuationMode: position
@@ -54,7 +54,7 @@ march4:
5454
temperatureges: {slaveIndex: 9, byteOffset: 4}
5555
imotioncube:
5656
slaveIndex: 10
57-
encoder: {resolution: 17, minPositionIU: 19892, maxPositionIU: 63537, zeroPositionIU: 21711, safetyMarginRad: 0.05}
57+
encoder: {resolution: 17, minPositionIU: 19808, maxPositionIU: 63543, zeroPositionIU: 21755, safetyMarginRad: 0.05}
5858

5959
- right_ankle:
6060
actuationMode: position

march_hardware_interface/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ find_package(catkin REQUIRED COMPONENTS
77
control_toolbox
88
controller_manager
99
joint_limits_interface
10+
joint_state_controller
11+
joint_trajectory_controller
1012
march_description
1113
march_hardware
1214
march_hardware_builder

march_hardware_interface/config/march4/controllers.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ march:
1414
allow_partial_joints_goal: true
1515
# When you switch to effort actuationmode, 'position_controllers' must be substituted with 'effort_controllers' and the gains must be added
1616
joints:
17-
- right_hip_fe
17+
- left_ankle
18+
- left_hip_aa
1819
- left_hip_fe
19-
- right_knee
2020
- left_knee
2121
- right_ankle
22-
- left_ankle
2322
- right_hip_aa
24-
- left_hip_aa
23+
- right_hip_fe
24+
- right_knee
2525
# gains: # Required because we're controlling an effort interface
26-
# right_hip_fe: {p: 80, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
26+
# left_ankle: {p: 160, i: 0, d: 6, i_clamp: 100, publish_state: true, antiwindup: true}
27+
# left_hip_aa: {p: 290, i: 0, d: 5, i_clamp: 100, publish_state: true, antiwindup: true}
2728
# left_hip_fe: {p: 80, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
28-
# right_knee: {p: 50, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
2929
# left_knee: {p: 50, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
3030
# right_ankle: {p: 140, i: 0, d: 5, i_clamp: 100, publish_state: true, antiwindup: true}
31-
# left_ankle: {p: 160, i: 0, d: 6, i_clamp: 100, publish_state: true, antiwindup: true}
3231
# right_hip_aa: {p: 290, i: 0, d: 5, i_clamp: 100, publish_state: true, antiwindup: true} # TODO(BaCo) tune HAA joints
33-
# left_hip_aa: {p: 290, i: 0, d: 5, i_clamp: 100, publish_state: true, antiwindup: true}
32+
# right_hip_fe: {p: 80, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
33+
# right_knee: {p: 50, i: 0, d: 10, i_clamp: 100, publish_state: true, antiwindup: true}
3434

3535
constraints:
36-
right_hip_fe:
36+
left_ankle:
3737
trajectory: 0.305
3838
goal: 0.305
39-
left_hip_fe:
39+
left_hip_aa:
4040
trajectory: 0.305
4141
goal: 0.305
42-
right_knee:
42+
left_hip_fe:
4343
trajectory: 0.305
4444
goal: 0.305
4545
left_knee:
@@ -48,12 +48,12 @@ march:
4848
right_ankle:
4949
trajectory: 0.305
5050
goal: 0.305
51-
left_ankle:
51+
right_hip_aa:
5252
trajectory: 0.305
5353
goal: 0.305
54-
right_hip_aa:
54+
right_hip_fe:
5555
trajectory: 0.305
5656
goal: 0.305
57-
left_hip_aa:
57+
right_knee:
5858
trajectory: 0.305
5959
goal: 0.305

march_hardware_interface/launch/testjoint_linear.launch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
name="record"
1111
type="record"
1212
output="screen"
13-
args="-o /home/projectmarch/Documents/logs/Testjoint.bag /march/controller/trajectory/state /clock"
13+
args="-q -o /home/projectmarch/Documents/logs/Testjoint.bag /march/controller/trajectory/state /clock"
1414
/>
1515

1616
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>

march_hardware_interface/package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<depend>roscpp</depend>
1414
<depend>std_msgs</depend>
1515
<depend>joint_limits_interface</depend>
16+
<depend>joint_trajectory_controller</depend>
17+
<depend>joint_state_controller</depend>
1618
<depend>controller_manager</depend>
1719
<depend>realtime_tools</depend>
1820
<depend>control_toolbox</depend>

march_hardware_interface/src/march_hardware_interface.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ void MarchHardwareInterface::init()
8686
{
8787
SoftJointLimits soft_limits;
8888
getSoftJointLimits(model.getJoint(joint_names_[i]), soft_limits);
89-
ROS_INFO("%s soft_limits_ (%f, %f).", joint_names_[i].c_str(), soft_limits.min_position, soft_limits.max_position);
89+
ROS_DEBUG("[%s] Soft limits set to (%f, %f)",
90+
joint_names_[i].c_str(),
91+
soft_limits.min_position,
92+
soft_limits.max_position);
9093
soft_limits_[i] = soft_limits;
9194
}
9295

@@ -96,7 +99,7 @@ void MarchHardwareInterface::init()
9699
this->read();
97100
for (int i = 0; i < num_joints_; ++i)
98101
{
99-
ROS_INFO("Joint %s: first read position: %f", joint_names_[i].c_str(), joint_position_[i]);
102+
ROS_DEBUG("[%s] First read position: %f", joint_names_[i].c_str(), joint_position_[i]);
100103
}
101104

102105
// Create march_pdb_state interface
@@ -129,7 +132,7 @@ void MarchHardwareInterface::init()
129132
{
130133
marchRobot.getPowerDistributionBoard()->getHighVoltage().setNetOnOff(true, netNumber);
131134
usleep(100000);
132-
ROS_INFO_THROTTLE(1, "Waiting on high voltage for joint %s", joint_names_[i].c_str());
135+
ROS_INFO_THROTTLE(1, "[%s] Waiting on high voltage", joint_names_[i].c_str());
133136
}
134137
}
135138
}
@@ -334,7 +337,7 @@ void MarchHardwareInterface::resetIMotionCubesUntilTheyWork()
334337
march4cpp::Joint joint = marchRobot.getJoint(joint_names_[i]);
335338
if (joint.getAngleIU() == 0)
336339
{
337-
ROS_ERROR("Joint %s failed (encoder reset)", joint_names_[i].c_str());
340+
ROS_ERROR("[%s] Failed (encoder reset)", joint_names_[i].c_str());
338341
encoderSetCorrectly = false;
339342
}
340343
}

0 commit comments

Comments
 (0)