Fix Gazebo sim plugin build (#1959)

This commit is contained in:
Peter Johnson
2019-10-19 11:35:56 -07:00
committed by GitHub
parent 2ff694fa49
commit d726591ce4
5 changed files with 13 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2014-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2014-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -9,8 +9,8 @@
#include <string>
#include <hal/Value.h>
#include <mockdata/EncoderData.h>
#include <mockdata/HAL_Value.h>
#include <mockdata/NotifyListener.h>
static void encoder_init_callback(const char* name, void* param,
@@ -54,7 +54,7 @@ void GazeboEncoder::Control(const char* command) {
if (!m_pub) {
m_pub = m_halsim->node.Advertise<gazebo::msgs::String>(
"~/simulator/encoder/dio/" +
std::to_string(HALSIM_GetDigitalChannelA(m_index)) + "/control");
std::to_string(HALSIM_GetEncoderDigitalChannelA(m_index)) + "/control");
m_pub->WaitForConnection(gazebo::common::Time(1, 0));
}
gazebo::msgs::String msg;
@@ -66,7 +66,8 @@ void GazeboEncoder::Listen() {
if (!m_sub)
m_sub = m_halsim->node.Subscribe<gazebo::msgs::Float64>(
"~/simulator/encoder/dio/" +
std::to_string(HALSIM_GetDigitalChannelA(m_index)) + "/position",
std::to_string(HALSIM_GetEncoderDigitalChannelA(m_index)) +
"/position",
&GazeboEncoder::Callback, this);
}