Skip to content

Commit

Permalink
Added speed reading
Browse files Browse the repository at this point in the history
  • Loading branch information
lowitz committed Jul 4, 2019
1 parent 5e59003 commit 614bb66
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ version: '2'

services:
state-machine:
image: chalmersfsd/cfsd-logic-lynx-state-machine:test-delay
image: chalmersfsd/cfsd-logic-lynx-state-machine:tag
network_mode: "host"
command: "state-machine --cid=130 --freq=30"
3 changes: 3 additions & 0 deletions src/logic-state-machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ class StateMachine {
// Input from CAN proxy
const uint16_t m_senderStampAsMission = 1906;

// Input from SLAM
const uint16_t m_senderStampGroundSpeed = 3000;

// Depends on pin value in opendlv-device-stm32-lynx
const uint16_t m_gpioStampEbsOk = 49;
const uint16_t m_gpioStampAsms = 115;
Expand Down
14 changes: 13 additions & 1 deletion src/state-machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ int32_t main(int32_t argc, char **argv)

StateMachine stateMachine(od4, VERBOSE);

// StateMachine stateMachine(od4, VERBOSE);
auto onGroundSpeedReading{[&stateMachine, VERBOSE_DATA](cluon::data::Envelope &&envelope)
{
uint16_t senderStamp = envelope.senderStamp();
if (senderStamp == stateMachine.m_senderStampGroundSpeed) {
auto gsr = cluon::extractMessage<opendlv::proxy::GroundSpeedReading>(std::move(envelope));
stateMachine.setVehicleSpeed(gsr.groundSpeed());

if (VERBOSE_DATA) {
std::cout << "GroundSpeedReading: " << gsr.groundSpeed() << std::endl;
}
}
}};
od4.dataTrigger(opendlv::proxy::GroundSpeedReading::ID(), onGroundSpeedReading);

auto onPressureReading{[&stateMachine, &VERBOSE, VERBOSE_DATA](cluon::data::Envelope &&envelope)
{
Expand Down

0 comments on commit 614bb66

Please sign in to comment.