Skip to content

Commit

Permalink
Pass Value references instead of specialized objs
Browse files Browse the repository at this point in the history
Specializations such as `int`, `double` or `std::string` (obtained
via `.asInt()`, `.asDouble()`, `.asString()`) always convert values
and perform an initialization. We actually want to pass such invalid
(`Value.isNull() == true`) properties so that subdevices handle them
accordingly.

Closes #126.
  • Loading branch information
PeterBowman committed Oct 7, 2018
1 parent ec25c19 commit 8d528ef
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions libraries/YarpPlugins/CanBusControlboard/DeviceDriverImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ bool roboticslab::CanBusControlboard::open(yarp::os::Searchable& config)

//-- Create CAN node objects with a pointer to the CAN device, its id and tr (these are locally stored parameters).
yarp::os::Property options;
options.put("device",types.get(i).asString()); //-- "TechnosoftIpos", "LacqueyFetch", "CuiAbsolute"
options.put("canId",ids.get(i).asInt());
options.put("tr",trs.get(i).asDouble());
options.put("min",mins.get(i).asDouble());
options.put("max",maxs.get(i).asDouble());
options.put("minVel",minVels.get(i).asDouble());
options.put("maxVel",maxVels.get(i).asDouble());
options.put("k",ks.get(i).asDouble());
options.put("refAcceleration",refAccelerations.get(i).asDouble());
options.put("refSpeed",refSpeeds.get(i).asDouble());
options.put("encoderPulses",encoderPulsess.get(i).asDouble());
options.put("ptModeMs",ptModeMs);
options.put("device", types.get(i)); //-- "TechnosoftIpos", "LacqueyFetch", "CuiAbsolute"
options.put("canId", ids.get(i));
options.put("tr", trs.get(i));
options.put("min", mins.get(i));
options.put("max", maxs.get(i));
options.put("minVel", minVels.get(i));
options.put("maxVel", maxVels.get(i));
options.put("k", ks.get(i));
options.put("refAcceleration", refAccelerations.get(i));
options.put("refSpeed", refSpeeds.get(i));
options.put("encoderPulses", encoderPulsess.get(i));
options.put("ptModeMs", ptModeMs);
//std::stringstream ss; // Remember to #include <sstream>
//ss << types.get(i).asString() << "_" << ids.get(i).asInt();
//options.setMonitor(config.getMonitor(),ss.str().c_str());
Expand Down

0 comments on commit 8d528ef

Please sign in to comment.