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

Commit 5c9f182

Browse files
OlavhaasieProjectMarchIsha DijcksJorisWeeda
authored andcommitted
Release: v0.2.0 (#204)
* Rename namespace to march (#196) * Fix incrementing byte offsets with register And changed to unordered map * Fix clang format * Fix inconsistent variable naming * Fix: recalibrate right hip aa (#198) * Recalibrate * Fix travis dependency Co-authored-by: Project March <tech@projectmarch.nl> Co-authored-by: JorisWeeda <45165354+JorisWeeda@users.noreply.github.com> * add time updater for IMU message Co-authored-by: Project March <tech@projectmarch.nl> Co-authored-by: Isha Dijcks <I.E.Dijcks@student.tudelft.nl> Co-authored-by: JorisWeeda <45165354+JorisWeeda@users.noreply.github.com>
1 parent 9584e51 commit 5c9f182

File tree

69 files changed

+373
-402
lines changed

Some content is hidden

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

69 files changed

+373
-402
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929
- BUILDER=colcon
3030
- CATKIN_LINT=pedantic
3131
- CATKIN_LINT_ARGS='--ignore literal_project_name --ignore target_name_collision'
32-
- UPSTREAM_WORKSPACE='.rosinstall -march/march_data_collector -march/march_gait_scheduler -march/march_gain_scheduling -march/march_gait_selection -march/march_launch -march/march_safety -march/march_sound_scheduler -march/march_state_machine'
32+
- UPSTREAM_WORKSPACE='.rosinstall -march/march_data_collector -march/march_gait_scheduler -march/march_gain_scheduling -march/march_gait_selection -march/march_launch -march/march_safety -march/march_state_machine'
3333

3434
jobs:
3535
include:

march_hardware/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (CATKIN_ENABLE_TESTING)
6666
endif()
6767

6868
add_rostest_gmock(${PROJECT_NAME}-test
69-
test/march4cpp.test
69+
test/march_hardware.test
7070
test/TestRunner.cpp
7171
test/TestEncoder.cpp
7272
test/TestIMotionCube.cpp

march_hardware/include/march_hardware/ActuationMode.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <string>
66
#include <ros/console.h>
77

8-
namespace march4cpp
8+
namespace march
99
{
1010
class ActuationMode
1111
{
@@ -87,6 +87,6 @@ class ActuationMode
8787
private:
8888
Value value = unknown;
8989
};
90-
} // namespace march4cpp
90+
} // namespace march
9191

9292
#endif // MARCH_HARDWARE_ACTUATIONMODE_H

march_hardware/include/march_hardware/Encoder.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <ostream>
77

8-
namespace march4cpp
8+
namespace march
99
{
1010
class Encoder
1111
{
@@ -75,6 +75,6 @@ class Encoder
7575
<< "safetyMarginRad: " << encoder.safetyMarginRad;
7676
}
7777
};
78-
} // namespace march4cpp
78+
} // namespace march
7979

8080
#endif // MARCH_HARDWARE_ENCODER_H

march_hardware/include/march_hardware/EtherCAT/EthercatIO.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <soem/ethercatconfig.h>
1616
#include <soem/ethercatprint.h>
1717

18-
namespace march4cpp
18+
namespace march
1919
{
2020
// struct used to easily get specific bytes from a 64 bit variable
2121
struct packed_bit64
@@ -105,5 +105,5 @@ union bit8 get_output_bit8(uint16 slave_no, uint8 module_index);
105105

106106
void set_output_bit(uint16 slave_no, uint8 module_index, uint8 value);
107107

108-
} // namespace march4cpp
108+
} // namespace march
109109
#endif // MARCH_HARDWARE_ETHERCAT_ETHERCATIO_H

march_hardware/include/march_hardware/EtherCAT/EthercatMaster.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <march_hardware/Joint.h>
99

10-
namespace march4cpp
10+
namespace march
1111
{
1212
/**
1313
* Base class of the ethercat master supported with the SOEM library
@@ -46,5 +46,5 @@ class EthercatMaster
4646
void stop();
4747
};
4848

49-
} // namespace march4cpp
49+
} // namespace march
5050
#endif // MARCH_HARDWARE_ETHERCAT_ETHERCATMASTER_H

march_hardware/include/march_hardware/EtherCAT/EthercatSDO.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
#include <cstdint>
66

7-
namespace march4cpp
7+
namespace march
88
{
99
int sdo_bit8(int slave, uint32_t index, uint8_t sub, uint8_t value);
1010
int sdo_bit16(int slave, uint32_t index, uint8_t sub, uint16_t value);
1111
int sdo_bit32(int slave, uint32_t index, uint8_t sub, uint32_t value);
1212

13-
} // namespace march4cpp
13+
} // namespace march
1414

1515
#endif // MARCH_HARDWARE_ETHERCAT_ETHERCATSDO_H

march_hardware/include/march_hardware/HighVoltage.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <march_hardware/NetDriverOffsets.h>
99
#include <march_hardware/NetMonitorOffsets.h>
1010

11-
namespace march4cpp
11+
namespace march
1212
{
1313
class HighVoltage
1414
{
@@ -46,5 +46,5 @@ class HighVoltage
4646
}
4747
};
4848

49-
} // namespace march4cpp
49+
} // namespace march
5050
#endif // MARCH_HARDWARE_HIGHVOLTAGE_H

march_hardware/include/march_hardware/IMotionCube.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#ifndef MARCH_HARDWARE_IMOTIONCUBE_H
44
#define MARCH_HARDWARE_IMOTIONCUBE_H
55

6-
#include <map>
6+
#include <unordered_map>
77
#include <string>
88

99
#include <march_hardware/ActuationMode.h>
@@ -14,7 +14,7 @@
1414
#include <march_hardware/IMotionCubeState.h>
1515
#include <march_hardware/IMotionCubeTargetState.h>
1616

17-
namespace march4cpp
17+
namespace march
1818
{
1919
class IMotionCube : public Slave
2020
{
@@ -24,8 +24,8 @@ class IMotionCube : public Slave
2424

2525
void actuateIU(int iu);
2626

27-
std::map<IMCObjectName, int> misoByteOffsets;
28-
std::map<IMCObjectName, int> mosiByteOffsets;
27+
std::unordered_map<IMCObjectName, int> misoByteOffsets;
28+
std::unordered_map<IMCObjectName, int> mosiByteOffsets;
2929
void mapMisoPDOs();
3030
void mapMosiPDOs();
3131
void validateMisoPDOs();
@@ -85,8 +85,8 @@ class IMotionCube : public Slave
8585
return os << "slaveIndex: " << iMotionCube.slaveIndex << ", "
8686
<< "encoder: " << iMotionCube.encoder;
8787
}
88-
bool goToTargetState(march4cpp::IMotionCubeTargetState targetState);
88+
bool goToTargetState(march::IMotionCubeTargetState targetState);
8989
};
9090

91-
} // namespace march4cpp
91+
} // namespace march
9292
#endif // MARCH_HARDWARE_IMOTIONCUBE_H

march_hardware/include/march_hardware/IMotionCubeState.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <string>
66

7-
namespace march4cpp
7+
namespace march
88
{
99
class IMCState
1010
{
@@ -97,6 +97,6 @@ struct IMotionCubeState
9797
float motorVoltage;
9898
};
9999

100-
} // namespace march4cpp
100+
} // namespace march
101101

102102
#endif // MARCH_HARDWARE_IMOTIONCUBESTATE_H

march_hardware/include/march_hardware/IMotionCubeTargetState.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#define MARCH_HARDWARE_IMOTIONCUBETARGETSTATE_H
55

66
#include <string>
7-
namespace march4cpp
7+
namespace march
88
{
99
class IMotionCubeTargetState
1010
{
@@ -50,5 +50,5 @@ class IMotionCubeTargetState
5050
}
5151
};
5252

53-
} // namespace march4cpp
53+
} // namespace march
5454
#endif // MARCH_HARDWARE_IMOTIONCUBETARGETSTATE_H

march_hardware/include/march_hardware/Joint.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <march_hardware/TemperatureGES.h>
1111
#include <march_hardware/IMotionCubeState.h>
1212

13-
namespace march4cpp
13+
namespace march
1414
{
1515
class Joint
1616
{
@@ -86,5 +86,5 @@ class Joint
8686
void setNetNumber(int netNumber);
8787
};
8888

89-
} // namespace march4cpp
89+
} // namespace march
9090
#endif // MARCH_HARDWARE_JOINT_H

march_hardware/include/march_hardware/LowVoltage.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <march_hardware/NetDriverOffsets.h>
99
#include <march_hardware/NetMonitorOffsets.h>
1010

11-
namespace march4cpp
11+
namespace march
1212
{
1313
class LowVoltage
1414
{
@@ -43,5 +43,5 @@ class LowVoltage
4343
}
4444
};
4545

46-
} // namespace march4cpp
46+
} // namespace march
4747
#endif // MARCH_HARDWARE_LOWVOLTAGE_H

march_hardware/include/march_hardware/MarchRobot.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <march_hardware/EtherCAT/EthercatMaster.h>
1313
#include <march_hardware/PowerDistributionBoard.h>
1414

15-
namespace march4cpp
15+
namespace march
1616
{
1717
class MarchRobot
1818
{
@@ -55,8 +55,8 @@ class MarchRobot
5555
}
5656
for (unsigned int i = 0; i < lhs.jointList.size(); i++)
5757
{
58-
const march4cpp::Joint lhsJoint = lhs.jointList.at(i);
59-
const march4cpp::Joint rhsJoint = rhs.jointList.at(i);
58+
const march::Joint lhsJoint = lhs.jointList.at(i);
59+
const march::Joint rhsJoint = rhs.jointList.at(i);
6060
if (lhsJoint != rhsJoint)
6161
{
6262
return false;
@@ -75,5 +75,5 @@ class MarchRobot
7575
return os;
7676
}
7777
};
78-
} // namespace march4cpp
78+
} // namespace march
7979
#endif // MARCH_HARDWARE_MARCHROBOT_H

march_hardware/include/march_hardware/PDOmap.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
#include <string>
66
#include <utility>
77
#include <vector>
8-
#include <map>
98
#include <unordered_map>
109

1110
#include <ros/ros.h>
1211

1312
#include <march_hardware/EtherCAT/EthercatSDO.h>
1413

15-
namespace march4cpp
14+
namespace march
1615
{
1716
/** Store IMC data as a struct to prevent data overlap.*/
1817
struct IMCObject
@@ -64,7 +63,7 @@ class PDOmap
6463
/** Initiate all the entered IMC objects to prepare the PDO.*/
6564
void addObject(IMCObjectName object_name);
6665

67-
std::map<IMCObjectName, int> map(int slave_index, dataDirection direction);
66+
std::unordered_map<IMCObjectName, int> map(int slave_index, dataDirection direction);
6867

6968
static std::unordered_map<IMCObjectName, IMCObject> all_objects;
7069

@@ -75,14 +74,14 @@ class PDOmap
7574

7675
/** Configures the PDO in the IMC using the given base register address and sync manager address.
7776
* @return map of the IMC PDO object name in combination with the byte-offset in the PDO register */
78-
std::map<IMCObjectName, int> configurePDO(int slave_index, int base_register, int base_sync_manager);
77+
std::unordered_map<IMCObjectName, int> configurePDO(int slave_index, int base_register, int base_sync_manager);
7978

80-
std::map<IMCObjectName, IMCObject> PDO_objects;
79+
std::unordered_map<IMCObjectName, IMCObject> PDO_objects;
8180

8281
const int bits_per_register = 64; // Maximum amount of bits that can be constructed in one PDO message.
8382
const int nr_of_regs = 4; // Amount of registers available.
8483
const int object_sizes[3] = { 32, 16, 8 }; // Available sizes.
8584
};
86-
} // namespace march4cpp
85+
} // namespace march
8786

8887
#endif // MARCH_HARDWARE_PDOMAP_H

march_hardware/include/march_hardware/PowerDistributionBoard.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <march_hardware/LowVoltage.h>
1212
#include <march_hardware/EtherCAT/EthercatIO.h>
1313

14-
namespace march4cpp
14+
namespace march
1515
{
1616
class PowerDistributionBoard : public Slave
1717
{
@@ -52,5 +52,5 @@ class PowerDistributionBoard : public Slave
5252
<< powerDistributionBoard.highVoltage << ", " << powerDistributionBoard.lowVoltage << ")";
5353
}
5454
};
55-
} // namespace march4cpp
55+
} // namespace march
5656
#endif // MARCH_HARDWARE_POWERDISTRIBUTIONBOARD_H

march_hardware/include/march_hardware/Slave.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <stdexcept>
66
#include <ros/ros.h>
77

8-
namespace march4cpp
8+
namespace march
99
{
1010
class Slave
1111
{
@@ -35,6 +35,6 @@ class Slave
3535
return this->slaveIndex;
3636
}
3737
};
38-
} // namespace march4cpp
38+
} // namespace march
3939

4040
#endif // MARCH_HARDWARE_SLAVE_H

march_hardware/include/march_hardware/TemperatureGES.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <march_hardware/Slave.h>
77
#include "TemperatureSensor.h"
88

9-
namespace march4cpp
9+
namespace march
1010
{
1111
class TemperatureGES : public Slave, TemperatureSensor
1212
{
@@ -36,5 +36,5 @@ class TemperatureGES : public Slave, TemperatureSensor
3636
<< "temperatureByteOffset: " << temperatureGes.temperatureByteOffset;
3737
}
3838
};
39-
} // namespace march4cpp
39+
} // namespace march
4040
#endif // MARCH_HARDWARE_TEMPERATUREGES_H

march_hardware/include/march_hardware/TemperatureSensor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#ifndef MARCH_HARDWARE_TEMPERATURESENSOR_H
33
#define MARCH_HARDWARE_TEMPERATURESENSOR_H
44

5-
namespace march4cpp
5+
namespace march
66
{
77
class TemperatureSensor
88
{
99
public:
1010
virtual float getTemperature() = 0;
1111
};
12-
} // namespace march4cpp
12+
} // namespace march
1313

1414
#endif // MARCH_HARDWARE_TEMPERATURESENSOR_H

march_hardware/src/Encoder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <cmath>
66
#include <ros/ros.h>
77

8-
namespace march4cpp
8+
namespace march
99
{
1010
Encoder::Encoder(int numberOfBits, int minPositionIU, int maxPositionIU, int zeroPositionIU, float safetyMarginRad)
1111
{
@@ -118,4 +118,4 @@ int Encoder::getLowerHardLimitIU() const
118118
return lowerHardLimitIU;
119119
}
120120

121-
} // namespace march4cpp
121+
} // namespace march

march_hardware/src/EtherCAT/EthercatIO.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2019 Project March.
22
#include "march_hardware/EtherCAT/EthercatIO.h"
33

4-
namespace march4cpp
4+
namespace march
55
{
66
// TODO(Isha, Martijn, Tim) refactor this with more generic types
77
union bit64 get_input_bit64(uint16 slave_no, uint8 module_index)
@@ -152,4 +152,4 @@ void set_output_bit(uint16 slave_no, uint8 module_index, uint8 value)
152152
*ec_slave[slave_no].outputs |= (1 << (module_index - 1 + startbit));
153153
}
154154

155-
} // namespace march4cpp
155+
} // namespace march

march_hardware/src/EtherCAT/EthercatMaster.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <soem/ethercatconfig.h>
2020
#include <soem/ethercatprint.h>
2121

22-
namespace march4cpp
22+
namespace march
2323
{
2424
EthercatMaster::EthercatMaster(std::vector<Joint>* jointListPtr, std::string ifname, int maxSlaveIndex,
2525
int ecatCycleTime)
@@ -226,4 +226,4 @@ void EthercatMaster::stop()
226226
}
227227
}
228228

229-
} // namespace march4cpp
229+
} // namespace march

0 commit comments

Comments
 (0)